Merged PR 528: 第五階層ライセンス画面の修正

## 概要
[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のスクショなど
- スクショ置き場

## 動作確認状況
- ローカルで確認

## 補足
- 相談、参考資料などがあれば
This commit is contained in:
水本 祐希 2023-10-26 08:52:52 +00:00
parent 9c9404367b
commit f4347ff5c0

View File

@ -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,
},
],
});
// 有効期限が現在日付からしきい値以内のライセンス数を取得する