Commit ede0080c authored by nanahira's avatar nanahira

better docs

parent d9deb6bd
Pipeline #22249 passed with stages
in 1 minute and 33 seconds
......@@ -182,7 +182,7 @@ export class CrudBase<T extends ValidCrudEntity<T>> {
throw new BlankReturnMessageDto(500, 'Internal error').toException();
}
});
return new this.entityReturnMessageDto(201, 'success', savedEnt);
return new this.entityReturnMessageDto(200, '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(204, 'success');
return new BlankReturnMessageDto(200, '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(
201,
200,
'success',
results.map((r) => {
const entry = new this.importEntryDto();
......
......@@ -19,9 +19,10 @@ import {
import { MergeMethodDecorators } from './merge';
import { ClassType } from '../utility/insert-field';
import {
ApiBadRequestResponse,
ApiBody,
ApiCreatedResponse,
ApiNoContentResponse,
ApiInternalServerErrorResponse,
ApiNotFoundResponse,
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',
}),
]);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment