Merge branch 'feat/20250709' into develop
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 5s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 5s
This commit is contained in:
commit
163f07758e
13 changed files with 99 additions and 29 deletions
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- You are about to drop the column `businessType` on the `CustomerBranch` table. All the data in the column will be lost.
|
||||||
|
- You are about to drop the column `customerName` on the `CustomerBranch` table. All the data in the column will be lost.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "CustomerBranch" DROP COLUMN "businessType",
|
||||||
|
DROP COLUMN "customerName",
|
||||||
|
ADD COLUMN "businessTypeId" TEXT;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "EmployeeVisa" ADD COLUMN "reportDate" DATE;
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "BusinessType" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"nameEN" TEXT NOT NULL,
|
||||||
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"createdByUserId" TEXT,
|
||||||
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||||
|
"updatedByUserId" TEXT,
|
||||||
|
|
||||||
|
CONSTRAINT "BusinessType_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "CustomerBranch" ADD CONSTRAINT "CustomerBranch_businessTypeId_fkey" FOREIGN KEY ("businessTypeId") REFERENCES "BusinessType"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "BusinessType" ADD CONSTRAINT "BusinessType_createdByUserId_fkey" FOREIGN KEY ("createdByUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "BusinessType" ADD CONSTRAINT "BusinessType_updatedByUserId_fkey" FOREIGN KEY ("updatedByUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
@ -501,6 +501,8 @@ model User {
|
||||||
creditNoteCreated CreditNote[] @relation("CreditNoteCreatedByUser")
|
creditNoteCreated CreditNote[] @relation("CreditNoteCreatedByUser")
|
||||||
institutionCreated Institution[] @relation("InstitutionCreatedByUser")
|
institutionCreated Institution[] @relation("InstitutionCreatedByUser")
|
||||||
institutionUpdated Institution[] @relation("InstitutionUpdatedByUser")
|
institutionUpdated Institution[] @relation("InstitutionUpdatedByUser")
|
||||||
|
businessTypeCreated BusinessType[] @relation("BusinessTypeCreatedByUser")
|
||||||
|
businessTypeUpdated BusinessType[] @relation("BusinessTypeUpdatedByUser")
|
||||||
|
|
||||||
requestWorkStepStatus RequestWorkStepStatus[]
|
requestWorkStepStatus RequestWorkStepStatus[]
|
||||||
userTask UserTask[]
|
userTask UserTask[]
|
||||||
|
|
@ -550,10 +552,9 @@ model Customer {
|
||||||
}
|
}
|
||||||
|
|
||||||
model CustomerBranch {
|
model CustomerBranch {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
|
customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
|
||||||
customerId String
|
customerId String
|
||||||
customerName String?
|
|
||||||
|
|
||||||
code String
|
code String
|
||||||
codeCustomer String
|
codeCustomer String
|
||||||
|
|
@ -615,7 +616,8 @@ model CustomerBranch {
|
||||||
agentUser User? @relation(fields: [agentUserId], references: [id], onDelete: SetNull)
|
agentUser User? @relation(fields: [agentUserId], references: [id], onDelete: SetNull)
|
||||||
|
|
||||||
// NOTE: Business
|
// NOTE: Business
|
||||||
businessType String
|
businessTypeId String?
|
||||||
|
businessType BusinessType? @relation(fields: [businessTypeId], references: [id], onDelete: SetNull)
|
||||||
jobPosition String
|
jobPosition String
|
||||||
jobDescription String
|
jobDescription String
|
||||||
payDate String
|
payDate String
|
||||||
|
|
@ -774,6 +776,21 @@ model CustomerBranchVatRegis {
|
||||||
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
|
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model BusinessType {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
name String
|
||||||
|
nameEN String
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
createdBy User? @relation(name: "BusinessTypeCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
||||||
|
createdByUserId String?
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
updatedBy User? @relation(name: "BusinessTypeUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
||||||
|
updatedByUserId String?
|
||||||
|
|
||||||
|
customerBranch CustomerBranch[]
|
||||||
|
}
|
||||||
|
|
||||||
model Employee {
|
model Employee {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
|
|
||||||
|
|
@ -895,8 +912,9 @@ model EmployeeVisa {
|
||||||
entryCount Int
|
entryCount Int
|
||||||
issueCountry String
|
issueCountry String
|
||||||
issuePlace String
|
issuePlace String
|
||||||
issueDate DateTime @db.Date
|
issueDate DateTime @db.Date
|
||||||
expireDate DateTime @db.Date
|
expireDate DateTime @db.Date
|
||||||
|
reportDate DateTime? @db.Date
|
||||||
mrz String?
|
mrz String?
|
||||||
remark String?
|
remark String?
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ export type CustomerBranchCreate = {
|
||||||
authorizedCapital?: string;
|
authorizedCapital?: string;
|
||||||
authorizedName?: string;
|
authorizedName?: string;
|
||||||
authorizedNameEN?: string;
|
authorizedNameEN?: string;
|
||||||
customerName?: string;
|
|
||||||
|
|
||||||
telephoneNo: string;
|
telephoneNo: string;
|
||||||
|
|
||||||
|
|
@ -111,7 +110,7 @@ export type CustomerBranchCreate = {
|
||||||
contactName: string;
|
contactName: string;
|
||||||
agentUserId?: string;
|
agentUserId?: string;
|
||||||
|
|
||||||
businessType: string;
|
businessTypeId?: string;
|
||||||
jobPosition: string;
|
jobPosition: string;
|
||||||
jobDescription: string;
|
jobDescription: string;
|
||||||
payDate: string;
|
payDate: string;
|
||||||
|
|
@ -145,7 +144,6 @@ export type CustomerBranchUpdate = {
|
||||||
authorizedCapital?: string;
|
authorizedCapital?: string;
|
||||||
authorizedName?: string;
|
authorizedName?: string;
|
||||||
authorizedNameEN?: string;
|
authorizedNameEN?: string;
|
||||||
customerName?: string;
|
|
||||||
|
|
||||||
telephoneNo: string;
|
telephoneNo: string;
|
||||||
|
|
||||||
|
|
@ -169,7 +167,7 @@ export type CustomerBranchUpdate = {
|
||||||
contactName?: string;
|
contactName?: string;
|
||||||
agentUserId?: string;
|
agentUserId?: string;
|
||||||
|
|
||||||
businessType?: string;
|
businessTypeId?: string;
|
||||||
jobPosition?: string;
|
jobPosition?: string;
|
||||||
jobDescription?: string;
|
jobDescription?: string;
|
||||||
payDate?: string;
|
payDate?: string;
|
||||||
|
|
@ -204,7 +202,6 @@ export class CustomerBranchController extends Controller {
|
||||||
) {
|
) {
|
||||||
const where = {
|
const where = {
|
||||||
OR: queryOrNot<Prisma.CustomerBranchWhereInput[]>(query, [
|
OR: queryOrNot<Prisma.CustomerBranchWhereInput[]>(query, [
|
||||||
{ customerName: { contains: query, mode: "insensitive" } },
|
|
||||||
{ registerName: { contains: query, mode: "insensitive" } },
|
{ registerName: { contains: query, mode: "insensitive" } },
|
||||||
{ registerNameEN: { contains: query, mode: "insensitive" } },
|
{ registerNameEN: { contains: query, mode: "insensitive" } },
|
||||||
{ email: { contains: query, mode: "insensitive" } },
|
{ email: { contains: query, mode: "insensitive" } },
|
||||||
|
|
@ -249,6 +246,7 @@ export class CustomerBranchController extends Controller {
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
updatedBy: true,
|
updatedBy: true,
|
||||||
_count: true,
|
_count: true,
|
||||||
|
businessType: true,
|
||||||
},
|
},
|
||||||
where,
|
where,
|
||||||
take: pageSize,
|
take: pageSize,
|
||||||
|
|
@ -271,6 +269,7 @@ export class CustomerBranchController extends Controller {
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
updatedBy: true,
|
updatedBy: true,
|
||||||
|
businessType: true,
|
||||||
},
|
},
|
||||||
where: { id: branchId },
|
where: { id: branchId },
|
||||||
});
|
});
|
||||||
|
|
@ -381,7 +380,15 @@ export class CustomerBranchController extends Controller {
|
||||||
(v) => (v.headOffice || v).code,
|
(v) => (v.headOffice || v).code,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { provinceId, districtId, subDistrictId, customerId, agentUserId, ...rest } = body;
|
const {
|
||||||
|
provinceId,
|
||||||
|
districtId,
|
||||||
|
subDistrictId,
|
||||||
|
customerId,
|
||||||
|
agentUserId,
|
||||||
|
businessTypeId,
|
||||||
|
...rest
|
||||||
|
} = body;
|
||||||
|
|
||||||
const record = await prisma.$transaction(
|
const record = await prisma.$transaction(
|
||||||
async (tx) => {
|
async (tx) => {
|
||||||
|
|
@ -424,6 +431,7 @@ export class CustomerBranchController extends Controller {
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
updatedBy: true,
|
updatedBy: true,
|
||||||
|
businessType: true,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
...rest,
|
...rest,
|
||||||
|
|
@ -435,6 +443,7 @@ export class CustomerBranchController extends Controller {
|
||||||
province: connectOrNot(provinceId),
|
province: connectOrNot(provinceId),
|
||||||
district: connectOrNot(districtId),
|
district: connectOrNot(districtId),
|
||||||
subDistrict: connectOrNot(subDistrictId),
|
subDistrict: connectOrNot(subDistrictId),
|
||||||
|
businessType: connectOrNot(businessTypeId),
|
||||||
createdBy: { connect: { id: req.user.sub } },
|
createdBy: { connect: { id: req.user.sub } },
|
||||||
updatedBy: { connect: { id: req.user.sub } },
|
updatedBy: { connect: { id: req.user.sub } },
|
||||||
},
|
},
|
||||||
|
|
@ -465,6 +474,7 @@ export class CustomerBranchController extends Controller {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
businessType: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -509,7 +519,15 @@ export class CustomerBranchController extends Controller {
|
||||||
await permissionCheck(req.user, customer.registeredBranch);
|
await permissionCheck(req.user, customer.registeredBranch);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { provinceId, districtId, subDistrictId, customerId, agentUserId, ...rest } = body;
|
const {
|
||||||
|
provinceId,
|
||||||
|
districtId,
|
||||||
|
subDistrictId,
|
||||||
|
customerId,
|
||||||
|
agentUserId,
|
||||||
|
businessTypeId,
|
||||||
|
...rest
|
||||||
|
} = body;
|
||||||
|
|
||||||
return await prisma.customerBranch.update({
|
return await prisma.customerBranch.update({
|
||||||
where: { id: branchId },
|
where: { id: branchId },
|
||||||
|
|
@ -519,6 +537,7 @@ export class CustomerBranchController extends Controller {
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
updatedBy: true,
|
updatedBy: true,
|
||||||
|
businessType: true,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
...rest,
|
...rest,
|
||||||
|
|
@ -528,6 +547,7 @@ export class CustomerBranchController extends Controller {
|
||||||
province: connectOrDisconnect(provinceId),
|
province: connectOrDisconnect(provinceId),
|
||||||
district: connectOrDisconnect(districtId),
|
district: connectOrDisconnect(districtId),
|
||||||
subDistrict: connectOrDisconnect(subDistrictId),
|
subDistrict: connectOrDisconnect(subDistrictId),
|
||||||
|
businessType: connectOrNot(businessTypeId),
|
||||||
updatedBy: { connect: { id: req.user.sub } },
|
updatedBy: { connect: { id: req.user.sub } },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -546,6 +566,7 @@ export class CustomerBranchController extends Controller {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
businessType: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -598,6 +619,7 @@ export class CustomerBranchFileController extends Controller {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
businessType: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!data) throw notFoundError("Customer Branch");
|
if (!data) throw notFoundError("Customer Branch");
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@ export type CustomerCreate = {
|
||||||
authorizedCapital?: string;
|
authorizedCapital?: string;
|
||||||
authorizedName?: string;
|
authorizedName?: string;
|
||||||
authorizedNameEN?: string;
|
authorizedNameEN?: string;
|
||||||
customerName?: string;
|
|
||||||
|
|
||||||
telephoneNo: string;
|
telephoneNo: string;
|
||||||
|
|
||||||
|
|
@ -109,7 +108,7 @@ export type CustomerCreate = {
|
||||||
contactName: string;
|
contactName: string;
|
||||||
agentUserId?: string;
|
agentUserId?: string;
|
||||||
|
|
||||||
businessType: string;
|
businessTypeId?: string | null;
|
||||||
jobPosition: string;
|
jobPosition: string;
|
||||||
jobDescription: string;
|
jobDescription: string;
|
||||||
payDate: string;
|
payDate: string;
|
||||||
|
|
@ -174,7 +173,6 @@ export class CustomerController extends Controller {
|
||||||
const where = {
|
const where = {
|
||||||
OR: queryOrNot<Prisma.CustomerWhereInput[]>(query, [
|
OR: queryOrNot<Prisma.CustomerWhereInput[]>(query, [
|
||||||
{ branch: { some: { namePrefix: { contains: query, mode: "insensitive" } } } },
|
{ branch: { some: { namePrefix: { contains: query, mode: "insensitive" } } } },
|
||||||
{ branch: { some: { customerName: { contains: query, mode: "insensitive" } } } },
|
|
||||||
{ branch: { some: { registerName: { contains: query, mode: "insensitive" } } } },
|
{ branch: { some: { registerName: { contains: query, mode: "insensitive" } } } },
|
||||||
{ branch: { some: { registerNameEN: { contains: query, mode: "insensitive" } } } },
|
{ branch: { some: { registerNameEN: { contains: query, mode: "insensitive" } } } },
|
||||||
{ branch: { some: { firstName: { contains: query, mode: "insensitive" } } } },
|
{ branch: { some: { firstName: { contains: query, mode: "insensitive" } } } },
|
||||||
|
|
@ -220,6 +218,7 @@ export class CustomerController extends Controller {
|
||||||
},
|
},
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
updatedBy: true,
|
updatedBy: true,
|
||||||
|
// businessType:true
|
||||||
},
|
},
|
||||||
orderBy: [{ statusOrder: "asc" }, { createdAt: "asc" }],
|
orderBy: [{ statusOrder: "asc" }, { createdAt: "asc" }],
|
||||||
where,
|
where,
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ type EmployeeVisaPayload = {
|
||||||
issuePlace: string;
|
issuePlace: string;
|
||||||
issueDate: Date;
|
issueDate: Date;
|
||||||
expireDate: Date;
|
expireDate: Date;
|
||||||
|
reportDate?: Date | null;
|
||||||
mrz?: string | null;
|
mrz?: string | null;
|
||||||
remark?: string | null;
|
remark?: string | null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ const MANAGE_ROLES = [
|
||||||
];
|
];
|
||||||
|
|
||||||
function globalAllow(user: RequestWithUser["user"]) {
|
function globalAllow(user: RequestWithUser["user"]) {
|
||||||
const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"];
|
const listAllowed = MANAGE_ROLES;
|
||||||
return user.roles?.some((v) => listAllowed.includes(v)) || false;
|
return user.roles?.some((v) => listAllowed.includes(v)) || false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,6 @@ export class InvoiceController extends Controller {
|
||||||
customerBranch: {
|
customerBranch: {
|
||||||
OR: [
|
OR: [
|
||||||
{ code: { contains: query, mode: "insensitive" } },
|
{ code: { contains: query, mode: "insensitive" } },
|
||||||
{ customerName: { contains: query, mode: "insensitive" } },
|
|
||||||
{ registerName: { contains: query, mode: "insensitive" } },
|
{ registerName: { contains: query, mode: "insensitive" } },
|
||||||
{ registerNameEN: { contains: query, mode: "insensitive" } },
|
{ registerNameEN: { contains: query, mode: "insensitive" } },
|
||||||
{ firstName: { contains: query, mode: "insensitive" } },
|
{ firstName: { contains: query, mode: "insensitive" } },
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,6 @@ export class QuotationController extends Controller {
|
||||||
customerBranch: {
|
customerBranch: {
|
||||||
OR: [
|
OR: [
|
||||||
{ code: { contains: query, mode: "insensitive" } },
|
{ code: { contains: query, mode: "insensitive" } },
|
||||||
{ customerName: { contains: query, mode: "insensitive" } },
|
|
||||||
{ firstName: { contains: query, mode: "insensitive" } },
|
{ firstName: { contains: query, mode: "insensitive" } },
|
||||||
{ firstNameEN: { contains: query, mode: "insensitive" } },
|
{ firstNameEN: { contains: query, mode: "insensitive" } },
|
||||||
{ lastName: { contains: query, mode: "insensitive" } },
|
{ lastName: { contains: query, mode: "insensitive" } },
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,6 @@ export class RequestDataController extends Controller {
|
||||||
customerBranch: {
|
customerBranch: {
|
||||||
OR: [
|
OR: [
|
||||||
{ code: { contains: query, mode: "insensitive" } },
|
{ code: { contains: query, mode: "insensitive" } },
|
||||||
{ customerName: { contains: query, mode: "insensitive" } },
|
|
||||||
{ registerName: { contains: query, mode: "insensitive" } },
|
{ registerName: { contains: query, mode: "insensitive" } },
|
||||||
{ registerNameEN: { contains: query, mode: "insensitive" } },
|
{ registerNameEN: { contains: query, mode: "insensitive" } },
|
||||||
{ firstName: { contains: query, mode: "insensitive" } },
|
{ firstName: { contains: query, mode: "insensitive" } },
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,6 @@ export class CreditNoteController extends Controller {
|
||||||
customerBranch: {
|
customerBranch: {
|
||||||
OR: [
|
OR: [
|
||||||
{ code: { contains: query, mode: "insensitive" } },
|
{ code: { contains: query, mode: "insensitive" } },
|
||||||
{ customerName: { contains: query, mode: "insensitive" } },
|
|
||||||
{ firstName: { contains: query, mode: "insensitive" } },
|
{ firstName: { contains: query, mode: "insensitive" } },
|
||||||
{ firstNameEN: { contains: query, mode: "insensitive" } },
|
{ firstNameEN: { contains: query, mode: "insensitive" } },
|
||||||
{ lastName: { contains: query, mode: "insensitive" } },
|
{ lastName: { contains: query, mode: "insensitive" } },
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,6 @@ export class DebitNoteController extends Controller {
|
||||||
customerBranch: {
|
customerBranch: {
|
||||||
OR: [
|
OR: [
|
||||||
{ code: { contains: query, mode: "insensitive" } },
|
{ code: { contains: query, mode: "insensitive" } },
|
||||||
{ customerName: { contains: query, mode: "insensitive" } },
|
|
||||||
{ firstName: { contains: query, mode: "insensitive" } },
|
{ firstName: { contains: query, mode: "insensitive" } },
|
||||||
{ firstNameEN: { contains: query, mode: "insensitive" } },
|
{ firstNameEN: { contains: query, mode: "insensitive" } },
|
||||||
{ lastName: { contains: query, mode: "insensitive" } },
|
{ lastName: { contains: query, mode: "insensitive" } },
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,6 @@ export class LineController extends Controller {
|
||||||
customerBranch: {
|
customerBranch: {
|
||||||
OR: [
|
OR: [
|
||||||
{ code: { contains: query, mode: "insensitive" } },
|
{ code: { contains: query, mode: "insensitive" } },
|
||||||
{ customerName: { contains: query, mode: "insensitive" } },
|
|
||||||
{ registerName: { contains: query, mode: "insensitive" } },
|
{ registerName: { contains: query, mode: "insensitive" } },
|
||||||
{ registerNameEN: { contains: query, mode: "insensitive" } },
|
{ registerNameEN: { contains: query, mode: "insensitive" } },
|
||||||
{ firstName: { contains: query, mode: "insensitive" } },
|
{ firstName: { contains: query, mode: "insensitive" } },
|
||||||
|
|
@ -624,7 +623,7 @@ export class LineController extends Controller {
|
||||||
customerBranch: {
|
customerBranch: {
|
||||||
OR: [
|
OR: [
|
||||||
{ code: { contains: query, mode: "insensitive" } },
|
{ code: { contains: query, mode: "insensitive" } },
|
||||||
{ customerName: { contains: query, mode: "insensitive" } },
|
{ registerName: { contains: query, mode: "insensitive" } },
|
||||||
{ firstName: { contains: query, mode: "insensitive" } },
|
{ firstName: { contains: query, mode: "insensitive" } },
|
||||||
{ firstNameEN: { contains: query, mode: "insensitive" } },
|
{ firstNameEN: { contains: query, mode: "insensitive" } },
|
||||||
{ lastName: { contains: query, mode: "insensitive" } },
|
{ lastName: { contains: query, mode: "insensitive" } },
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ export class WebHookController extends Controller {
|
||||||
firstNameEN: true,
|
firstNameEN: true,
|
||||||
lastName: true,
|
lastName: true,
|
||||||
lastNameEN: true,
|
lastNameEN: true,
|
||||||
customerName: true,
|
registerName: true,
|
||||||
customer: {
|
customer: {
|
||||||
select: {
|
select: {
|
||||||
customerType: true,
|
customerType: true,
|
||||||
|
|
@ -133,13 +133,13 @@ export class WebHookController extends Controller {
|
||||||
let textData = "";
|
let textData = "";
|
||||||
|
|
||||||
if (dataEmployee.length > 0) {
|
if (dataEmployee.length > 0) {
|
||||||
const customerName =
|
const registerName =
|
||||||
dataEmployee[0]?.employee?.customerBranch?.customerName ?? "ไม่ระบุ";
|
dataEmployee[0]?.employee?.customerBranch?.registerName ?? "ไม่ระบุ";
|
||||||
const telephoneNo =
|
const telephoneNo =
|
||||||
dataEmployee[0]?.employee?.customerBranch?.customer.registeredBranch.telephoneNo ??
|
dataEmployee[0]?.employee?.customerBranch?.customer.registeredBranch.telephoneNo ??
|
||||||
"ไม่ระบุ";
|
"ไม่ระบุ";
|
||||||
|
|
||||||
const textEmployer = `เรียน คุณ${customerName}`;
|
const textEmployer = `เรียน คุณ${registerName}`;
|
||||||
const textAlert = "ขอแจ้งให้ทราบว่าหนังสือเดินทางของลูกจ้าง";
|
const textAlert = "ขอแจ้งให้ทราบว่าหนังสือเดินทางของลูกจ้าง";
|
||||||
const textAlert2 = "และจำเป็นต้องดำเนินการต่ออายุในเร็ว ๆ นี้";
|
const textAlert2 = "และจำเป็นต้องดำเนินการต่ออายุในเร็ว ๆ นี้";
|
||||||
const textExpDate =
|
const textExpDate =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue