Merged PR 731: 既存API修正(アカウント情報取得API、アカウント作成API)

## 概要
[Task3555: 既存API修正(アカウント情報取得API、アカウント作成API)](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3555)

Accountにauto_file_delete、file_retention_daysを追加
既存のテストでアカウントを作成している部分に項目の値を追加。

## レビューポイント
-entityの

```
@Column({ default: 30 })
```
が必要かどうか。

## UIの変更
なし

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

## 補足
- 相談、参考資料などがあれば
This commit is contained in:
maruyama.t 2024-02-05 02:27:43 +00:00
parent 186896da15
commit df74dc358c
9 changed files with 41 additions and 3 deletions

View File

@ -3819,6 +3819,8 @@
"country": { "type": "string" },
"parentAccountId": { "type": "number" },
"delegationPermission": { "type": "boolean" },
"autoFileDelete": { "type": "boolean" },
"fileRetentionDays": { "type": "number" },
"primaryAdminUserId": { "type": "number" },
"secondryAdminUserId": { "type": "number" },
"parentAccountName": { "type": "string" }
@ -3828,7 +3830,9 @@
"companyName",
"tier",
"country",
"delegationPermission"
"delegationPermission",
"autoFileDelete",
"fileRetentionDays"
]
},
"GetMyAccountResponse": {

View File

@ -2,7 +2,11 @@ import { v4 as uuidv4 } from 'uuid';
import { DataSource } from 'typeorm';
import { User, UserArchive } from '../../repositories/users/entity/user.entity';
import { Account } from '../../repositories/accounts/entity/account.entity';
import { ADMIN_ROLES, USER_ROLES } from '../../constants';
import {
ADMIN_ROLES,
FILE_RETENTION_DAYS_DEFAULT,
USER_ROLES,
} from '../../constants';
import { License } from '../../repositories/licenses/entity/license.entity';
type InitialTestDBState = {
@ -162,6 +166,9 @@ export const makeTestAccount = async (
parent_account_id: d?.parent_account_id ?? undefined,
country: d?.country ?? 'US',
delegation_permission: d?.delegation_permission ?? false,
auto_file_delete: d?.auto_file_delete ?? false,
file_retention_days:
d?.file_retention_days ?? FILE_RETENTION_DAYS_DEFAULT,
locked: d?.locked ?? false,
company_name: d?.company_name ?? 'test inc.',
verified: d?.verified ?? true,
@ -252,6 +259,8 @@ export const makeTestSimpleAccount = async (
parent_account_id: d?.parent_account_id ?? undefined,
country: d?.country ?? 'US',
delegation_permission: d?.delegation_permission ?? false,
auto_file_delete: d?.auto_file_delete ?? false,
file_retention_days: d?.file_retention_days ?? FILE_RETENTION_DAYS_DEFAULT,
locked: d?.locked ?? false,
company_name: d?.company_name ?? 'test inc.',
verified: d?.verified ?? true,

View File

@ -321,3 +321,9 @@ export const USER_LICENSE_STATUS = {
ALLOCATED: 'allocated',
EXPIRED: 'expired',
} as const;
/**
*
* @const {number}
*/
export const FILE_RETENTION_DAYS_DEFAULT = 30;

View File

@ -166,6 +166,8 @@ describe('createAccount', () => {
expect(account?.country).toBe(country);
expect(account?.parent_account_id).toBe(dealerAccountId);
expect(account?.tier).toBe(TIERS.TIER5);
expect(account?.auto_file_delete).toBe(false);
expect(account?.file_retention_days).toBe(30);
expect(account?.primary_admin_user_id).toBe(user?.id);
expect(account?.secondary_admin_user_id).toBe(null);
expect(user?.accepted_eula_version).toBe(acceptedEulaVersion);

View File

@ -452,6 +452,8 @@ export class AccountsService {
country: accountInfo.country,
parentAccountId: accountInfo.parent_account_id ?? undefined,
delegationPermission: accountInfo.delegation_permission,
autoFileDelete: accountInfo.auto_file_delete,
fileRetentionDays: accountInfo.file_retention_days,
primaryAdminUserId: accountInfo.primary_admin_user_id ?? undefined,
secondryAdminUserId: accountInfo.secondary_admin_user_id ?? undefined,
parentAccountName: parentInfo ? parentInfo.company_name : undefined,

View File

@ -422,6 +422,12 @@ export class Account {
@ApiProperty()
delegationPermission: boolean;
@ApiProperty()
autoFileDelete: boolean;
@ApiProperty()
fileRetentionDays: number;
@ApiProperty({ required: false })
primaryAdminUserId?: number;

View File

@ -8,6 +8,7 @@ import { Task } from '../../../repositories/tasks/entity/task.entity';
import { TemplateFilesRepositoryService } from '../../../repositories/template_files/template_files.repository.service';
import { NotificationhubService } from '../../../gateways/notificationhub/notificationhub.service';
import { UserGroupsRepositoryService } from '../../../repositories/user_groups/user_groups.repository.service';
import { FILE_RETENTION_DAYS_DEFAULT } from '../../../constants';
export type BlobstorageServiceMockValue = {
createContainer: void | Error;
@ -160,6 +161,8 @@ export const makeDefaultUsersRepositoryMockValue =
tier: 5,
country: '',
delegation_permission: true,
auto_file_delete: false,
file_retention_days: FILE_RETENTION_DAYS_DEFAULT,
locked: false,
company_name: '',
verified: true,

View File

@ -169,7 +169,6 @@ export class AccountsRepositoryService {
this.isCommentOut,
context,
);
// 作成されたAccountのIDを使用してユーザーを作成
const user = new User();
{

View File

@ -1,4 +1,5 @@
import { bigintTransformer } from '../../../common/entity';
import { FILE_RETENTION_DAYS_DEFAULT } from '../../../constants';
import { User } from '../../../repositories/users/entity/user.entity';
import {
Entity,
@ -44,6 +45,12 @@ export class Account {
@Column({ nullable: true, type: 'bigint', transformer: bigintTransformer })
active_worktype_id: number | null;
@Column({ default: false })
auto_file_delete: boolean;
@Column({ default: FILE_RETENTION_DAYS_DEFAULT })
file_retention_days: number;
@Column({ nullable: true, type: 'datetime' })
deleted_at: Date | null;