fileserver/dto/src/responses/base.ts

21 lines
348 B
TypeScript
Raw Normal View History

2022-08-25 11:39:58 +00:00
export class BaseResponse {
2022-08-25 12:16:29 +00:00
constructor(statusCode: number) {
this.statusCode = statusCode;
}
2022-08-25 11:39:58 +00:00
statusCode: number;
}
export class SuccessResponse extends BaseResponse {
2022-08-25 12:16:29 +00:00
constructor() {
super(200);
}
declare statusCode: 200;
2022-08-25 11:39:58 +00:00
}
export class ErrorResponse extends BaseResponse {
2022-08-25 12:16:29 +00:00
declare statusCode: 400 | 401 | 403;
2022-08-25 11:39:58 +00:00
message?: string;
}