From f4347ff5c02a72e54ef30b375d70261dbbef9cbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B0=B4=E6=9C=AC=20=E7=A5=90=E5=B8=8C?= Date: Thu, 26 Oct 2023 08:52:52 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20528:=20=E7=AC=AC=E4=BA=94?= =?UTF-8?q?=E9=9A=8E=E5=B1=A4=E3=83=A9=E3=82=A4=E3=82=BB=E3=83=B3=E3=82=B9?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task2937: 第五階層ライセンス画面の修正](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2937) - 元PBI or タスクへのリンク(内容・目的などはそちらにあるはず) - 何をどう変更したか、追加したライブラリなど allocatedLicense(Number of licenses acclocated) reusableLicense(number of licenses available for reuse) freeLicense(Number of unused licenses) の3つに、「有効な総ライセンス数のうち」という条件を追加する - このPull Requestでの対象/対象外 - 影響範囲(他の機能にも影響があるか) ## レビューポイント - 特にレビューしてほしい箇所 - 軽微なものや自明なものは記載不要 - 修正範囲が大きい場合などに記載 - 全体的にや仕様を満たしているか等は本当に必要な時のみ記載 ## UIの変更 - Before/Afterのスクショなど - スクショ置き場 ## 動作確認状況 - ローカルで確認 ## 補足 - 相談、参考資料などがあれば --- .../accounts/accounts.repository.service.ts | 51 ++++++++++++++----- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/dictation_server/src/repositories/accounts/accounts.repository.service.ts b/dictation_server/src/repositories/accounts/accounts.repository.service.ts index 8c582f0..65fe99d 100644 --- a/dictation_server/src/repositories/accounts/accounts.repository.service.ts +++ b/dictation_server/src/repositories/accounts/accounts.repository.service.ts @@ -327,27 +327,52 @@ export class AccountsRepositoryService { // 有効な総ライセンス数のうち、ユーザーに割り当て済みのライセンス数を取得する const allocatedLicense = await license.count({ - where: { - account_id: id, - allocated_user_id: Not(IsNull()), - status: LICENSE_ALLOCATED_STATUS.ALLOCATED, - }, + where: [ + { + account_id: id, + allocated_user_id: Not(IsNull()), + expiry_date: MoreThanOrEqual(currentDate), + status: LICENSE_ALLOCATED_STATUS.ALLOCATED, + }, + { + account_id: id, + allocated_user_id: Not(IsNull()), + expiry_date: IsNull(), + status: LICENSE_ALLOCATED_STATUS.ALLOCATED, + }, + ], }); // 総ライセンス数のうち、ユーザーに割り当てたことがあるが、現在は割り当て解除され誰にも割り当たっていないライセンス数を取得する const reusableLicense = await license.count({ - where: { - account_id: id, - status: LICENSE_ALLOCATED_STATUS.REUSABLE, - }, + where: [ + { + account_id: id, + expiry_date: MoreThanOrEqual(currentDate), + status: LICENSE_ALLOCATED_STATUS.REUSABLE, + }, + { + account_id: id, + expiry_date: IsNull(), + status: LICENSE_ALLOCATED_STATUS.REUSABLE, + }, + ], }); // 総ライセンス数のうち、一度もユーザーに割り当てたことのないライセンス数を取得する const freeLicense = await license.count({ - where: { - account_id: id, - status: LICENSE_ALLOCATED_STATUS.UNALLOCATED, - }, + where: [ + { + account_id: id, + expiry_date: MoreThanOrEqual(currentDate), + status: LICENSE_ALLOCATED_STATUS.UNALLOCATED, + }, + { + account_id: id, + expiry_date: IsNull(), + status: LICENSE_ALLOCATED_STATUS.UNALLOCATED, + }, + ], }); // 有効期限が現在日付からしきい値以内のライセンス数を取得する