Migrate add profileChangeName.rank #1594
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m0s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m0s
This commit is contained in:
parent
1e9b282942
commit
1e69cf6bb7
6 changed files with 43 additions and 0 deletions
|
|
@ -112,6 +112,7 @@ export class ProfileChangeNameController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.rank = body.rank ?? profile.rank;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileRepository.save(profile, { data: req });
|
||||
setLogDataDiff(req, { before, after: profile });
|
||||
|
|
@ -184,6 +185,7 @@ export class ProfileChangeNameController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.rank = body.rank ?? profile.rank;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileRepository.save(profile, { data: req });
|
||||
setLogDataDiff(req, { before: before_profile, after: profile });
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ export class ProfileChangeNameEmployeeController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.rank = body.rank ?? profile.rank;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileEmployeeRepo.save(profile, { data: req });
|
||||
setLogDataDiff(req, { before, after: profile });
|
||||
|
|
@ -191,6 +192,7 @@ export class ProfileChangeNameEmployeeController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.rank = body.rank ?? profile.rank;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileEmployeeRepo.save(profile);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.rank = body.rank ?? profile.rank;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileEmployeeRepo.save(profile, { data: req });
|
||||
setLogDataDiff(req, { before, after: profile });
|
||||
|
|
@ -179,6 +180,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.rank = body.rank ?? profile.rank;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileEmployeeRepo.save(profile);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,14 @@ export class ProfileChangeName extends EntityBase {
|
|||
})
|
||||
prefix: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ยศ",
|
||||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
rank: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 100,
|
||||
|
|
@ -103,6 +111,7 @@ export class CreateProfileChangeName {
|
|||
profileId: string | null;
|
||||
prefixId: string | null;
|
||||
prefix: string | null;
|
||||
rank: string | null;
|
||||
firstName: string | null;
|
||||
lastName: string | null;
|
||||
status: string | null;
|
||||
|
|
@ -113,6 +122,7 @@ export class CreateProfileChangeNameEmployee {
|
|||
profileEmployeeId: string | null;
|
||||
prefixId: string | null;
|
||||
prefix: string | null;
|
||||
rank: string | null;
|
||||
firstName: string | null;
|
||||
lastName: string | null;
|
||||
status: string | null;
|
||||
|
|
@ -122,6 +132,7 @@ export class CreateProfileChangeNameEmployee {
|
|||
export type UpdateProfileChangeName = {
|
||||
prefixId?: string | null;
|
||||
prefix?: string | null;
|
||||
rank?: string | null;
|
||||
firstName?: string | null;
|
||||
lastName?: string | null;
|
||||
status?: string | null;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,14 @@ export class ProfileChangeNameHistory extends EntityBase {
|
|||
})
|
||||
prefix: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ยศ",
|
||||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
rank: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 100,
|
||||
|
|
@ -79,6 +87,7 @@ export class CreateProfileChangeNameHistory {
|
|||
profileChangeNameId: string | null;
|
||||
prefixId: string | null;
|
||||
prefix: string | null;
|
||||
rank: string | null;
|
||||
firstName: string | null;
|
||||
lastName: string | null;
|
||||
status: string | null;
|
||||
|
|
@ -89,6 +98,7 @@ export type UpdateProfileChangeNameHistory = {
|
|||
profileChangeNameId?: string | null;
|
||||
prefixId?: string | null;
|
||||
prefix?: string | null;
|
||||
rank?: string | null;
|
||||
firstName?: string | null;
|
||||
lastName?: string | null;
|
||||
status?: string | null;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateProfileChangeNameAddFieldRank1781174051201 implements MigrationInterface {
|
||||
name = 'UpdateProfileChangeNameAddFieldRank1781174051201'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileChangeNameHistory\` ADD \`rank\` varchar(40) NULL COMMENT 'ยศ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileChangeName\` ADD \`rank\` varchar(40) NULL COMMENT 'ยศ'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileChangeName\` DROP COLUMN \`rank\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileChangeNameHistory\` DROP COLUMN \`rank\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue