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
ede0080c
Commit
ede0080c
authored
Jun 16, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better docs
parent
d9deb6bd
Pipeline
#22249
passed with stages
in 1 minute and 33 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
6 deletions
+39
-6
src/crud-base.ts
src/crud-base.ts
+3
-3
src/decorators/restful.ts
src/decorators/restful.ts
+36
-3
No files found.
src/crud-base.ts
View file @
ede0080c
...
...
@@ -182,7 +182,7 @@ export class CrudBase<T extends ValidCrudEntity<T>> {
throw
new
BlankReturnMessageDto
(
500
,
'
Internal error
'
).
toException
();
}
});
return
new
this
.
entityReturnMessageDto
(
20
1
,
'
success
'
,
savedEnt
);
return
new
this
.
entityReturnMessageDto
(
20
0
,
'
success
'
,
savedEnt
);
}
get
entityAliasName
()
{
...
...
@@ -346,7 +346,7 @@ export class CrudBase<T extends ValidCrudEntity<T>> {
`
${
this
.
entityName
}
ID
${
id
}
not found.`
,
).
toException
();
}
return
new
BlankReturnMessageDto
(
20
4
,
'
success
'
);
return
new
BlankReturnMessageDto
(
20
0
,
'
success
'
);
}
async
importEntities
(
...
...
@@ -381,7 +381,7 @@ export class CrudBase<T extends ValidCrudEntity<T>> {
...
data
.
results
.
map
((
e
)
=>
({
entry
:
e
,
result
:
'
OK
'
})),
];
return
new
this
.
importReturnMessageDto
(
20
1
,
20
0
,
'
success
'
,
results
.
map
((
r
)
=>
{
const
entry
=
new
this
.
importEntryDto
();
...
...
src/decorators/restful.ts
View file @
ede0080c
...
...
@@ -19,9 +19,10 @@ import {
import
{
MergeMethodDecorators
}
from
'
./merge
'
;
import
{
ClassType
}
from
'
../utility/insert-field
'
;
import
{
ApiBadRequestResponse
,
ApiBody
,
Api
Created
Response
,
ApiNo
Content
Response
,
Api
InternalServerError
Response
,
ApiNo
tFound
Response
,
ApiOkResponse
,
ApiOperation
,
ApiParam
,
...
...
@@ -97,6 +98,10 @@ export class RestfulFactory<T> {
}),
ApiBody
({
type
:
this
.
createDto
}),
ApiOkResponse
({
type
:
this
.
entityReturnMessageDto
}),
ApiBadRequestResponse
({
type
:
BlankReturnMessageDto
,
description
:
`The
${
this
.
entityClass
.
name
}
is not valid`
,
}),
]);
}
...
...
@@ -113,6 +118,10 @@ export class RestfulFactory<T> {
}),
ApiParam
({
name
:
'
id
'
,
type
:
this
.
idType
,
required
:
true
}),
ApiOkResponse
({
type
:
this
.
entityReturnMessageDto
}),
ApiNotFoundResponse
({
type
:
BlankReturnMessageDto
,
description
:
`The
${
this
.
entityClass
.
name
}
with the given id was not found`
,
}),
]);
}
...
...
@@ -147,6 +156,18 @@ export class RestfulFactory<T> {
ApiParam
({
name
:
'
id
'
,
type
:
this
.
idType
,
required
:
true
}),
ApiBody
({
type
:
this
.
updateDto
}),
ApiOkResponse
({
type
:
BlankReturnMessageDto
}),
ApiNotFoundResponse
({
type
:
BlankReturnMessageDto
,
description
:
`The
${
this
.
entityClass
.
name
}
with the given id was not found`
,
}),
ApiBadRequestResponse
({
type
:
BlankReturnMessageDto
,
description
:
`The
${
this
.
entityClass
.
name
}
is not valid`
,
}),
ApiInternalServerErrorResponse
({
type
:
BlankReturnMessageDto
,
description
:
'
Internal error
'
,
}),
]);
}
...
...
@@ -164,6 +185,14 @@ export class RestfulFactory<T> {
}),
ApiParam
({
name
:
'
id
'
,
type
:
this
.
idType
,
required
:
true
}),
ApiOkResponse
({
type
:
BlankReturnMessageDto
}),
ApiNotFoundResponse
({
type
:
BlankReturnMessageDto
,
description
:
`The
${
this
.
entityClass
.
name
}
with the given id was not found`
,
}),
ApiInternalServerErrorResponse
({
type
:
BlankReturnMessageDto
,
description
:
'
Internal error
'
,
}),
]);
}
...
...
@@ -175,7 +204,11 @@ export class RestfulFactory<T> {
...
extras
,
}),
ApiBody
({
type
:
ImportDataDto
(
this
.
createDto
)
}),
ApiCreatedResponse
({
type
:
this
.
importReturnMessageDto
}),
ApiOkResponse
({
type
:
this
.
importReturnMessageDto
}),
ApiInternalServerErrorResponse
({
type
:
BlankReturnMessageDto
,
description
:
'
Internal error
'
,
}),
]);
}
}
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