Merge branch 'develop' into ccb

This commit is contained in:
makabe 2024-02-05 09:26:55 +09:00
commit 5ab2f02c56

View File

@ -88,6 +88,7 @@ export class WorktypesRepositoryService {
const duplicatedWorktype = await worktypeRepo.findOne({
where: { account_id: accountId, custom_worktype_id: worktypeId },
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
});
// ワークタイプIDが重複している場合はエラー
@ -100,6 +101,7 @@ export class WorktypesRepositoryService {
const worktypeCount = await worktypeRepo.count({
where: { account_id: accountId },
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
});
// ワークタイプの登録数が上限に達している場合はエラー
@ -163,6 +165,7 @@ export class WorktypesRepositoryService {
const worktype = await worktypeRepo.findOne({
where: { account_id: accountId, id: id },
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
});
// ワークタイプが存在しない場合はエラー
@ -177,6 +180,7 @@ export class WorktypesRepositoryService {
id: Not(id),
},
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
});
// ワークタイプIDが重複している場合はエラー
@ -227,6 +231,7 @@ export class WorktypesRepositoryService {
const account = await accountRepo.findOne({
where: { id: accountId },
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
});
if (account?.active_worktype_id === id) {
@ -244,6 +249,7 @@ export class WorktypesRepositoryService {
const workflows = await workflowRepo.find({
where: { account_id: accountId, worktype_id: id },
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
});
if (workflows.length > 0) {
const workflowIds = workflows.map((workflow) => workflow.id);
@ -322,6 +328,7 @@ export class WorktypesRepositoryService {
const worktype = await worktypeRepo.findOne({
where: { account_id: accountId, id: worktypeId },
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
});
// ワークタイプが存在しない場合はエラー
if (!worktype) {