diff --git a/azure-pipelines-staging.yml b/azure-pipelines-staging.yml index b8e341e..faef499 100644 --- a/azure-pipelines-staging.yml +++ b/azure-pipelines-staging.yml @@ -122,7 +122,7 @@ jobs: displayName: Bash Script inputs: targetType: inline - script: cd dictation_client && cp -f .env.$(environment) .env && npm run build + script: cd dictation_client && npm run build:stg - task: ArchiveFiles@2 inputs: rootFolderOrFile: dictation_client/build @@ -167,7 +167,7 @@ jobs: displayName: Bash Script inputs: targetType: inline - script: cd dictation_client && cp -f .env.$(environment) .env && npm run build + script: cd dictation_client && npm run build:prod - task: ArchiveFiles@2 inputs: rootFolderOrFile: dictation_client/build diff --git a/dictation_client/package.json b/dictation_client/package.json index b2283f6..a445672 100644 --- a/dictation_client/package.json +++ b/dictation_client/package.json @@ -7,9 +7,10 @@ }, "scripts": { "start": "vite", - "build": "tsc && vite build", - "build:prod": "tsc && vite build", - "build:local": "tsc && vite build && sh localdeploy.sh", + "build": "tsc && vite build --mode development", + "build:stg": "tsc && vite build --mode staging", + "build:prod": "tsc && vite build --mode production", + "build:local": "tsc && vite build --mode development && sh localdeploy.sh", "preview": "vite preview", "typecheck": "tsc --noEmit", "codegen": "sh codegen.sh", @@ -98,4 +99,4 @@ } ] } -} +} \ No newline at end of file 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, + }, + ], }); // 有効期限が現在日付からしきい値以内のライセンス数を取得する