fix: import
This commit is contained in:
parent
415d12dd4b
commit
cf317c7d19
3 changed files with 3 additions and 461 deletions
|
|
@ -1,459 +0,0 @@
|
||||||
import type { ColumnType } from "kysely";
|
|
||||||
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
|
|
||||||
? ColumnType<S, I | undefined, U>
|
|
||||||
: ColumnType<T, T | undefined, T>;
|
|
||||||
export type Timestamp = ColumnType<Date, Date | string, Date | string>;
|
|
||||||
|
|
||||||
export const Status = {
|
|
||||||
CREATED: "CREATED",
|
|
||||||
ACTIVE: "ACTIVE",
|
|
||||||
INACTIVE: "INACTIVE"
|
|
||||||
} as const;
|
|
||||||
export type Status = (typeof Status)[keyof typeof Status];
|
|
||||||
export const UserType = {
|
|
||||||
USER: "USER",
|
|
||||||
MESSENGER: "MESSENGER",
|
|
||||||
DELEGATE: "DELEGATE",
|
|
||||||
AGENCY: "AGENCY"
|
|
||||||
} as const;
|
|
||||||
export type UserType = (typeof UserType)[keyof typeof UserType];
|
|
||||||
export const CustomerType = {
|
|
||||||
CORP: "CORP",
|
|
||||||
PERS: "PERS"
|
|
||||||
} as const;
|
|
||||||
export type CustomerType = (typeof CustomerType)[keyof typeof CustomerType];
|
|
||||||
export type Branch = {
|
|
||||||
id: string;
|
|
||||||
code: string;
|
|
||||||
taxNo: string;
|
|
||||||
name: string;
|
|
||||||
nameEN: string;
|
|
||||||
address: string;
|
|
||||||
addressEN: string;
|
|
||||||
telephoneNo: string;
|
|
||||||
provinceId: string | null;
|
|
||||||
districtId: string | null;
|
|
||||||
subDistrictId: string | null;
|
|
||||||
zipCode: string;
|
|
||||||
email: string;
|
|
||||||
contactName: string | null;
|
|
||||||
lineId: string | null;
|
|
||||||
latitude: string;
|
|
||||||
longitude: string;
|
|
||||||
isHeadOffice: Generated<boolean>;
|
|
||||||
headOfficeId: string | null;
|
|
||||||
status: Generated<Status>;
|
|
||||||
statusOrder: Generated<number>;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type BranchContact = {
|
|
||||||
id: string;
|
|
||||||
telephoneNo: string;
|
|
||||||
branchId: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type BranchUser = {
|
|
||||||
id: string;
|
|
||||||
branchId: string;
|
|
||||||
userId: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type Customer = {
|
|
||||||
id: string;
|
|
||||||
code: string;
|
|
||||||
personName: string;
|
|
||||||
personNameEN: string | null;
|
|
||||||
customerType: CustomerType;
|
|
||||||
customerName: string;
|
|
||||||
customerNameEN: string;
|
|
||||||
taxNo: string | null;
|
|
||||||
status: Generated<Status>;
|
|
||||||
statusOrder: Generated<number>;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type CustomerBranch = {
|
|
||||||
id: string;
|
|
||||||
branchNo: number;
|
|
||||||
code: string;
|
|
||||||
legalPersonNo: string;
|
|
||||||
name: string;
|
|
||||||
nameEN: string;
|
|
||||||
customerId: string;
|
|
||||||
taxNo: string | null;
|
|
||||||
registerName: string;
|
|
||||||
registerDate: Timestamp;
|
|
||||||
authorizedCapital: string;
|
|
||||||
address: string;
|
|
||||||
addressEN: string;
|
|
||||||
provinceId: string | null;
|
|
||||||
districtId: string | null;
|
|
||||||
subDistrictId: string | null;
|
|
||||||
zipCode: string;
|
|
||||||
email: string;
|
|
||||||
telephoneNo: string;
|
|
||||||
employmentOffice: string;
|
|
||||||
bussinessType: string;
|
|
||||||
bussinessTypeEN: string;
|
|
||||||
jobPosition: string;
|
|
||||||
jobPositionEN: string;
|
|
||||||
jobDescription: string;
|
|
||||||
saleEmployee: string;
|
|
||||||
payDate: Timestamp;
|
|
||||||
wageRate: number;
|
|
||||||
status: Generated<Status>;
|
|
||||||
statusOrder: Generated<number>;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type District = {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
nameEN: string;
|
|
||||||
provinceId: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type Employee = {
|
|
||||||
id: string;
|
|
||||||
code: string;
|
|
||||||
nrcNo: string;
|
|
||||||
firstName: string;
|
|
||||||
firstNameEN: string;
|
|
||||||
lastName: string;
|
|
||||||
lastNameEN: string;
|
|
||||||
dateOfBirth: Timestamp;
|
|
||||||
gender: string;
|
|
||||||
nationality: string;
|
|
||||||
address: string | null;
|
|
||||||
addressEN: string | null;
|
|
||||||
provinceId: string | null;
|
|
||||||
districtId: string | null;
|
|
||||||
subDistrictId: string | null;
|
|
||||||
zipCode: string;
|
|
||||||
passportType: string;
|
|
||||||
passportNumber: string;
|
|
||||||
passportIssueDate: Timestamp;
|
|
||||||
passportExpiryDate: Timestamp;
|
|
||||||
passportIssuingCountry: string;
|
|
||||||
passportIssuingPlace: string;
|
|
||||||
previousPassportReference: string | null;
|
|
||||||
visaType: string | null;
|
|
||||||
visaNumber: string | null;
|
|
||||||
visaIssueDate: Timestamp | null;
|
|
||||||
visaExpiryDate: Timestamp | null;
|
|
||||||
visaIssuingPlace: string | null;
|
|
||||||
visaStayUntilDate: Timestamp | null;
|
|
||||||
tm6Number: string | null;
|
|
||||||
entryDate: Timestamp | null;
|
|
||||||
workerStatus: string | null;
|
|
||||||
customerBranchId: string | null;
|
|
||||||
status: Generated<Status>;
|
|
||||||
statusOrder: Generated<number>;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type EmployeeCheckup = {
|
|
||||||
id: string;
|
|
||||||
employeeId: string;
|
|
||||||
checkupResult: string | null;
|
|
||||||
checkupType: string | null;
|
|
||||||
provinceId: string | null;
|
|
||||||
hospitalName: string | null;
|
|
||||||
remark: string | null;
|
|
||||||
medicalBenefitScheme: string | null;
|
|
||||||
insuranceCompany: string | null;
|
|
||||||
coverageStartDate: Timestamp | null;
|
|
||||||
coverageExpireDate: Timestamp | null;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type EmployeeOtherInfo = {
|
|
||||||
id: string;
|
|
||||||
employeeId: string;
|
|
||||||
citizenId: string | null;
|
|
||||||
fatherBirthPlace: string | null;
|
|
||||||
fatherFirstName: string | null;
|
|
||||||
fatherLastName: string | null;
|
|
||||||
motherBirthPlace: string | null;
|
|
||||||
motherFirstName: string | null;
|
|
||||||
motherLastName: string | null;
|
|
||||||
fatherFirstNameEN: string | null;
|
|
||||||
fatherLastNameEN: string | null;
|
|
||||||
motherFirstNameEN: string | null;
|
|
||||||
motherLastNameEN: string | null;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type EmployeeWork = {
|
|
||||||
id: string;
|
|
||||||
employeeId: string;
|
|
||||||
ownerName: string | null;
|
|
||||||
positionName: string | null;
|
|
||||||
jobType: string | null;
|
|
||||||
workplace: string | null;
|
|
||||||
workPermitNo: string | null;
|
|
||||||
workPermitIssuDate: Timestamp | null;
|
|
||||||
workPermitExpireDate: Timestamp | null;
|
|
||||||
workEndDate: Timestamp | null;
|
|
||||||
remark: string | null;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type Menu = {
|
|
||||||
id: string;
|
|
||||||
caption: string;
|
|
||||||
captionEN: string;
|
|
||||||
menuType: string;
|
|
||||||
url: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
parentId: string | null;
|
|
||||||
};
|
|
||||||
export type MenuComponent = {
|
|
||||||
id: string;
|
|
||||||
componentId: string;
|
|
||||||
componentTag: string;
|
|
||||||
menuId: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type Product = {
|
|
||||||
id: string;
|
|
||||||
code: string;
|
|
||||||
name: string;
|
|
||||||
detail: string;
|
|
||||||
process: number;
|
|
||||||
price: number;
|
|
||||||
agentPrice: number;
|
|
||||||
serviceCharge: number;
|
|
||||||
status: Generated<Status>;
|
|
||||||
statusOrder: Generated<number>;
|
|
||||||
remark: string | null;
|
|
||||||
productTypeId: string | null;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type ProductGroup = {
|
|
||||||
id: string;
|
|
||||||
code: string;
|
|
||||||
name: string;
|
|
||||||
detail: string;
|
|
||||||
remark: string;
|
|
||||||
status: Generated<Status>;
|
|
||||||
statusOrder: Generated<number>;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type ProductType = {
|
|
||||||
id: string;
|
|
||||||
code: string;
|
|
||||||
name: string;
|
|
||||||
detail: string;
|
|
||||||
remark: string;
|
|
||||||
status: Generated<Status>;
|
|
||||||
statusOrder: Generated<number>;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
productGroupId: string;
|
|
||||||
};
|
|
||||||
export type Province = {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
nameEN: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type RoleMenuComponentPermission = {
|
|
||||||
id: string;
|
|
||||||
userRole: string;
|
|
||||||
permission: string;
|
|
||||||
menuComponentId: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type RoleMenuPermission = {
|
|
||||||
id: string;
|
|
||||||
userRole: string;
|
|
||||||
permission: string;
|
|
||||||
menuId: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type RunningNo = {
|
|
||||||
key: string;
|
|
||||||
value: number;
|
|
||||||
};
|
|
||||||
export type Service = {
|
|
||||||
id: string;
|
|
||||||
code: string;
|
|
||||||
name: string;
|
|
||||||
detail: string;
|
|
||||||
attributes: unknown | null;
|
|
||||||
status: Generated<Status>;
|
|
||||||
statusOrder: Generated<number>;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type SubDistrict = {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
nameEN: string;
|
|
||||||
zipCode: string;
|
|
||||||
districtId: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type User = {
|
|
||||||
id: string;
|
|
||||||
code: string | null;
|
|
||||||
firstName: string;
|
|
||||||
firstNameEN: string;
|
|
||||||
lastName: string;
|
|
||||||
lastNameEN: string;
|
|
||||||
username: string;
|
|
||||||
gender: string;
|
|
||||||
address: string;
|
|
||||||
addressEN: string;
|
|
||||||
provinceId: string | null;
|
|
||||||
districtId: string | null;
|
|
||||||
subDistrictId: string | null;
|
|
||||||
zipCode: string;
|
|
||||||
email: string;
|
|
||||||
telephoneNo: string;
|
|
||||||
registrationNo: string | null;
|
|
||||||
startDate: Timestamp | null;
|
|
||||||
retireDate: Timestamp | null;
|
|
||||||
checkpoint: string | null;
|
|
||||||
checkpointEN: string | null;
|
|
||||||
userType: UserType;
|
|
||||||
userRole: string;
|
|
||||||
discountCondition: string | null;
|
|
||||||
licenseNo: string | null;
|
|
||||||
licenseIssueDate: Timestamp | null;
|
|
||||||
licenseExpireDate: Timestamp | null;
|
|
||||||
sourceNationality: string | null;
|
|
||||||
importNationality: string | null;
|
|
||||||
trainingPlace: string | null;
|
|
||||||
responsibleArea: string | null;
|
|
||||||
birthDate: Timestamp | null;
|
|
||||||
status: Generated<Status>;
|
|
||||||
statusOrder: Generated<number>;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type UserMenuComponentPermission = {
|
|
||||||
id: string;
|
|
||||||
userId: string;
|
|
||||||
menuComponentId: string;
|
|
||||||
permission: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type UserMenuPermission = {
|
|
||||||
id: string;
|
|
||||||
permission: string;
|
|
||||||
menuId: string;
|
|
||||||
userId: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type Work = {
|
|
||||||
id: string;
|
|
||||||
order: number;
|
|
||||||
name: string;
|
|
||||||
attributes: unknown | null;
|
|
||||||
status: Generated<Status>;
|
|
||||||
statusOrder: Generated<number>;
|
|
||||||
serviceId: string | null;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type WorkProduct = {
|
|
||||||
order: number;
|
|
||||||
workId: string;
|
|
||||||
productId: string;
|
|
||||||
createdBy: string | null;
|
|
||||||
createdAt: Generated<Timestamp>;
|
|
||||||
updateBy: string | null;
|
|
||||||
updatedAt: Timestamp;
|
|
||||||
};
|
|
||||||
export type DB = {
|
|
||||||
Branch: Branch;
|
|
||||||
BranchContact: BranchContact;
|
|
||||||
BranchUser: BranchUser;
|
|
||||||
Customer: Customer;
|
|
||||||
CustomerBranch: CustomerBranch;
|
|
||||||
District: District;
|
|
||||||
Employee: Employee;
|
|
||||||
EmployeeCheckup: EmployeeCheckup;
|
|
||||||
EmployeeOtherInfo: EmployeeOtherInfo;
|
|
||||||
EmployeeWork: EmployeeWork;
|
|
||||||
Menu: Menu;
|
|
||||||
MenuComponent: MenuComponent;
|
|
||||||
Product: Product;
|
|
||||||
ProductGroup: ProductGroup;
|
|
||||||
ProductType: ProductType;
|
|
||||||
Province: Province;
|
|
||||||
RoleMenuComponentPermission: RoleMenuComponentPermission;
|
|
||||||
RoleMenuPermission: RoleMenuPermission;
|
|
||||||
RunningNo: RunningNo;
|
|
||||||
Service: Service;
|
|
||||||
SubDistrict: SubDistrict;
|
|
||||||
User: User;
|
|
||||||
UserMenuComponentPermission: UserMenuComponentPermission;
|
|
||||||
UserMenuPermission: UserMenuPermission;
|
|
||||||
Work: Work;
|
|
||||||
WorkProduct: WorkProduct;
|
|
||||||
};
|
|
||||||
|
|
@ -4,6 +4,7 @@ generator client {
|
||||||
|
|
||||||
generator kysely {
|
generator kysely {
|
||||||
provider = "prisma-kysely"
|
provider = "prisma-kysely"
|
||||||
|
output = "../src/generated/kysely"
|
||||||
}
|
}
|
||||||
|
|
||||||
datasource db {
|
datasource db {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { PrismaClient } from "@prisma/client";
|
import { PrismaClient } from "@prisma/client";
|
||||||
import kyselyExtension from "prisma-extension-kysely";
|
|
||||||
import type { DB } from "../prisma/generated/types.ts";
|
|
||||||
import { Kysely, PostgresAdapter, PostgresIntrospector, PostgresQueryCompiler } from "kysely";
|
import { Kysely, PostgresAdapter, PostgresIntrospector, PostgresQueryCompiler } from "kysely";
|
||||||
|
import kyselyExtension from "prisma-extension-kysely";
|
||||||
|
import type { DB } from "./generated/kysely/types";
|
||||||
|
|
||||||
const prisma = new PrismaClient({
|
const prisma = new PrismaClient({
|
||||||
errorFormat: process.env.NODE_ENV === "production" ? "minimal" : "pretty",
|
errorFormat: process.env.NODE_ENV === "production" ? "minimal" : "pretty",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue