Merged PR 716: 行ロック横展開5
## 概要 [Task3473: 行ロック横展開5](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3473) 以下のリポジトリのメソッドについてlockを追加しました。 - worktypes - createWorktype - ワークタイプ取得にロックを追加して途中で追加できないようにする - updateWorktype - ワークタイプ取得にロックを追加して途中で同一ワークタイプIDが作られないようにする - deleteWorktype - ワークフロー取得にロックを追加して途中でワークタイプが紐づけられないようにする - updateOptionItems - ワークタイプ取得にロックを追加して同一ワークタイプに対してオプションアイテムを作らないようにする こちらの資料を参考にして対応しています。 [行ロックに関する影響調査](https://ndstokyo.sharepoint.com/❌/r/sites/Piranha/Shared%20Documents/General/OMDS/%E8%A1%8C%E3%83%AD%E3%83%83%E3%82%AF%E3%81%AB%E9%96%A2%E3%81%99%E3%82%8B%E5%BD%B1%E9%9F%BF%E8%AA%BF%E6%9F%BB.xlsx?d=wdd6f3d97f7b04a538095c459f8eee2eb&csf=1&web=1&e=Y5l3aA) 対応内容についてはこちらにまとめています。 [行ロック5の対応整理](https://ndstokyo.sharepoint.com/:f:/r/sites/Piranha/Shared%20Documents/General/OMDS/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88/Task3473?csf=1&web=1&e=wqCx0Z) ## レビューポイント - 対応箇所は適切でしょうか? ## UIの変更 - なし ## 動作確認状況 - ローカルで確認
This commit is contained in:
parent
4548b5e510
commit
d5178e7435
@ -88,6 +88,7 @@ export class WorktypesRepositoryService {
|
|||||||
const duplicatedWorktype = await worktypeRepo.findOne({
|
const duplicatedWorktype = await worktypeRepo.findOne({
|
||||||
where: { account_id: accountId, custom_worktype_id: worktypeId },
|
where: { account_id: accountId, custom_worktype_id: worktypeId },
|
||||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||||
|
lock: { mode: 'pessimistic_write' },
|
||||||
});
|
});
|
||||||
|
|
||||||
// ワークタイプIDが重複している場合はエラー
|
// ワークタイプIDが重複している場合はエラー
|
||||||
@ -100,6 +101,7 @@ export class WorktypesRepositoryService {
|
|||||||
const worktypeCount = await worktypeRepo.count({
|
const worktypeCount = await worktypeRepo.count({
|
||||||
where: { account_id: accountId },
|
where: { account_id: accountId },
|
||||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||||
|
lock: { mode: 'pessimistic_write' },
|
||||||
});
|
});
|
||||||
|
|
||||||
// ワークタイプの登録数が上限に達している場合はエラー
|
// ワークタイプの登録数が上限に達している場合はエラー
|
||||||
@ -163,6 +165,7 @@ export class WorktypesRepositoryService {
|
|||||||
const worktype = await worktypeRepo.findOne({
|
const worktype = await worktypeRepo.findOne({
|
||||||
where: { account_id: accountId, id: id },
|
where: { account_id: accountId, id: id },
|
||||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||||
|
lock: { mode: 'pessimistic_write' },
|
||||||
});
|
});
|
||||||
|
|
||||||
// ワークタイプが存在しない場合はエラー
|
// ワークタイプが存在しない場合はエラー
|
||||||
@ -177,6 +180,7 @@ export class WorktypesRepositoryService {
|
|||||||
id: Not(id),
|
id: Not(id),
|
||||||
},
|
},
|
||||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||||
|
lock: { mode: 'pessimistic_write' },
|
||||||
});
|
});
|
||||||
|
|
||||||
// ワークタイプIDが重複している場合はエラー
|
// ワークタイプIDが重複している場合はエラー
|
||||||
@ -227,6 +231,7 @@ export class WorktypesRepositoryService {
|
|||||||
const account = await accountRepo.findOne({
|
const account = await accountRepo.findOne({
|
||||||
where: { id: accountId },
|
where: { id: accountId },
|
||||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||||
|
lock: { mode: 'pessimistic_write' },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (account?.active_worktype_id === id) {
|
if (account?.active_worktype_id === id) {
|
||||||
@ -244,6 +249,7 @@ export class WorktypesRepositoryService {
|
|||||||
const workflows = await workflowRepo.find({
|
const workflows = await workflowRepo.find({
|
||||||
where: { account_id: accountId, worktype_id: id },
|
where: { account_id: accountId, worktype_id: id },
|
||||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||||
|
lock: { mode: 'pessimistic_write' },
|
||||||
});
|
});
|
||||||
if (workflows.length > 0) {
|
if (workflows.length > 0) {
|
||||||
const workflowIds = workflows.map((workflow) => workflow.id);
|
const workflowIds = workflows.map((workflow) => workflow.id);
|
||||||
@ -322,6 +328,7 @@ export class WorktypesRepositoryService {
|
|||||||
const worktype = await worktypeRepo.findOne({
|
const worktype = await worktypeRepo.findOne({
|
||||||
where: { account_id: accountId, id: worktypeId },
|
where: { account_id: accountId, id: worktypeId },
|
||||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||||
|
lock: { mode: 'pessimistic_write' },
|
||||||
});
|
});
|
||||||
// ワークタイプが存在しない場合はエラー
|
// ワークタイプが存在しない場合はエラー
|
||||||
if (!worktype) {
|
if (!worktype) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user