Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nicot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
nicot
Commits
ff54f59a
Commit
ff54f59a
authored
Jun 14, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete 200
parent
5d538e3b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
src/crud-base.ts
src/crud-base.ts
+1
-4
src/decorators/restful.ts
src/decorators/restful.ts
+6
-2
No files found.
src/crud-base.ts
View file @
ff54f59a
...
@@ -36,10 +36,7 @@ export const Inner = (name: string): RelationDef => {
...
@@ -36,10 +36,7 @@ export const Inner = (name: string): RelationDef => {
export
type
ValidCrudEntity
<
T
>
=
Record
<
string
,
any
>
&
{
export
type
ValidCrudEntity
<
T
>
=
Record
<
string
,
any
>
&
{
id
:
any
;
id
:
any
;
}
&
QueryWise
<
T
>
&
}
&
Partial
<
QueryWise
<
T
>
&
DeletionWise
&
EntityHooks
&
PageSettingsFactory
>
;
DeletionWise
&
EntityHooks
&
PageSettingsFactory
;
export
interface
CrudOptions
<
T
extends
ValidCrudEntity
<
T
>>
{
export
interface
CrudOptions
<
T
extends
ValidCrudEntity
<
T
>>
{
relations
?:
(
string
|
RelationDef
)[];
relations
?:
(
string
|
RelationDef
)[];
...
...
src/decorators/restful.ts
View file @
ff54f59a
...
@@ -2,6 +2,7 @@ import {
...
@@ -2,6 +2,7 @@ import {
Body
,
Body
,
Delete
,
Delete
,
Get
,
Get
,
HttpCode
,
Param
,
Param
,
ParseIntPipe
,
ParseIntPipe
,
Patch
,
Patch
,
...
@@ -89,12 +90,13 @@ export class RestfulFactory<T> {
...
@@ -89,12 +90,13 @@ export class RestfulFactory<T> {
create
(
extras
:
Partial
<
OperationObject
>
=
{}):
MethodDecorator
{
create
(
extras
:
Partial
<
OperationObject
>
=
{}):
MethodDecorator
{
return
MergeMethodDecorators
([
return
MergeMethodDecorators
([
Post
(),
Post
(),
HttpCode
(
200
),
ApiOperation
({
ApiOperation
({
summary
:
`Create a new
${
this
.
entityClass
.
name
}
`
,
summary
:
`Create a new
${
this
.
entityClass
.
name
}
`
,
...
extras
,
...
extras
,
}),
}),
ApiBody
({
type
:
this
.
createDto
}),
ApiBody
({
type
:
this
.
createDto
}),
Api
Created
Response
({
type
:
this
.
entityReturnMessageDto
}),
Api
Ok
Response
({
type
:
this
.
entityReturnMessageDto
}),
]);
]);
}
}
...
@@ -137,6 +139,7 @@ export class RestfulFactory<T> {
...
@@ -137,6 +139,7 @@ export class RestfulFactory<T> {
update
(
extras
:
Partial
<
OperationObject
>
=
{}):
MethodDecorator
{
update
(
extras
:
Partial
<
OperationObject
>
=
{}):
MethodDecorator
{
return
MergeMethodDecorators
([
return
MergeMethodDecorators
([
Patch
(
'
:id
'
),
Patch
(
'
:id
'
),
HttpCode
(
200
),
ApiOperation
({
ApiOperation
({
summary
:
`Update a
${
this
.
entityClass
.
name
}
by id`
,
summary
:
`Update a
${
this
.
entityClass
.
name
}
by id`
,
...
extras
,
...
extras
,
...
@@ -154,12 +157,13 @@ export class RestfulFactory<T> {
...
@@ -154,12 +157,13 @@ export class RestfulFactory<T> {
delete
(
extras
:
Partial
<
OperationObject
>
=
{}):
MethodDecorator
{
delete
(
extras
:
Partial
<
OperationObject
>
=
{}):
MethodDecorator
{
return
MergeMethodDecorators
([
return
MergeMethodDecorators
([
Delete
(
'
:id
'
),
Delete
(
'
:id
'
),
HttpCode
(
200
),
ApiOperation
({
ApiOperation
({
summary
:
`Delete a
${
this
.
entityClass
.
name
}
by id`
,
summary
:
`Delete a
${
this
.
entityClass
.
name
}
by id`
,
...
extras
,
...
extras
,
}),
}),
ApiParam
({
name
:
'
id
'
,
type
:
this
.
idType
,
required
:
true
}),
ApiParam
({
name
:
'
id
'
,
type
:
this
.
idType
,
required
:
true
}),
Api
NoContent
Response
({
type
:
BlankReturnMessageDto
}),
Api
Ok
Response
({
type
:
BlankReturnMessageDto
}),
]);
]);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment