first commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
PaginateWapServerResults,
|
||||
SysAdminGetWapServerParams,
|
||||
} from "../../../Models/WapServer/WapServer.Interface";
|
||||
import { ApiValidationError } from "../../../Models/Server.Error.model";
|
||||
import { Body, Controller, Middlewares, Post, Response, Route, SuccessResponse } from "tsoa";
|
||||
import { SA_WapServerService } from "./SysAdminWapServer.Service";
|
||||
import { sysAdminAuthMiddleware } from "../../../middleware/sysadminAuth";
|
||||
|
||||
@Route("sysadmin/wapserver/get")
|
||||
export class SysAdminWapServerGetController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Done")
|
||||
@Post()
|
||||
@Middlewares(sysAdminAuthMiddleware)
|
||||
public async sysAdminGetWapServers(
|
||||
@Body() requestBody: SysAdminGetWapServerParams,
|
||||
): Promise<PaginateWapServerResults | ApiValidationError> {
|
||||
try {
|
||||
const result = await new SA_WapServerService().sysAdminGetWapServers(requestBody);
|
||||
this.setStatus(200);
|
||||
return result;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error;
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user