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,
|
port: REDIS_PORT,
|
||||||
});
|
});
|
||||||
|
|
||||||
redisClient.del("role_" + posMaster.current_holderId, (err: Error, response: Response) => {
|
redisClient.del("role_" + posMaster.current_holderId, (err: Error) => {
|
||||||
if (err) throw err;
|
if (err) console.error("Redis delete role error:", err);
|
||||||
});
|
});
|
||||||
|
|
||||||
redisClient.del("menu_" + posMaster.current_holderId, (err: Error, response: Response) => {
|
redisClient.del("menu_" + posMaster.current_holderId, (err: Error) => {
|
||||||
if (err) throw err;
|
if (err) console.error("Redis delete menu error:", err);
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
if (redisClient) {
|
if (redisClient) {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import {
|
||||||
Path,
|
Path,
|
||||||
Request,
|
Request,
|
||||||
Response,
|
Response,
|
||||||
Get
|
Get,
|
||||||
} from "tsoa";
|
} from "tsoa";
|
||||||
import { LessThan, MoreThan } from "typeorm";
|
import { LessThan, MoreThan } from "typeorm";
|
||||||
import { AppDataSource } from "../database/data-source";
|
import { AppDataSource } from "../database/data-source";
|
||||||
|
|
@ -37,9 +37,7 @@ export class CommandOperatorController extends Controller {
|
||||||
* @param commandId คีย์คำสั่ง
|
* @param commandId คีย์คำสั่ง
|
||||||
*/
|
*/
|
||||||
@Get("{commandId}")
|
@Get("{commandId}")
|
||||||
async getCommandOperatorByCommandId(
|
async getCommandOperatorByCommandId(@Path() commandId: string) {
|
||||||
@Path() commandId: string
|
|
||||||
) {
|
|
||||||
const command = await this.commandRepo.findOne({
|
const command = await this.commandRepo.findOne({
|
||||||
where: { id: commandId },
|
where: { id: commandId },
|
||||||
select: { id: true },
|
select: { id: true },
|
||||||
|
|
@ -61,10 +59,7 @@ export class CommandOperatorController extends Controller {
|
||||||
* @param operatorId คีย์เจ้าหน้าที่ดำเนินการ
|
* @param operatorId คีย์เจ้าหน้าที่ดำเนินการ
|
||||||
*/
|
*/
|
||||||
@Get("swap/{direction}/{operatorId}")
|
@Get("swap/{direction}/{operatorId}")
|
||||||
async swapCommandOperator(
|
async swapCommandOperator(@Path() direction: string, @Path() operatorId: string) {
|
||||||
@Path() direction: string,
|
|
||||||
@Path() operatorId: string,
|
|
||||||
) {
|
|
||||||
const source = await this.commandOperatorRepo.findOne({
|
const source = await this.commandOperatorRepo.findOne({
|
||||||
where: { id: operatorId },
|
where: { id: operatorId },
|
||||||
});
|
});
|
||||||
|
|
@ -106,10 +101,7 @@ export class CommandOperatorController extends Controller {
|
||||||
source.orderNo = dest.orderNo;
|
source.orderNo = dest.orderNo;
|
||||||
dest.orderNo = temp;
|
dest.orderNo = temp;
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([this.commandOperatorRepo.save(source), this.commandOperatorRepo.save(dest)]);
|
||||||
this.commandOperatorRepo.save(source),
|
|
||||||
this.commandOperatorRepo.save(dest),
|
|
||||||
]);
|
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
@ -141,9 +133,7 @@ export class CommandOperatorController extends Controller {
|
||||||
const nextOrderNo = (lastOrderNo?.orderNo ?? 1) + 1;
|
const nextOrderNo = (lastOrderNo?.orderNo ?? 1) + 1;
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const operator = Object.assign(
|
const operator = Object.assign(new CommandOperator(), {
|
||||||
new CommandOperator(),
|
|
||||||
{
|
|
||||||
...body,
|
...body,
|
||||||
commandId: command.id,
|
commandId: command.id,
|
||||||
orderNo: nextOrderNo,
|
orderNo: nextOrderNo,
|
||||||
|
|
@ -153,8 +143,7 @@ export class CommandOperatorController extends Controller {
|
||||||
lastUpdateUserId: request.user.sub,
|
lastUpdateUserId: request.user.sub,
|
||||||
lastUpdateFullName: request.user.name,
|
lastUpdateFullName: request.user.name,
|
||||||
lastUpdatedAt: now,
|
lastUpdatedAt: now,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
await this.commandOperatorRepo.save(operator);
|
await this.commandOperatorRepo.save(operator);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
@ -166,10 +155,7 @@ export class CommandOperatorController extends Controller {
|
||||||
* @param operatorId คีย์เจ้าหน้าที่ดำเนินการ
|
* @param operatorId คีย์เจ้าหน้าที่ดำเนินการ
|
||||||
*/
|
*/
|
||||||
@Delete("{commandId}/{operatorId}")
|
@Delete("{commandId}/{operatorId}")
|
||||||
public async deleteCommandOperator(
|
public async deleteCommandOperator(@Path() commandId: string, @Path() operatorId: string) {
|
||||||
@Path() commandId: string,
|
|
||||||
@Path() operatorId: string,
|
|
||||||
) {
|
|
||||||
const queryRunner = AppDataSource.createQueryRunner();
|
const queryRunner = AppDataSource.createQueryRunner();
|
||||||
await queryRunner.connect();
|
await queryRunner.connect();
|
||||||
await queryRunner.startTransaction();
|
await queryRunner.startTransaction();
|
||||||
|
|
@ -215,10 +201,9 @@ export class CommandOperatorController extends Controller {
|
||||||
return new HttpSuccess(true);
|
return new HttpSuccess(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await queryRunner.rollbackTransaction();
|
await queryRunner.rollbackTransaction();
|
||||||
throw error;
|
console.error("Delete command operator error:", error);
|
||||||
} finally {
|
} finally {
|
||||||
await queryRunner.release();
|
await queryRunner.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,7 @@ export class OrganizationController extends Controller {
|
||||||
await sendToQueueOrgDraft(msg);
|
await sendToQueueOrgDraft(msg);
|
||||||
return new HttpSuccess("Draft is being created... Processing in the background.");
|
return new HttpSuccess("Draft is being created... Processing in the background.");
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
console.error("Error creating draft organization:", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2529,6 +2530,7 @@ export class OrganizationController extends Controller {
|
||||||
await sendToQueueOrg(msg);
|
await sendToQueueOrg(msg);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
console.error("Error publishing draft organization:", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,7 @@ export async function CreatePosMasterHistoryOfficer(
|
||||||
return true;
|
return true;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (manager) {
|
if (manager) {
|
||||||
|
console.error("CreatePosMasterHistoryOfficer error (external transaction):", err);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
console.error("CreatePosMasterHistoryOfficer transaction error:", err);
|
console.error("CreatePosMasterHistoryOfficer transaction error:", err);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue