fixed service crash
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m2s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m2s
This commit is contained in:
parent
bca04f2881
commit
e374f2e339
4 changed files with 25 additions and 37 deletions
|
|
@ -130,12 +130,12 @@ export class AuthRoleController extends Controller {
|
|||
port: REDIS_PORT,
|
||||
});
|
||||
|
||||
redisClient.del("role_" + posMaster.current_holderId, (err: Error, response: Response) => {
|
||||
if (err) throw err;
|
||||
redisClient.del("role_" + posMaster.current_holderId, (err: Error) => {
|
||||
if (err) console.error("Redis delete role error:", err);
|
||||
});
|
||||
|
||||
redisClient.del("menu_" + posMaster.current_holderId, (err: Error, response: Response) => {
|
||||
if (err) throw err;
|
||||
redisClient.del("menu_" + posMaster.current_holderId, (err: Error) => {
|
||||
if (err) console.error("Redis delete menu error:", err);
|
||||
});
|
||||
} finally {
|
||||
if (redisClient) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
Path,
|
||||
Request,
|
||||
Response,
|
||||
Get
|
||||
Get,
|
||||
} from "tsoa";
|
||||
import { LessThan, MoreThan } from "typeorm";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
|
|
@ -37,9 +37,7 @@ export class CommandOperatorController extends Controller {
|
|||
* @param commandId คีย์คำสั่ง
|
||||
*/
|
||||
@Get("{commandId}")
|
||||
async getCommandOperatorByCommandId(
|
||||
@Path() commandId: string
|
||||
) {
|
||||
async getCommandOperatorByCommandId(@Path() commandId: string) {
|
||||
const command = await this.commandRepo.findOne({
|
||||
where: { id: commandId },
|
||||
select: { id: true },
|
||||
|
|
@ -61,10 +59,7 @@ export class CommandOperatorController extends Controller {
|
|||
* @param operatorId คีย์เจ้าหน้าที่ดำเนินการ
|
||||
*/
|
||||
@Get("swap/{direction}/{operatorId}")
|
||||
async swapCommandOperator(
|
||||
@Path() direction: string,
|
||||
@Path() operatorId: string,
|
||||
) {
|
||||
async swapCommandOperator(@Path() direction: string, @Path() operatorId: string) {
|
||||
const source = await this.commandOperatorRepo.findOne({
|
||||
where: { id: operatorId },
|
||||
});
|
||||
|
|
@ -106,10 +101,7 @@ export class CommandOperatorController extends Controller {
|
|||
source.orderNo = dest.orderNo;
|
||||
dest.orderNo = temp;
|
||||
|
||||
await Promise.all([
|
||||
this.commandOperatorRepo.save(source),
|
||||
this.commandOperatorRepo.save(dest),
|
||||
]);
|
||||
await Promise.all([this.commandOperatorRepo.save(source), this.commandOperatorRepo.save(dest)]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -141,35 +133,29 @@ export class CommandOperatorController extends Controller {
|
|||
const nextOrderNo = (lastOrderNo?.orderNo ?? 1) + 1;
|
||||
|
||||
const now = new Date();
|
||||
const operator = Object.assign(
|
||||
new CommandOperator(),
|
||||
{
|
||||
...body,
|
||||
commandId: command.id,
|
||||
orderNo: nextOrderNo,
|
||||
createdUserId: request.user.sub,
|
||||
createdFullName: request.user.name,
|
||||
createdAt: now,
|
||||
lastUpdateUserId: request.user.sub,
|
||||
lastUpdateFullName: request.user.name,
|
||||
lastUpdatedAt: now,
|
||||
}
|
||||
);
|
||||
const operator = Object.assign(new CommandOperator(), {
|
||||
...body,
|
||||
commandId: command.id,
|
||||
orderNo: nextOrderNo,
|
||||
createdUserId: request.user.sub,
|
||||
createdFullName: request.user.name,
|
||||
createdAt: now,
|
||||
lastUpdateUserId: request.user.sub,
|
||||
lastUpdateFullName: request.user.name,
|
||||
lastUpdatedAt: now,
|
||||
});
|
||||
await this.commandOperatorRepo.save(operator);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* API ลบเจ้าหน้าที่ดำเนินการที่คำสั่ง
|
||||
* @summary API ลบเจ้าหน้าที่ดำเนินการที่คำสั่ง
|
||||
* @param commandId คีย์คำสั่ง
|
||||
* @param operatorId คีย์เจ้าหน้าที่ดำเนินการ
|
||||
*/
|
||||
@Delete("{commandId}/{operatorId}")
|
||||
public async deleteCommandOperator(
|
||||
@Path() commandId: string,
|
||||
@Path() operatorId: string,
|
||||
) {
|
||||
public async deleteCommandOperator(@Path() commandId: string, @Path() operatorId: string) {
|
||||
const queryRunner = AppDataSource.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
await queryRunner.startTransaction();
|
||||
|
|
@ -215,10 +201,9 @@ export class CommandOperatorController extends Controller {
|
|||
return new HttpSuccess(true);
|
||||
} catch (error) {
|
||||
await queryRunner.rollbackTransaction();
|
||||
throw error;
|
||||
console.error("Delete command operator error:", error);
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ export class OrganizationController extends Controller {
|
|||
await sendToQueueOrgDraft(msg);
|
||||
return new HttpSuccess("Draft is being created... Processing in the background.");
|
||||
} catch (error: any) {
|
||||
console.error("Error creating draft organization:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
@ -2529,6 +2530,7 @@ export class OrganizationController extends Controller {
|
|||
await sendToQueueOrg(msg);
|
||||
return new HttpSuccess();
|
||||
} catch (error: any) {
|
||||
console.error("Error publishing draft organization:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ export async function CreatePosMasterHistoryOfficer(
|
|||
return true;
|
||||
} catch (err) {
|
||||
if (manager) {
|
||||
console.error("CreatePosMasterHistoryOfficer error (external transaction):", err);
|
||||
throw err;
|
||||
}
|
||||
console.error("CreatePosMasterHistoryOfficer transaction error:", err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue