เพิ่มตำแหน่งเจ้าหน้าที่
This commit is contained in:
parent
3b0d8c24a7
commit
6f11eecb8f
15 changed files with 771 additions and 33 deletions
|
|
@ -21,6 +21,10 @@ import HttpError from "../interfaces/http-error";
|
|||
import { Command } from "../entities/Command";
|
||||
import { Brackets } from "typeorm";
|
||||
import { CommandType } from "../entities/CommandType";
|
||||
import { CommandSend } from "../entities/CommandSend";
|
||||
import { Profile } from "../entities/Profile";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { OrgRevision } from "../entities/OrgRevision";
|
||||
|
||||
@Route("api/v1/org/command")
|
||||
@Tags("Command")
|
||||
|
|
@ -33,6 +37,9 @@ import { CommandType } from "../entities/CommandType";
|
|||
export class CommandController extends Controller {
|
||||
private commandRepository = AppDataSource.getRepository(Command);
|
||||
private commandTypeRepository = AppDataSource.getRepository(CommandType);
|
||||
private commandSendRepository = AppDataSource.getRepository(CommandSend);
|
||||
private profileRepository = AppDataSource.getRepository(Profile);
|
||||
private orgRevisionRepo = AppDataSource.getRepository(OrgRevision);
|
||||
|
||||
/**
|
||||
* API list รายการคำสั่ง
|
||||
|
|
@ -74,9 +81,14 @@ export class CommandController extends Controller {
|
|||
: `${status.trim().toLocaleUpperCase()}`,
|
||||
},
|
||||
)
|
||||
.andWhere(year != null && year != undefined && year != 0 ? "command.commandYear = :commandYear" : "1=1", {
|
||||
commandYear: year == null || year == undefined || year == 0 ? null : `${year}`,
|
||||
})
|
||||
.andWhere(
|
||||
year != null && year != undefined && year != 0
|
||||
? "command.commandYear = :commandYear"
|
||||
: "1=1",
|
||||
{
|
||||
commandYear: year == null || year == undefined || year == 0 ? null : `${year}`,
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
commandTypeId != null && commandTypeId != undefined && commandTypeId != ""
|
||||
? "command.commandTypeId = :commandTypeId"
|
||||
|
|
@ -120,7 +132,7 @@ export class CommandController extends Controller {
|
|||
commandNo: string | null;
|
||||
commandYear: number | null;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const command = Object.assign(new Command(), requestBody);
|
||||
|
||||
|
|
@ -132,6 +144,7 @@ export class CommandController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||
}
|
||||
command.status = "DRAFT";
|
||||
command.issue = commandType.name;
|
||||
command.createdUserId = request.user.sub;
|
||||
command.createdFullName = request.user.name;
|
||||
command.createdAt = new Date();
|
||||
|
|
@ -153,21 +166,25 @@ export class CommandController extends Controller {
|
|||
async GetByIdTab1(@Path() id: string) {
|
||||
const command = await this.commandRepository.findOne({
|
||||
where: { id },
|
||||
select: [
|
||||
"id",
|
||||
"status",
|
||||
"commandNo",
|
||||
"commandYear",
|
||||
"issue",
|
||||
"detailHeader",
|
||||
"detailBody",
|
||||
"detailFooter",
|
||||
],
|
||||
relations: ["commandType", "commandType.commandTypeSys"],
|
||||
});
|
||||
if (!command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||
}
|
||||
return new HttpSuccess(command);
|
||||
|
||||
const _command = {
|
||||
id: command.id,
|
||||
status: command.status,
|
||||
commandNo: command.commandNo,
|
||||
commandYear: command.commandYear,
|
||||
issue: command.issue,
|
||||
detailHeader: command.detailHeader,
|
||||
detailBody: command.detailBody,
|
||||
detailFooter: command.detailFooter,
|
||||
commandTypeName: command.commandType?.name || null,
|
||||
commandSysId: command.commandType?.commandSysId || null,
|
||||
};
|
||||
return new HttpSuccess(_command);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -189,7 +206,7 @@ export class CommandController extends Controller {
|
|||
detailBody: string | null;
|
||||
detailFooter: string | null;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const command = await this.commandRepository.findOne({ where: { id: id } });
|
||||
if (!command) {
|
||||
|
|
@ -204,6 +221,166 @@ export class CommandController extends Controller {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดรายการคำสั่ง tab3
|
||||
*
|
||||
* @summary API รายละเอียดรายการคำสั่ง tab3
|
||||
*
|
||||
* @param {string} id Id คำสั่ง
|
||||
*/
|
||||
@Get("tab3/{id}")
|
||||
async GetByIdTab3(@Path() id: string) {
|
||||
const command = await this.commandRepository.findOne({
|
||||
where: { id },
|
||||
relations: ["commandSends"],
|
||||
});
|
||||
if (!command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||
}
|
||||
|
||||
const _command = command.commandSends.map((item) => ({
|
||||
id: item.id,
|
||||
citizenId: item.citizenId,
|
||||
prefix: item.prefix,
|
||||
fristName: item.fristName,
|
||||
lastName: item.lastName,
|
||||
position: item.position,
|
||||
org: item.org,
|
||||
sendCC: item.sendCC,
|
||||
profileId: item.profileId,
|
||||
}));
|
||||
return new HttpSuccess(_command);
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขรายการ body คำสั่ง Tab3
|
||||
*
|
||||
* @summary API แก้ไขรายการ body คำสั่ง Tab3
|
||||
*
|
||||
* @param {string} id Id คำสั่ง
|
||||
*/
|
||||
@Put("tab3-add/{id}")
|
||||
async PutTab3Add(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: {
|
||||
profileId: string[];
|
||||
},
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const command = await this.commandRepository.findOne({ where: { id: id } });
|
||||
if (!command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||
}
|
||||
let _null: any = null;
|
||||
|
||||
await Promise.all(
|
||||
requestBody.profileId.map(async (item) => {
|
||||
const commandSendCheck = await this.commandSendRepository.findOne({
|
||||
where: { profileId: item, commandId: command.id },
|
||||
});
|
||||
if (commandSendCheck) return;
|
||||
|
||||
let profile = await this.profileRepository.findOne({
|
||||
where: { id: item },
|
||||
relations: ["current_holders", "current_holders.orgRoot"],
|
||||
});
|
||||
if (!profile) return;
|
||||
|
||||
const findRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
||||
const commandSend = new CommandSend();
|
||||
commandSend.citizenId = profile.citizenId;
|
||||
commandSend.prefix =
|
||||
profile.rank != null && profile.rank != "" ? profile.rank : profile.prefix;
|
||||
commandSend.fristName = profile.firstName;
|
||||
commandSend.lastName = profile.lastName;
|
||||
commandSend.position = profile.position;
|
||||
commandSend.org =
|
||||
profile.current_holders?.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot
|
||||
?.orgRootName || _null;
|
||||
commandSend.profileId = profile.id;
|
||||
commandSend.commandId = command.id;
|
||||
commandSend.createdUserId = request.user.sub;
|
||||
commandSend.createdFullName = request.user.name;
|
||||
commandSend.createdAt = new Date();
|
||||
commandSend.lastUpdateUserId = request.user.sub;
|
||||
commandSend.lastUpdateFullName = request.user.name;
|
||||
commandSend.lastUpdatedAt = new Date();
|
||||
await this.commandSendRepository.save(commandSend);
|
||||
}),
|
||||
);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขรายการ body คำสั่ง Tab3
|
||||
*
|
||||
* @summary API แก้ไขรายการ body คำสั่ง Tab3
|
||||
*
|
||||
* @param {string} id Id คำสั่ง
|
||||
*/
|
||||
@Put("tab3/{id}")
|
||||
async PutTab3Update(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: {
|
||||
commandSend: {
|
||||
id: string;
|
||||
sendCC: string;
|
||||
}[];
|
||||
},
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const command = await this.commandRepository.findOne({ where: { id: id } });
|
||||
if (!command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||
}
|
||||
|
||||
await Promise.all(
|
||||
requestBody.commandSend.map(async (item) => {
|
||||
const commandSend = await this.commandSendRepository.findOne({
|
||||
where: { id: item.id },
|
||||
});
|
||||
if (!commandSend) return;
|
||||
|
||||
commandSend.sendCC = item.sendCC;
|
||||
commandSend.lastUpdateUserId = request.user.sub;
|
||||
commandSend.lastUpdateFullName = request.user.name;
|
||||
commandSend.lastUpdatedAt = new Date();
|
||||
await this.commandSendRepository.save(commandSend);
|
||||
}),
|
||||
);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขรายการ body คำสั่ง Tab3
|
||||
*
|
||||
* @summary API แก้ไขรายการ body คำสั่ง Tab3
|
||||
*
|
||||
* @param {string} id Id คำสั่ง
|
||||
*/
|
||||
@Delete("tab3/{commandSendId}")
|
||||
async DeleteTab3Update(
|
||||
@Path() commandSendId: string,
|
||||
@Body()
|
||||
requestBody: { reason?: string | null },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const command = await this.commandSendRepository.findOne({ where: { id: commandSendId } });
|
||||
if (!command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ได้รับสำเนาคำสั่ง");
|
||||
}
|
||||
|
||||
await this.commandSendRepository.delete(commandSendId);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API คัดลอก
|
||||
*
|
||||
|
|
@ -215,8 +392,8 @@ export class CommandController extends Controller {
|
|||
async PutCopy(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: { commandNo?: string | null; commandYear?: string | null },
|
||||
@Request() request: { user: Record<string, any> },
|
||||
requestBody: { commandNo?: string | null; commandYear?: number | null },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const command = await this.commandRepository.findOne({ where: { id: id } });
|
||||
if (!command) {
|
||||
|
|
@ -246,7 +423,7 @@ export class CommandController extends Controller {
|
|||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: { reason?: string | null },
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const command = await this.commandRepository.findOne({ where: { id: id } });
|
||||
if (!command) {
|
||||
|
|
@ -260,6 +437,32 @@ export class CommandController extends Controller {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API ทำคำสั่งใหม่
|
||||
*
|
||||
* @summary API ทำคำสั่งใหม่
|
||||
*
|
||||
* @param {string} id Id คำสั่ง
|
||||
*/
|
||||
@Put("resume/{id}")
|
||||
async PutDraft(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: { reason?: string | null },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const command = await this.commandRepository.findOne({ where: { id: id } });
|
||||
if (!command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||
}
|
||||
command.status = "DRAFT";
|
||||
command.lastUpdateUserId = request.user.sub;
|
||||
command.lastUpdateFullName = request.user.name;
|
||||
command.lastUpdatedAt = new Date();
|
||||
await this.commandRepository.save(command);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API ลบรายการคำสั่ง
|
||||
*
|
||||
|
|
|
|||
144
src/controllers/CommandSysController.ts
Normal file
144
src/controllers/CommandSysController.ts
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
import {
|
||||
Controller,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { CommandSys, CreateCommandSys, UpdateCommandSys } from "../entities/CommandSys";
|
||||
|
||||
@Route("api/v1/org/commandSys")
|
||||
@Tags("CommandSys")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class CommandSysController extends Controller {
|
||||
private commandSysRepository = AppDataSource.getRepository(CommandSys);
|
||||
|
||||
/**
|
||||
* API list รายการระบบคำสั่ง
|
||||
*
|
||||
* @summary ORG_058 - CRUD ระบบคำสั่ง (ADMIN) #62
|
||||
*
|
||||
*/
|
||||
@Get("list")
|
||||
async GetResult() {
|
||||
const _commandSys = await this.commandSysRepository.find({
|
||||
select: ["id", "sysName", "sysDescription", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { id: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(_commandSys);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดรายการระบบคำสั่ง
|
||||
*
|
||||
* @summary ORG_058 - CRUD ระบบคำสั่ง (ADMIN) #62
|
||||
*
|
||||
* @param {string} id Id ระบบคำสั่ง
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetById(@Path() id: string) {
|
||||
const _commandSys = await this.commandSysRepository.findOne({
|
||||
where: { id },
|
||||
select: ["id", "sysName", "sysDescription"],
|
||||
});
|
||||
if (!_commandSys) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระบบคำสั่งนี้");
|
||||
}
|
||||
|
||||
return new HttpSuccess(_commandSys);
|
||||
}
|
||||
|
||||
/**
|
||||
* API สร้างรายการ body ระบบคำสั่ง
|
||||
*
|
||||
* @summary ORG_058 - CRUD ระบบคำสั่ง (ADMIN) #62
|
||||
*
|
||||
*/
|
||||
@Post()
|
||||
async Post(
|
||||
@Body()
|
||||
requestBody: CreateCommandSys,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const _commandSys = Object.assign(new CommandSys(), requestBody);
|
||||
const checkName = await this.commandSysRepository.findOne({
|
||||
where: { id: requestBody.id,sysName: requestBody.sysName,sysDescription: requestBody.sysDescription },
|
||||
});
|
||||
|
||||
if (checkName) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
_commandSys.createdUserId = request.user.sub;
|
||||
_commandSys.createdFullName = request.user.name;
|
||||
_commandSys.lastUpdateUserId = request.user.sub;
|
||||
_commandSys.lastUpdateFullName = request.user.name;
|
||||
_commandSys.createdAt = new Date();
|
||||
_commandSys.lastUpdatedAt = new Date();
|
||||
await this.commandSysRepository.save(_commandSys);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขรายการ body ระบบคำสั่ง
|
||||
*
|
||||
* @summary ORG_058 - CRUD ระบบคำสั่ง (ADMIN) #62
|
||||
*
|
||||
* @param {string} id Id ระบบคำสั่ง
|
||||
*/
|
||||
@Put("{id}")
|
||||
async Put(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: UpdateCommandSys,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const _commandSys = await this.commandSysRepository.findOne({ where: { id: id } });
|
||||
if (!_commandSys) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระบบคำสั่งนี้");
|
||||
}
|
||||
|
||||
_commandSys.lastUpdateUserId = request.user.sub;
|
||||
_commandSys.lastUpdateFullName = request.user.name;
|
||||
_commandSys.lastUpdatedAt = new Date();
|
||||
this.commandSysRepository.merge(_commandSys, requestBody);
|
||||
await this.commandSysRepository.save(_commandSys);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API ลบรายการระบบคำสั่ง
|
||||
*
|
||||
* @summary ORG_058 - CRUD ระบบคำสั่ง (ADMIN) #62
|
||||
*
|
||||
* @param {string} id Id ระบบคำสั่ง
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async Delete(@Path() id: string) {
|
||||
const _delCommandSys = await this.commandSysRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!_delCommandSys) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระบบคำสั่งนี้");
|
||||
}
|
||||
await this.commandSysRepository.delete(_delCommandSys.id);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@ import HttpStatusCode from "../interfaces/http-status";
|
|||
import HttpError from "../interfaces/http-error";
|
||||
import { CommandType, CreateCommandType, UpdateCommandType } from "../entities/CommandType";
|
||||
import { Not } from "typeorm";
|
||||
import { CommandSys } from "../entities/CommandSys";
|
||||
|
||||
@Route("api/v1/org/commandType")
|
||||
@Tags("CommandType")
|
||||
|
|
@ -31,6 +32,7 @@ import { Not } from "typeorm";
|
|||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class CommandTypeController extends Controller {
|
||||
private commandTypeRepository = AppDataSource.getRepository(CommandType);
|
||||
private commandSysRepository = AppDataSource.getRepository(CommandSys);
|
||||
|
||||
/**
|
||||
* API list รายการประเภทคำสั่ง
|
||||
|
|
@ -45,7 +47,7 @@ export class CommandTypeController extends Controller {
|
|||
select: [
|
||||
"id",
|
||||
"name",
|
||||
"type",
|
||||
"commandSysId",
|
||||
"code",
|
||||
"detailHeader",
|
||||
"detailBody",
|
||||
|
|
@ -102,7 +104,7 @@ export class CommandTypeController extends Controller {
|
|||
select: [
|
||||
"id",
|
||||
"name",
|
||||
"type",
|
||||
"commandSysId",
|
||||
"code",
|
||||
"isActive",
|
||||
"detailHeader",
|
||||
|
|
@ -141,6 +143,14 @@ export class CommandTypeController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
const checkNameSys = await this.commandSysRepository.findOne({
|
||||
where: { id: requestBody.commandSysId },
|
||||
});
|
||||
|
||||
if (checkNameSys) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อประเภทนี้มีอยู่ในระบบ");
|
||||
}
|
||||
|
||||
_commandType.createdUserId = request.user.sub;
|
||||
_commandType.createdFullName = request.user.name;
|
||||
_commandType.lastUpdateUserId = request.user.sub;
|
||||
|
|
@ -176,6 +186,14 @@ export class CommandTypeController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
const checkNameSys = await this.commandSysRepository.findOne({
|
||||
where: { id: requestBody.commandSysId },
|
||||
});
|
||||
|
||||
if (checkNameSys) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อประเภทนี้มีอยู่ในระบบ");
|
||||
}
|
||||
|
||||
_commandType.lastUpdateUserId = request.user.sub;
|
||||
_commandType.lastUpdateFullName = request.user.name;
|
||||
_commandType.lastUpdatedAt = new Date();
|
||||
|
|
|
|||
|
|
@ -254,7 +254,9 @@ export class EmployeePositionController extends Controller {
|
|||
posMasterNoSuffix: posMaster.posMasterNoSuffix,
|
||||
reason: posMaster.reason,
|
||||
isOfficer: posMaster.isOfficer,
|
||||
isStaff: posMaster.isStaff,
|
||||
isDirector: posMaster.isDirector,
|
||||
positionSign: posMaster.positionSign,
|
||||
positions: positions.map((position) => ({
|
||||
id: position.id,
|
||||
positionName: position.positionName,
|
||||
|
|
@ -628,8 +630,11 @@ export class EmployeePositionController extends Controller {
|
|||
if (!posMaster) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
|
||||
}
|
||||
let _null:any = null;
|
||||
posMaster.posMasterNo = requestBody.posMasterNo;
|
||||
posMaster.isDirector = requestBody.isDirector;
|
||||
posMaster.isStaff = requestBody.isStaff;
|
||||
posMaster.positionSign = requestBody.positionSign == null ? _null : requestBody.positionSign;
|
||||
posMaster.isOfficer = requestBody.isOfficer;
|
||||
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
|
||||
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;
|
||||
|
|
|
|||
|
|
@ -821,8 +821,11 @@ export class PositionController extends Controller {
|
|||
if (!posMaster) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
|
||||
}
|
||||
let _null:any = null;
|
||||
posMaster.isDirector = requestBody.isDirector;
|
||||
posMaster.isStaff = requestBody.isStaff;
|
||||
posMaster.isOfficer = requestBody.isOfficer;
|
||||
posMaster.positionSign = requestBody.positionSign == null ? _null : requestBody.positionSign;
|
||||
posMaster.posMasterNo = requestBody.posMasterNo;
|
||||
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
|
||||
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;
|
||||
|
|
@ -978,7 +981,9 @@ export class PositionController extends Controller {
|
|||
position.positionArea = x.posDictArea;
|
||||
position.isSpecial = x.isSpecial;
|
||||
position.isOfficer = x.isOfficer;
|
||||
position.isStaff = x.isStaff;
|
||||
position.isDirector = x.isDirector;
|
||||
position.positionSign = x.positionSign;
|
||||
position.positionIsSelected = x.positionIsSelected;
|
||||
position.posMasterId = posMaster.id;
|
||||
position.createdUserId = request.user.sub;
|
||||
|
|
@ -1019,7 +1024,9 @@ export class PositionController extends Controller {
|
|||
posMasterNoSuffix: posMaster.posMasterNoSuffix,
|
||||
reason: posMaster.reason,
|
||||
isOfficer: posMaster.isOfficer,
|
||||
isStaff: posMaster.isStaff,
|
||||
isDirector: posMaster.isDirector,
|
||||
positionSign: posMaster.positionSign,
|
||||
positions: positions.map((position) => ({
|
||||
id: position.id,
|
||||
positionName: position.positionName,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Entity, Column, JoinColumn, ManyToOne } from "typeorm";
|
||||
import { Entity, Column, JoinColumn, ManyToOne, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { CommandType } from "./CommandType";
|
||||
import { CommandSend } from "./CommandSend";
|
||||
|
||||
@Entity("command")
|
||||
export class Command extends EntityBase {
|
||||
|
|
@ -89,6 +90,9 @@ export class Command extends EntityBase {
|
|||
@ManyToOne(() => CommandType, (commandType) => commandType.commands)
|
||||
@JoinColumn({ name: "commandTypeId" })
|
||||
commandType: CommandType;
|
||||
|
||||
@OneToMany(() => CommandSend, (commandSend) => commandSend.command)
|
||||
commandSends: CommandSend[];
|
||||
}
|
||||
|
||||
export class CreateCommand {
|
||||
|
|
|
|||
92
src/entities/CommandSend.ts
Normal file
92
src/entities/CommandSend.ts
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
import { Entity, Column, JoinColumn, ManyToOne } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Command } from "./Command";
|
||||
import { Profile } from "./Profile";
|
||||
|
||||
@Entity("commandSend")
|
||||
export class CommandSend extends EntityBase {
|
||||
// EMAIL = อีเมล
|
||||
// INBOX = กล่องข้อความ
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ช่องทางการส่งสำเนา",
|
||||
length: 20,
|
||||
default: null,
|
||||
})
|
||||
sendCC: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เลขประจำตัวประชาชน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
citizenId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "คำนำหน้า",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
prefix: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อ",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
fristName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "สกุล",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
lastName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ตำแหน่ง",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
position: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "หน่วยงาน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
org: string;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง command",
|
||||
})
|
||||
commandId: string;
|
||||
|
||||
@ManyToOne(() => Command, (command) => command.commandSends)
|
||||
@JoinColumn({ name: "commandId" })
|
||||
command: Command;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง profile",
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@ManyToOne(() => Profile, (profile) => profile.commandSends)
|
||||
@JoinColumn({ name: "profileId" })
|
||||
profile: Profile;
|
||||
}
|
||||
|
||||
export class CreateCommandSend {
|
||||
@Column()
|
||||
name: string;
|
||||
}
|
||||
|
||||
// export type UpdateCommandSend = Partial<CreateCommandSend>;
|
||||
82
src/entities/CommandSys.ts
Normal file
82
src/entities/CommandSys.ts
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
import {
|
||||
Entity,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
PrimaryColumn,
|
||||
OneToMany,
|
||||
} from "typeorm";
|
||||
import { CommandType } from "./CommandType";
|
||||
|
||||
@Entity("commandSys")
|
||||
export class CommandSys {
|
||||
@PrimaryColumn({
|
||||
comment: "ไอดีหลักของตาราง",
|
||||
length: 255,
|
||||
})
|
||||
id: string;
|
||||
|
||||
@CreateDateColumn({ comment: "สร้างข้อมูลเมื่อ" })
|
||||
createdAt!: Date;
|
||||
|
||||
@Column({
|
||||
comment: "User Id ที่สร้างข้อมูล",
|
||||
length: 40,
|
||||
default: "00000000-0000-0000-0000-000000000000",
|
||||
})
|
||||
createdUserId!: String;
|
||||
|
||||
@UpdateDateColumn({ comment: "แก้ไขข้อมูลล่าสุดเมื่อ" })
|
||||
lastUpdatedAt!: Date;
|
||||
|
||||
@Column({
|
||||
comment: "User Id ที่แก้ไขข้อมูล",
|
||||
length: 40,
|
||||
default: "00000000-0000-0000-0000-000000000000",
|
||||
})
|
||||
lastUpdateUserId!: String;
|
||||
|
||||
@Column({ comment: "ชื่อ User ที่สร้างข้อมูล", length: 200, default: "string" })
|
||||
createdFullName!: String;
|
||||
|
||||
@Column({ comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด", length: 200, default: "string" })
|
||||
lastUpdateFullName!: String;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อระบบ",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
sysName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "รายละเอียด",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
sysDescription: string;
|
||||
|
||||
@OneToMany(() => CommandType, (commandType) => commandType.commandTypeSys)
|
||||
commandTypes: CommandType[];
|
||||
}
|
||||
|
||||
export class CreateCommandSys {
|
||||
@PrimaryColumn()
|
||||
id: string;
|
||||
|
||||
@Column()
|
||||
sysName: string;
|
||||
|
||||
@Column()
|
||||
sysDescription: string;
|
||||
}
|
||||
|
||||
export class UpdateCommandSys {
|
||||
@Column()
|
||||
sysName: string;
|
||||
|
||||
@Column()
|
||||
sysDescription: string;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { Entity, Column, OneToMany, JoinColumn, ManyToOne } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Command } from "./Command";
|
||||
import { CommandSys } from "./CommandSys";
|
||||
|
||||
@Entity("commandType")
|
||||
export class CommandType extends EntityBase {
|
||||
|
|
@ -12,14 +13,6 @@ export class CommandType extends EntityBase {
|
|||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ประเภทคำสั่ง",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
type: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "รหัสคำสั่ง",
|
||||
|
|
@ -60,6 +53,18 @@ export class CommandType extends EntityBase {
|
|||
|
||||
@OneToMany(() => Command, (command) => command.commandType)
|
||||
commands: Command[];
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "คีย์นอก(FK)ของตาราง CommandSys",
|
||||
default: null,
|
||||
})
|
||||
commandSysId: string;
|
||||
|
||||
@ManyToOne(() => CommandSys, (commandSys) => commandSys.commandTypes)
|
||||
@JoinColumn({ name: "commandSysId" })
|
||||
commandTypeSys: CommandSys;
|
||||
}
|
||||
|
||||
export class CreateCommandType {
|
||||
|
|
@ -67,10 +72,10 @@ export class CreateCommandType {
|
|||
name: string;
|
||||
|
||||
@Column()
|
||||
type: string;
|
||||
isActive: boolean;
|
||||
|
||||
@Column()
|
||||
isActive: boolean;
|
||||
commandSysId: string;
|
||||
}
|
||||
|
||||
export type UpdateCommandType = Partial<CreateCommandType>;
|
||||
|
|
|
|||
|
|
@ -97,8 +97,22 @@ export class EmployeePosMaster extends EntityBase {
|
|||
comment: "เป็นเจ้าหน้าที่",
|
||||
default: false,
|
||||
})
|
||||
isStaff: boolean;
|
||||
|
||||
@Column({
|
||||
comment: "เป็นสกจ",
|
||||
default: false,
|
||||
})
|
||||
isOfficer: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ตำแหน่งใต้ลายเซ็นต์",
|
||||
type: "text",
|
||||
default: null,
|
||||
})
|
||||
positionSign: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "หมายเหตุ",
|
||||
|
|
@ -253,8 +267,14 @@ export class CreateEmployeePosMaster {
|
|||
@Column()
|
||||
isDirector: boolean;
|
||||
|
||||
@Column()
|
||||
isStaff: boolean;
|
||||
|
||||
@Column()
|
||||
isOfficer: boolean;
|
||||
|
||||
@Column()
|
||||
positionSign: string | null;
|
||||
}
|
||||
|
||||
export type UpdateEmployeePosMaster = Partial<EmployeePosMaster>;
|
||||
|
|
|
|||
|
|
@ -98,8 +98,22 @@ export class PosMaster extends EntityBase {
|
|||
comment: "เป็นเจ้าหน้าที่",
|
||||
default: false,
|
||||
})
|
||||
isStaff: boolean;
|
||||
|
||||
@Column({
|
||||
comment: "เป็นสกจ",
|
||||
default: false,
|
||||
})
|
||||
isOfficer: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ตำแหน่งใต้ลายเซ็นต์",
|
||||
type: "text",
|
||||
default: null,
|
||||
})
|
||||
positionSign: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "หมายเหตุ",
|
||||
|
|
@ -260,8 +274,14 @@ export class CreatePosMaster {
|
|||
@Column()
|
||||
isDirector: boolean;
|
||||
|
||||
@Column()
|
||||
isStaff: boolean;
|
||||
|
||||
@Column()
|
||||
isOfficer: boolean;
|
||||
|
||||
@Column()
|
||||
positionSign: string | null;
|
||||
}
|
||||
|
||||
export type UpdatePosMaster = Partial<PosMaster>;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import { ProfileEdit } from "./ProfileEdit";
|
|||
import { ProfileDevelopment } from "./ProfileDevelopment";
|
||||
import { OrgRoot } from "./OrgRoot";
|
||||
import { PermissionOrg } from "./PermissionOrg";
|
||||
import { CommandSend } from "./CommandSend";
|
||||
|
||||
@Entity("profile")
|
||||
export class Profile extends EntityBase {
|
||||
|
|
@ -371,6 +372,9 @@ export class Profile extends EntityBase {
|
|||
@OneToMany(() => ProfileFamilyCouple, (v) => v.profile)
|
||||
profileFamilyCouple: ProfileFamilyCouple[];
|
||||
|
||||
@OneToMany(() => CommandSend, (v) => v.profile)
|
||||
commandSends: CommandSend[];
|
||||
|
||||
@ManyToOne(() => PosLevel, (posLevel) => posLevel.profiles)
|
||||
@JoinColumn({ name: "posLevelId" })
|
||||
posLevel: PosLevel;
|
||||
|
|
|
|||
44
src/migration/1726136471842-add_commandSys.ts
Normal file
44
src/migration/1726136471842-add_commandSys.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddCommandSys1726136471842 implements MigrationInterface {
|
||||
name = 'AddCommandSys1726136471842'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`commandType\` CHANGE \`type\` \`commandSysId\` varchar(255) NULL COMMENT 'ประเภทคำสั่ง'`);
|
||||
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`commandSys\` (\`id\` varchar(255) NOT NULL COMMENT 'ไอดีหลักของตาราง', \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`sysName\` varchar(255) NULL COMMENT 'ชื่อระบบ', \`sysDescription\` varchar(255) NULL COMMENT 'รายละเอียด', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`commandSysId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`commandSysId\` varchar(255) NULL COMMENT 'คีย์นอก(FK)ของตาราง CommandSys'`);
|
||||
await queryRunner.query(`ALTER TABLE \`commandType\` ADD CONSTRAINT \`FK_f88b8f74716e19276348bad75ef\` FOREIGN KEY (\`commandSysId\`) REFERENCES \`commandSys\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`commandType\` DROP FOREIGN KEY \`FK_f88b8f74716e19276348bad75ef\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`commandSysId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`commandSysId\` varchar(255) NULL COMMENT 'ประเภทคำสั่ง'`);
|
||||
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
|
||||
await queryRunner.query(`DROP TABLE \`commandSys\``);
|
||||
// await queryRunner.query(`DROP TABLE \`educationMis\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
|
||||
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
|
||||
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandType\` CHANGE \`commandSysId\` \`type\` varchar(255) NULL COMMENT 'ประเภทคำสั่ง'`);
|
||||
}
|
||||
|
||||
}
|
||||
42
src/migration/1726149698735-add_isDirector.ts
Normal file
42
src/migration/1726149698735-add_isDirector.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddIsDirector1726149698735 implements MigrationInterface {
|
||||
name = 'AddIsDirector1726149698735'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD \`isStaff\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT 0`);
|
||||
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD \`positionSign\` text NULL COMMENT 'ตำแหน่งใต้ลายเซ็นต์'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`isStaff\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT 0`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`positionSign\` text NULL COMMENT 'ตำแหน่งใต้ลายเซ็นต์'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`positionSign\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`isStaff\``);
|
||||
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP COLUMN \`positionSign\``);
|
||||
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP COLUMN \`isStaff\``);
|
||||
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
|
||||
// await queryRunner.query(`DROP TABLE \`educationMis\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
|
||||
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
|
||||
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
|
||||
}
|
||||
|
||||
}
|
||||
48
src/migration/1726154911194-add_commandSend.ts
Normal file
48
src/migration/1726154911194-add_commandSend.ts
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddCommandSend1726154911194 implements MigrationInterface {
|
||||
name = 'AddCommandSend1726154911194'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`commandSend\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`sendCC\` varchar(20) NULL COMMENT 'ช่องทางการส่งสำเนา', \`citizenId\` varchar(255) NULL COMMENT 'เลขประจำตัวประชาชน', \`prefix\` varchar(255) NULL COMMENT 'คำนำหน้า', \`fristName\` varchar(255) NULL COMMENT 'ชื่อ', \`lastName\` varchar(255) NULL COMMENT 'สกุล', \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง', \`org\` varchar(255) NULL COMMENT 'หน่วยงาน', \`commandId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง command', \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
// await queryRunner.query(`ALTER TABLE \`employeePosMaster\` CHANGE \`isStaff\` \`isStaff\` tinyint NOT NULL COMMENT 'เป็นเจ้าหน้าที่' DEFAULT 0`);
|
||||
// await queryRunner.query(`ALTER TABLE \`employeePosMaster\` CHANGE \`isOfficer\` \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT 0`);
|
||||
// await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isStaff\` \`isStaff\` tinyint NOT NULL COMMENT 'เป็นเจ้าหน้าที่' DEFAULT 0`);
|
||||
// await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isOfficer\` \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT 0`);
|
||||
await queryRunner.query(`ALTER TABLE \`commandSend\` ADD CONSTRAINT \`FK_71884cff2519003c997c4129374\` FOREIGN KEY (\`commandId\`) REFERENCES \`command\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`commandSend\` ADD CONSTRAINT \`FK_4f257ba4ce200ddc0726156a00d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`commandSend\` DROP FOREIGN KEY \`FK_4f257ba4ce200ddc0726156a00d\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandSend\` DROP FOREIGN KEY \`FK_71884cff2519003c997c4129374\``);
|
||||
// await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isOfficer\` \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นเจ้าหน้าที่' DEFAULT '0'`);
|
||||
// await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isStaff\` \`isStaff\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT '0'`);
|
||||
// await queryRunner.query(`ALTER TABLE \`employeePosMaster\` CHANGE \`isOfficer\` \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นเจ้าหน้าที่' DEFAULT '0'`);
|
||||
// await queryRunner.query(`ALTER TABLE \`employeePosMaster\` CHANGE \`isStaff\` \`isStaff\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT '0'`);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
|
||||
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
|
||||
// await queryRunner.query(`DROP TABLE \`educationMis\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
|
||||
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
|
||||
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
|
||||
await queryRunner.query(`DROP TABLE \`commandSend\``);
|
||||
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue