Merged PR 783: [1回目実行]実施後の修正実施
## 概要 [Task3790: [1回目実行]実施後の修正実施](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3790) - 移行データ動作確認(1回目)で発生した不具合の対応を実施しました ・バリデータでエラーとなる(コメントアウトして実行したところ、成功) ・アカウント管理者のユーザーのメール認証がfalseで登録されるので、 パスワード変更では認証をできない⇒強制敵にtrueで登録する ・(指摘外、検証ツール実装時に内部検出)カードライセンス登録時、カードライセンス発行・ライセンステーブルも登録する - このPull Requestでの対象/対象外 上記以外の指摘(下記)はタスク3772にて対応するため本プルリク対象外 変換ツール ・ディーラーアカウントに登録されたアカウントがいないCSVで 変換するとディーラーがundefined(パラメータがない)状態でJSON出力されてしまう。 ・重複したメールアドレスの取り込みが未実装 ・有効期限が9999/~は移行対象外とする ・ワークタイプの出力がされない 登録ツール ・ファイルパスの取り扱いが変換ツールと異なる - 影響範囲(他の機能にも影響があるか) ## レビューポイント - カードライセンス登録時のライセンスのアカウントIDについて、第一階層アカウントのため「AUTO_INCREMENT_START: 853211」を設定しているが問題ないか? →移行データ上第一階層アカウントは最初に登場するため問題ない認識 ## UIの変更 - 無し ## 動作確認状況 - ローカルで確認済 ## 補足 - 相談、参考資料などがあれば
This commit is contained in:
parent
b524fd5995
commit
68d1a1796b
@ -134,7 +134,7 @@ export function isAccountsInputFile(obj: any): obj is AccountsInputFile {
|
||||
"country" in obj &&
|
||||
typeof obj.country === "string" &&
|
||||
("dealerAccountId" in obj
|
||||
? typeof obj.dealerAccountId === "number"
|
||||
? obj.dealerAccountId === null || typeof obj.dealerAccountId === "number"
|
||||
: true) &&
|
||||
"adminName" in obj &&
|
||||
typeof obj.adminName === "string" &&
|
||||
|
||||
@ -1,20 +1,18 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import {
|
||||
DataSource,
|
||||
} from 'typeorm';
|
||||
import { User } from '../users/entity/user.entity';
|
||||
import { Account } from './entity/account.entity';
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { DataSource } from "typeorm";
|
||||
import { User } from "../users/entity/user.entity";
|
||||
import { Account } from "./entity/account.entity";
|
||||
import {
|
||||
getDirection,
|
||||
getTaskListSortableAttribute,
|
||||
} from '../../common/types/sort/util';
|
||||
} from "../../common/types/sort/util";
|
||||
import { SortCriteria } from "../sort_criteria/entity/sort_criteria.entity";
|
||||
import {
|
||||
insertEntity,
|
||||
updateEntity,
|
||||
deleteEntity,
|
||||
} from '../../common/repository';
|
||||
import { Context } from '../../common/log';
|
||||
} from "../../common/repository";
|
||||
import { Context } from "../../common/log";
|
||||
|
||||
@Injectable()
|
||||
export class AccountsRepositoryService {
|
||||
@ -81,6 +79,7 @@ export class AccountsRepositoryService {
|
||||
user.accepted_privacy_notice_version =
|
||||
adminUserAcceptedPrivacyNoticeVersion ?? null;
|
||||
user.accepted_dpa_version = adminUserAcceptedDpaVersion ?? null;
|
||||
user.email_verified = true;
|
||||
}
|
||||
const usersRepo = entityManager.getRepository(User);
|
||||
const newUser = usersRepo.create(user);
|
||||
|
||||
@ -129,6 +129,33 @@ export class CardLicense {
|
||||
@Column({ nullable: true, type: "datetime" })
|
||||
updated_by: string | null;
|
||||
|
||||
@UpdateDateColumn({
|
||||
default: () => "datetime('now', 'localtime')",
|
||||
type: "datetime",
|
||||
})
|
||||
updated_at: Date;
|
||||
}
|
||||
|
||||
@Entity({ name: "card_license_issue" })
|
||||
export class CardLicenseIssue {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
issued_at: Date;
|
||||
|
||||
@Column({ nullable: true, type: "datetime" })
|
||||
created_by: string | null;
|
||||
|
||||
@CreateDateColumn({
|
||||
default: () => "datetime('now', 'localtime')",
|
||||
type: "datetime",
|
||||
})
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true, type: "datetime" })
|
||||
updated_by: string | null;
|
||||
|
||||
@UpdateDateColumn({
|
||||
default: () => "datetime('now', 'localtime')",
|
||||
type: "datetime",
|
||||
|
||||
@ -2,6 +2,7 @@ import { Module } from "@nestjs/common";
|
||||
import { TypeOrmModule } from "@nestjs/typeorm";
|
||||
import {
|
||||
CardLicense,
|
||||
CardLicenseIssue,
|
||||
License,
|
||||
LicenseAllocationHistory,
|
||||
} from "./entity/license.entity";
|
||||
@ -9,7 +10,11 @@ import { LicensesRepositoryService } from "./licenses.repository.service";
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([License, CardLicense, LicenseAllocationHistory]),
|
||||
TypeOrmModule.forFeature([
|
||||
License,
|
||||
CardLicense,
|
||||
CardLicenseIssue, LicenseAllocationHistory,
|
||||
]),
|
||||
],
|
||||
providers: [LicensesRepositoryService],
|
||||
exports: [LicensesRepositoryService],
|
||||
|
||||
@ -4,14 +4,19 @@ import {
|
||||
License,
|
||||
LicenseAllocationHistory,
|
||||
CardLicense,
|
||||
CardLicenseIssue,
|
||||
} from "./entity/license.entity";
|
||||
import { insertEntities } from "../../common/repository";
|
||||
import { insertEntity, insertEntities } from "../../common/repository";
|
||||
import { Context } from "../../common/log";
|
||||
import {
|
||||
LicensesInputFile,
|
||||
CardLicensesInputFile,
|
||||
} from "../../common/types/types";
|
||||
|
||||
import {AUTO_INCREMENT_START} from "../../constants/index"
|
||||
import {
|
||||
LICENSE_ALLOCATED_STATUS,
|
||||
LICENSE_TYPE,
|
||||
} from "../../constants";
|
||||
@Injectable()
|
||||
export class LicensesRepositoryService {
|
||||
//クエリログにコメントを出力するかどうか
|
||||
@ -38,7 +43,9 @@ export class LicensesRepositoryService {
|
||||
license.account_id = licensesInputFile.account_id;
|
||||
license.status = licensesInputFile.status;
|
||||
license.type = licensesInputFile.type;
|
||||
license.expiry_date = (licensesInputFile.expiry_date) ? new Date(licensesInputFile.expiry_date) : null;
|
||||
license.expiry_date = licensesInputFile.expiry_date
|
||||
? new Date(licensesInputFile.expiry_date)
|
||||
: null;
|
||||
if (licensesInputFile.allocated_user_id) {
|
||||
license.allocated_user_id = licensesInputFile.allocated_user_id;
|
||||
}
|
||||
@ -97,22 +104,61 @@ export class LicensesRepositoryService {
|
||||
): Promise<{}> {
|
||||
return await this.dataSource.transaction(async (entityManager) => {
|
||||
const cardLicenseRepo = entityManager.getRepository(CardLicense);
|
||||
const licensesRepo = entityManager.getRepository(License);
|
||||
const cardLicenseIssueRepo =
|
||||
entityManager.getRepository(CardLicenseIssue);
|
||||
|
||||
const licenses: License[] = [];
|
||||
// ライセンステーブルを作成する(BULK INSERT)
|
||||
for (let i = 0; i < cardLicensesInputFiles.length; i++) {
|
||||
const license = new License();
|
||||
license.account_id = AUTO_INCREMENT_START; // 最初に登場するアカウント(第一アカウント)
|
||||
license.status = LICENSE_ALLOCATED_STATUS.UNALLOCATED;
|
||||
license.type = LICENSE_TYPE.CARD;
|
||||
licenses.push(license);
|
||||
}
|
||||
const savedLicenses = await insertEntities(
|
||||
License,
|
||||
licensesRepo,
|
||||
licenses,
|
||||
this.isCommentOut,
|
||||
context
|
||||
);
|
||||
|
||||
let newCardLicenses: CardLicense[] = [];
|
||||
cardLicensesInputFiles.forEach((cardLicensesInputFile) => {
|
||||
// カードライセンス発行テーブルを作成する
|
||||
const cardLicenseIssue = new CardLicenseIssue();
|
||||
cardLicenseIssue.issued_at = new Date();
|
||||
const newCardLicenseIssue = cardLicenseIssueRepo.create(cardLicenseIssue);
|
||||
const savedCardLicensesIssue = await insertEntity(
|
||||
CardLicenseIssue,
|
||||
cardLicenseIssueRepo,
|
||||
newCardLicenseIssue,
|
||||
this.isCommentOut,
|
||||
context
|
||||
);
|
||||
|
||||
const newCardLicenses: CardLicense[] = [];
|
||||
// カードライセンステーブルを作成する(BULK INSERT)
|
||||
for (let i = 0; i < cardLicensesInputFiles.length; i++) {
|
||||
const cardLicense = new CardLicense();
|
||||
cardLicense.license_id = cardLicensesInputFile.license_id;
|
||||
cardLicense.issue_id = cardLicensesInputFile.issue_id;
|
||||
cardLicense.card_license_key = cardLicensesInputFile.card_license_key;
|
||||
cardLicense.activated_at = (cardLicensesInputFile.activated_at) ? new Date(cardLicensesInputFile.activated_at) : null;
|
||||
cardLicense.created_at = (cardLicensesInputFile.created_at) ? new Date(cardLicensesInputFile.created_at) : null;
|
||||
cardLicense.created_by = cardLicensesInputFile.created_by;
|
||||
cardLicense.updated_at = (cardLicensesInputFile.updated_at) ? new Date(cardLicensesInputFile.updated_at) : null;
|
||||
cardLicense.updated_by = cardLicensesInputFile.updated_by;
|
||||
cardLicense.license_id = savedLicenses[i].id; // Licenseテーブルの自動採番されたIDを挿入
|
||||
cardLicense.issue_id = savedCardLicensesIssue.id; // CardLicenseIssueテーブルの自動採番されたIDを挿入
|
||||
cardLicense.card_license_key =
|
||||
cardLicensesInputFiles[i].card_license_key;
|
||||
cardLicense.activated_at = cardLicensesInputFiles[i].activated_at
|
||||
? new Date(cardLicensesInputFiles[i].activated_at)
|
||||
: null;
|
||||
cardLicense.created_at = cardLicensesInputFiles[i].created_at
|
||||
? new Date(cardLicensesInputFiles[i].created_at)
|
||||
: null;
|
||||
cardLicense.created_by = cardLicensesInputFiles[i].created_by;
|
||||
cardLicense.updated_at = cardLicensesInputFiles[i].updated_at
|
||||
? new Date(cardLicensesInputFiles[i].updated_at)
|
||||
: null;
|
||||
cardLicense.updated_by = cardLicensesInputFiles[i].updated_by;
|
||||
|
||||
newCardLicenses.push(cardLicense);
|
||||
});
|
||||
}
|
||||
|
||||
const query = cardLicenseRepo
|
||||
.createQueryBuilder()
|
||||
@ -126,5 +172,4 @@ export class LicensesRepositoryService {
|
||||
return {};
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user