checkpoint

This commit is contained in:
AdisakKanthawilang 2024-01-25 14:35:19 +07:00
parent 42bd8cd77b
commit 5fbb2c5eea
4 changed files with 261 additions and 39 deletions

View file

@ -22,7 +22,7 @@ import HttpStatusCode from "../interfaces/http-status";
@Route("organization")
@Tags("OrgRoot")
// @Security("bearerAuth")
@Security("bearerAuth")
export class OrgRootController extends Controller {
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
@ -77,6 +77,10 @@ export class OrgRootController extends Controller {
orgRoot.orgRootPhoneIn = requestBody.orgRootPhoneIn;
orgRoot.orgRootFax = requestBody.orgRootFax;
orgRoot.orgRootIsNormal = requestBody.orgRootIsNormal;
orgRoot.createdUserId = request.user.sub
orgRoot.createdFullName = request.user.name
orgRoot.lastUpdateUserId = request.user.sub;
orgRoot.lastUpdateFullName = request.user.name;
await this.orgRootRepository.save(orgRoot);
return new HttpSuccess();
@ -109,6 +113,7 @@ export class OrgRootController extends Controller {
@Path() id: string,
@Body()
requestBody: CreateOrgRoot,
@Request() request: { user: Record<string, any> },
) {
try {
const orgRoot = await this.orgRootRepository.findOne({ where: { id } });
@ -136,6 +141,8 @@ export class OrgRootController extends Controller {
orgRoot.orgRootPhoneIn = requestBody.orgRootPhoneIn;
orgRoot.orgRootFax = requestBody.orgRootFax;
orgRoot.orgRootIsNormal = requestBody.orgRootIsNormal;
orgRoot.lastUpdateUserId = request.user.sub;
orgRoot.lastUpdateFullName = request.user.name;
await this.orgRootRepository.save(orgRoot);
return new HttpSuccess();