Merge branch 'develop' into ccb

This commit is contained in:
makabe 2024-01-31 10:28:39 +09:00
commit 92193d499a
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,13 @@
-- +migrate Up
ALTER TABLE `license_orders` ADD INDEX `idx_po_number` (po_number);
ALTER TABLE `license_orders` ADD INDEX `idx_from_account_id` (from_account_id);
ALTER TABLE `license_orders` ADD INDEX `idx_status` (status);
ALTER TABLE `card_licenses` ADD INDEX `idx_card_license_key` (card_license_key);
ALTER TABLE `licenses` ADD INDEX `idx_status` (status);
-- +migrate Down
ALTER TABLE `license_orders` DROP INDEX `idx_po_number`;
ALTER TABLE `license_orders` DROP INDEX `idx_from_account_id`;
ALTER TABLE `license_orders` DROP INDEX `idx_status`;
ALTER TABLE `card_licenses` DROP INDEX `idx_card_license_key`;
ALTER TABLE `licenses` DROP INDEX `idx_status`;

View File

@ -81,6 +81,7 @@ export class LicensesRepositoryService {
}, },
], ],
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`, comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
}); });
// 重複があった場合はエラーを返却する // 重複があった場合はエラーを返却する
if (isPoNumberDuplicated) { if (isPoNumberDuplicated) {
@ -193,6 +194,7 @@ export class LicensesRepositoryService {
card_license_key: In(generateKeys), card_license_key: In(generateKeys),
}, },
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`, comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
}); });
if (existingCardLicenses.length > 0) { if (existingCardLicenses.length > 0) {
// 重複分を配列から削除 // 重複分を配列から削除
@ -292,6 +294,7 @@ export class LicensesRepositoryService {
card_license_key: licenseKey, card_license_key: licenseKey,
}, },
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`, comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
}); });
// カードライセンスが存在しなければエラー // カードライセンスが存在しなければエラー
if (!targetCardLicense) { if (!targetCardLicense) {
@ -602,6 +605,7 @@ export class LicensesRepositoryService {
allocated_user_id: userId, allocated_user_id: userId,
}, },
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`, comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
}); });
// 既にライセンスが割り当てられているなら、割り当てを解除 // 既にライセンスが割り当てられているなら、割り当てを解除
@ -717,6 +721,7 @@ export class LicensesRepositoryService {
status: LICENSE_ALLOCATED_STATUS.ALLOCATED, status: LICENSE_ALLOCATED_STATUS.ALLOCATED,
}, },
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`, comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
}); });
// ライセンスが割り当てられていない場合はエラー // ライセンスが割り当てられていない場合はエラー
@ -776,6 +781,7 @@ export class LicensesRepositoryService {
status: LICENSE_ISSUE_STATUS.ISSUE_REQUESTING, status: LICENSE_ISSUE_STATUS.ISSUE_REQUESTING,
}, },
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`, comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
lock: { mode: 'pessimistic_write' },
}); });
// キャンセル対象の注文が存在しない場合エラー // キャンセル対象の注文が存在しない場合エラー