From 7eecb001c69f8f2a5c836ae9816990bb8f434508 Mon Sep 17 00:00:00 2001 From: "SAITO-PC-3\\saito.k" Date: Sun, 21 Apr 2024 22:41:44 +0900 Subject: [PATCH] =?UTF-8?q?4/22=E3=81=AE=E6=9C=AC=E7=95=AA=E7=92=B0?= =?UTF-8?q?=E5=A2=83=E3=83=87=E3=83=97=E3=83=AD=E3=82=A4=E3=81=AE=E3=81=9F?= =?UTF-8?q?=E3=82=81=E3=81=AB=E7=A2=BA=E8=AA=8D=E6=9C=AA=E5=AE=9F=E6=96=BD?= =?UTF-8?q?=E3=81=AE=E4=BF=AE=E6=AD=A3=E3=82=92=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=A2=E3=82=A6=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accounts/accounts.service.spec.ts | 54 +++++++++--------- .../src/features/accounts/accounts.service.ts | 57 ++++++++++--------- 2 files changed, 57 insertions(+), 54 deletions(-) diff --git a/dictation_server/src/features/accounts/accounts.service.spec.ts b/dictation_server/src/features/accounts/accounts.service.spec.ts index e042a85..c76e4fe 100644 --- a/dictation_server/src/features/accounts/accounts.service.spec.ts +++ b/dictation_server/src/features/accounts/accounts.service.spec.ts @@ -2645,34 +2645,34 @@ describe('getDealers', () => { ], }); }); + // TODO 本番環境デプロイのためにこのテストはスキップする + // it('非表示指定されたDealer以外のDealerを取得できる', async () => { + // if (!source) fail(); + // const module = await makeTestingModule(source); + // if (!module) fail(); + // // 100件のDealerを作成し、country,id,company_nameを取得する + // const dealers: { country: string; id: number; name: string }[] = []; + // for (let i = 0; i < 100; i++) { + // const { id, company_name, country } = ( + // await makeTestAccount(source, { + // parent_account_id: i, + // tier: TIERS.TIER4, + // country: 'JP', + // company_name: `DEALER_${i}`, + // }) + // ).account; + // dealers.push({ id, name: company_name, country }); + // } + // const service = module.get(AccountsService); + // const context = makeContext(`uuidv4`, 'requestId'); + // const result = await service.getDealers(context); + // // idが50と99のDealerを非表示にする - it('非表示指定されたDealer以外のDealerを取得できる', async () => { - if (!source) fail(); - const module = await makeTestingModule(source); - if (!module) fail(); - // 100件のDealerを作成し、country,id,company_nameを取得する - const dealers: { country: string; id: number; name: string }[] = []; - for (let i = 0; i < 100; i++) { - const { id, company_name, country } = ( - await makeTestAccount(source, { - parent_account_id: i, - tier: TIERS.TIER4, - country: 'JP', - company_name: `DEALER_${i}`, - }) - ).account; - dealers.push({ id, name: company_name, country }); - } - const service = module.get(AccountsService); - const context = makeContext(`uuidv4`, 'requestId'); - const result = await service.getDealers(context); - // idが50と99のDealerを非表示にする - - expect(result.dealers.length).toBe(98); - expect(result).toEqual({ - dealers: dealers.filter((dealer) => dealer.id !== 50 && dealer.id !== 99), - }); - }); + // expect(result.dealers.length).toBe(98); + // expect(result).toEqual({ + // dealers: dealers.filter((dealer) => dealer.id !== 50 && dealer.id !== 99), + // }); + // }); it('0件でもDealerを取得できる', async () => { if (!source) fail(); diff --git a/dictation_server/src/features/accounts/accounts.service.ts b/dictation_server/src/features/accounts/accounts.service.ts index 688981b..aaefaf6 100644 --- a/dictation_server/src/features/accounts/accounts.service.ts +++ b/dictation_server/src/features/accounts/accounts.service.ts @@ -76,8 +76,9 @@ import { ConfigService } from '@nestjs/config'; @Injectable() export class AccountsService { - // プロダクト バックログ項目 4077: [保守]本番環境動作確認用のDealerアカウントを表示しないようにする の対応 - private readonly dealerAccountIdHiddenList: number[] = []; + // TODO 本番環境デプロイのためにこの変数はコメントアウトする 2024年4月22日 + //プロダクト バックログ項目 4077: [保守]本番環境動作確認用のDealerアカウントを表示しないようにする の対応 + // private readonly dealerAccountIdHiddenList: number[] = []; private readonly logger = new Logger(AccountsService.name); constructor( private readonly accountRepository: AccountsRepositoryService, @@ -93,20 +94,21 @@ export class AccountsService { const dealerAccountIdList = this.configService.get( 'DEALER_ACCOUNT_ID_HIDDEN_LIST', ); + // TODO 本番環境デプロイのためにこの変数はコメントアウトする 2024年4月22日 // ディーラーアカウントIDリストを数値配列に変換する // 変換できない場合はエラーをスローする // 存在しない場合や空文字列の場合は空の配列を返す - if (dealerAccountIdList) { - this.dealerAccountIdHiddenList = dealerAccountIdList - .split(',') - .map((x) => { - const id = parseInt(x, 10); - if (isNaN(id)) { - throw new Error('DEALER_ACCOUNT_ID_HIDDEN_LIST is invalid'); - } - return id; - }); - } + // if (dealerAccountIdList) { + // this.dealerAccountIdHiddenList = dealerAccountIdList + // .split(',') + // .map((x) => { + // const id = parseInt(x, 10); + // if (isNaN(id)) { + // throw new Error('DEALER_ACCOUNT_ID_HIDDEN_LIST is invalid'); + // } + // return id; + // }); + // } } /** @@ -1197,26 +1199,27 @@ export class AccountsService { const dealerAccounts = await this.accountRepository.findDealerAccounts( context, ); + // TODO 本番環境デプロイのためにこの変数はコメントアウトする 2024年4月22日 // プロダクト バックログ項目 4077: [保守]本番環境動作確認用のDealerアカウントを表示しないようにする の対応 // this.dealerAccountIdHiddenListに含まれるアカウント(動作確認用のアカウント)を除外する。 // 除外したアカウントをlogに出力する - const filteredDealerAccounts = dealerAccounts.filter((dealerAccount) => { - const isHidden = this.dealerAccountIdHiddenList.includes( - dealerAccount.id, - ); - if (isHidden) { - this.logger.log( - `[${context.getTrackingId()}] hidden dealer account: ${ - dealerAccount.id - }`, - ); - } - return !isHidden; - }); + // const filteredDealerAccounts = dealerAccounts.filter((dealerAccount) => { + // const isHidden = this.dealerAccountIdHiddenList.includes( + // dealerAccount.id, + // ); + // if (isHidden) { + // this.logger.log( + // `[${context.getTrackingId()}] hidden dealer account: ${ + // dealerAccount.id + // }`, + // ); + // } + // return !isHidden; + // }); // レスポンス用の型に変換 const dealers: GetDealersResponse = { - dealers: filteredDealerAccounts.map((dealerAccount): Dealer => { + dealers: dealerAccounts.map((dealerAccount): Dealer => { return { id: dealerAccount.id, name: dealerAccount.company_name,