refactor!: change typo field and reset migration

This commit is contained in:
Methapon2001 2024-06-28 09:35:32 +07:00
parent d0d59cea0d
commit 0e2cc3cb21
58 changed files with 327 additions and 784 deletions

View file

@ -1,14 +0,0 @@
/*
Warnings:
- You are about to drop the column `imageUrl` on the `Customer` table. All the data in the column will be lost.
- Changed the type of `customerType` on the `Customer` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
*/
-- CreateEnum
CREATE TYPE "CustomerType" AS ENUM ('CORP', 'PERS');
-- AlterTable
ALTER TABLE "Customer" DROP COLUMN "imageUrl",
DROP COLUMN "customerType",
ADD COLUMN "customerType" "CustomerType" NOT NULL;

View file

@ -1,3 +0,0 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "birtDate" TIMESTAMP(3),
ADD COLUMN "responsibleArea" TEXT;

View file

@ -1,9 +0,0 @@
/*
Warnings:
- You are about to drop the column `birtDate` on the `User` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "User" DROP COLUMN "birtDate",
ADD COLUMN "birthDate" TIMESTAMP(3);

View file

@ -1,8 +0,0 @@
/*
Warnings:
- You are about to drop the column `keycloakId` on the `User` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "User" DROP COLUMN "keycloakId";

View file

@ -1,11 +0,0 @@
/*
Warnings:
- You are about to drop the column `lineId` on the `BranchContact` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Branch" ADD COLUMN "lineId" TEXT;
-- AlterTable
ALTER TABLE "BranchContact" DROP COLUMN "lineId";

View file

@ -1,119 +0,0 @@
/*
Warnings:
- You are about to drop the column `telephoneNo` on the `Branch` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Branch" DROP COLUMN "telephoneNo";
-- CreateTable
CREATE TABLE "Menu" (
"id" TEXT NOT NULL,
"caption" TEXT NOT NULL,
"captionEN" TEXT NOT NULL,
"menuType" TEXT NOT NULL,
"url" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
"parentId" TEXT,
CONSTRAINT "Menu_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "RoleMenuPermission" (
"id" TEXT NOT NULL,
"userRole" TEXT NOT NULL,
"permission" TEXT NOT NULL,
"menuId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "RoleMenuPermission_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "UserMenuPermission" (
"id" TEXT NOT NULL,
"permission" TEXT NOT NULL,
"menuId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "UserMenuPermission_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "MenuComponent" (
"id" TEXT NOT NULL,
"componentId" TEXT NOT NULL,
"componentTag" TEXT NOT NULL,
"menuId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "MenuComponent_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "RoleMenuComponentPermission" (
"id" TEXT NOT NULL,
"componentId" TEXT NOT NULL,
"componentTag" TEXT NOT NULL,
"menuComponentId" TEXT NOT NULL,
"permission" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "RoleMenuComponentPermission_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "UserMenuComponentPermission" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"menuComponentId" TEXT NOT NULL,
"permission" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "UserMenuComponentPermission_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Menu" ADD CONSTRAINT "Menu_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "Menu"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "RoleMenuPermission" ADD CONSTRAINT "RoleMenuPermission_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserMenuPermission" ADD CONSTRAINT "UserMenuPermission_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserMenuPermission" ADD CONSTRAINT "UserMenuPermission_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "MenuComponent" ADD CONSTRAINT "MenuComponent_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "RoleMenuComponentPermission" ADD CONSTRAINT "RoleMenuComponentPermission_menuComponentId_fkey" FOREIGN KEY ("menuComponentId") REFERENCES "MenuComponent"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserMenuComponentPermission" ADD CONSTRAINT "UserMenuComponentPermission_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserMenuComponentPermission" ADD CONSTRAINT "UserMenuComponentPermission_menuComponentId_fkey" FOREIGN KEY ("menuComponentId") REFERENCES "MenuComponent"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View file

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "Branch" ADD COLUMN "contactName" TEXT;

View file

@ -1,3 +0,0 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "checkpoint" TEXT,
ADD COLUMN "checkpointEN" TEXT;

View file

@ -1,8 +0,0 @@
/*
Warnings:
- Added the required column `username` to the `User` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "User" ADD COLUMN "username" TEXT NOT NULL;

View file

@ -1,12 +0,0 @@
/*
Warnings:
- You are about to drop the column `componentId` on the `RoleMenuComponentPermission` table. All the data in the column will be lost.
- You are about to drop the column `componentTag` on the `RoleMenuComponentPermission` table. All the data in the column will be lost.
- Added the required column `userRole` to the `RoleMenuComponentPermission` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "RoleMenuComponentPermission" DROP COLUMN "componentId",
DROP COLUMN "componentTag",
ADD COLUMN "userRole" TEXT NOT NULL;

View file

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "Branch" ADD COLUMN "telephoneHq" TEXT;

View file

@ -1,8 +0,0 @@
/*
Warnings:
- Made the column `telephoneHq` on table `Branch` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "Branch" ALTER COLUMN "telephoneHq" SET NOT NULL;

View file

@ -1,9 +0,0 @@
/*
Warnings:
- You are about to drop the column `telephoneHq` on the `Branch` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Branch" DROP COLUMN "telephoneHq",
ADD COLUMN "telephoneNo" TEXT;

View file

@ -1,8 +0,0 @@
/*
Warnings:
- Made the column `telephoneNo` on table `Branch` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "Branch" ALTER COLUMN "telephoneNo" SET NOT NULL;

View file

@ -1,10 +0,0 @@
-- CreateTable
CREATE TABLE "RunningNo" (
"key" TEXT NOT NULL,
"value" INTEGER NOT NULL,
CONSTRAINT "RunningNo_pkey" PRIMARY KEY ("key")
);
-- CreateIndex
CREATE UNIQUE INDEX "RunningNo_key_key" ON "RunningNo"("key");

View file

@ -1,28 +0,0 @@
/*
Warnings:
- You are about to drop the column `latitude` on the `CustomerBranch` table. All the data in the column will be lost.
- You are about to drop the column `longitude` on the `CustomerBranch` table. All the data in the column will be lost.
- Added the required column `bussinessType` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
- Added the required column `employmentOffice` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
- Added the required column `jobDescription` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
- Added the required column `jobPosition` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
- Added the required column `payDate` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
- Added the required column `saleEmployee` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
- Added the required column `wageDate` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Customer" ADD COLUMN "taxNo" TEXT;
-- AlterTable
ALTER TABLE "CustomerBranch" DROP COLUMN "latitude",
DROP COLUMN "longitude",
ADD COLUMN "bussinessType" TEXT NOT NULL,
ADD COLUMN "employmentOffice" TEXT NOT NULL,
ADD COLUMN "jobDescription" TEXT NOT NULL,
ADD COLUMN "jobPosition" TEXT NOT NULL,
ADD COLUMN "payDate" TEXT NOT NULL,
ADD COLUMN "saleEmployee" TEXT NOT NULL,
ADD COLUMN "wageDate" TEXT NOT NULL,
ALTER COLUMN "taxNo" DROP NOT NULL;

View file

@ -1,10 +0,0 @@
/*
Warnings:
- Added the required column `bussinessTypeEN` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
- Added the required column `jobPositionEN` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "CustomerBranch" ADD COLUMN "bussinessTypeEN" TEXT NOT NULL,
ADD COLUMN "jobPositionEN" TEXT NOT NULL;

View file

@ -1,15 +0,0 @@
/*
Warnings:
- Changed the type of `branchNo` on the `CustomerBranch` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
- Changed the type of `payDate` on the `CustomerBranch` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
- Changed the type of `wageDate` on the `CustomerBranch` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
*/
-- AlterTable
ALTER TABLE "CustomerBranch" DROP COLUMN "branchNo",
ADD COLUMN "branchNo" INTEGER NOT NULL,
DROP COLUMN "payDate",
ADD COLUMN "payDate" TIMESTAMP(3) NOT NULL,
DROP COLUMN "wageDate",
ADD COLUMN "wageDate" TIMESTAMP(3) NOT NULL;

View file

@ -1,10 +0,0 @@
/*
Warnings:
- You are about to drop the column `wageDate` on the `CustomerBranch` table. All the data in the column will be lost.
- Added the required column `wageRate` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "CustomerBranch" DROP COLUMN "wageDate",
ADD COLUMN "wageRate" INTEGER NOT NULL;

View file

@ -1,30 +0,0 @@
/*
Warnings:
- You are about to drop the column `birthPlace` on the `EmployeeOtherInfo` table. All the data in the column will be lost.
- You are about to drop the column `fatherFullName` on the `EmployeeOtherInfo` table. All the data in the column will be lost.
- You are about to drop the column `motherFullName` on the `EmployeeOtherInfo` table. All the data in the column will be lost.
- Added the required column `birthPlaceEN` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty.
- Added the required column `fatherFirstName` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty.
- Added the required column `fatherFirstNameEN` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty.
- Added the required column `fatherLastName` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty.
- Added the required column `fatherLastNameEN` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty.
- Added the required column `motherFirstName` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty.
- Added the required column `motherFirstNameEN` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty.
- Added the required column `motherLastName` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty.
- Added the required column `motherLastNameEN` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "EmployeeOtherInfo" DROP COLUMN "birthPlace",
DROP COLUMN "fatherFullName",
DROP COLUMN "motherFullName",
ADD COLUMN "birthPlaceEN" TEXT NOT NULL,
ADD COLUMN "fatherFirstName" TEXT NOT NULL,
ADD COLUMN "fatherFirstNameEN" TEXT NOT NULL,
ADD COLUMN "fatherLastName" TEXT NOT NULL,
ADD COLUMN "fatherLastNameEN" TEXT NOT NULL,
ADD COLUMN "motherFirstName" TEXT NOT NULL,
ADD COLUMN "motherFirstNameEN" TEXT NOT NULL,
ADD COLUMN "motherLastName" TEXT NOT NULL,
ADD COLUMN "motherLastNameEN" TEXT NOT NULL;

View file

@ -1,10 +0,0 @@
/*
Warnings:
- You are about to drop the column `birthPlaceEN` on the `EmployeeOtherInfo` table. All the data in the column will be lost.
- Added the required column `birthPlace` to the `EmployeeOtherInfo` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "EmployeeOtherInfo" DROP COLUMN "birthPlaceEN",
ADD COLUMN "birthPlace" TEXT NOT NULL;

View file

@ -1,11 +0,0 @@
/*
Warnings:
- You are about to drop the column `imageUrl` on the `Product` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "EmployeeWork" ADD COLUMN "remark" TEXT;
-- AlterTable
ALTER TABLE "Product" DROP COLUMN "imageUrl";

View file

@ -1,45 +0,0 @@
/*
Warnings:
- You are about to drop the column `arrivalBarricade` on the `Employee` table. All the data in the column will be lost.
- You are about to drop the column `arrivalCardNo` on the `Employee` table. All the data in the column will be lost.
- You are about to drop the column `email` on the `Employee` table. All the data in the column will be lost.
- You are about to drop the column `telephoneNo` on the `Employee` table. All the data in the column will be lost.
- Added the required column `entryDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportExpiryDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportIssueDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportIssuingCountry` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportIssuingPlace` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportNumber` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportType` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `tm6Number` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaExpiryDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaIssueDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaIssuingPlace` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaNumber` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaStayUntilDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaType` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `workerStatus` to the `Employee` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Employee" DROP COLUMN "arrivalBarricade",
DROP COLUMN "arrivalCardNo",
DROP COLUMN "email",
DROP COLUMN "telephoneNo",
ADD COLUMN "entryDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "passportExpiryDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "passportIssueDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "passportIssuingCountry" TEXT NOT NULL,
ADD COLUMN "passportIssuingPlace" TEXT NOT NULL,
ADD COLUMN "passportNumber" TEXT NOT NULL,
ADD COLUMN "passportType" TEXT NOT NULL,
ADD COLUMN "previousPassportReference" TEXT,
ADD COLUMN "tm6Number" TEXT NOT NULL,
ADD COLUMN "visaExpiryDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "visaIssueDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "visaIssuingPlace" TEXT NOT NULL,
ADD COLUMN "visaNumber" TEXT NOT NULL,
ADD COLUMN "visaStayUntilDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "visaType" TEXT NOT NULL,
ADD COLUMN "workerStatus" TEXT NOT NULL;

View file

@ -1,31 +0,0 @@
-- AlterTable
ALTER TABLE "EmployeeCheckup" ALTER COLUMN "checkupResult" DROP NOT NULL,
ALTER COLUMN "checkupType" DROP NOT NULL,
ALTER COLUMN "hospitalName" DROP NOT NULL,
ALTER COLUMN "remark" DROP NOT NULL,
ALTER COLUMN "medicalBenefitScheme" DROP NOT NULL,
ALTER COLUMN "insuranceCompany" DROP NOT NULL,
ALTER COLUMN "coverageStartDate" DROP NOT NULL,
ALTER COLUMN "coverageExpireDate" DROP NOT NULL;
-- AlterTable
ALTER TABLE "EmployeeOtherInfo" ALTER COLUMN "citizenId" DROP NOT NULL,
ALTER COLUMN "fatherFirstName" DROP NOT NULL,
ALTER COLUMN "fatherFirstNameEN" DROP NOT NULL,
ALTER COLUMN "fatherLastName" DROP NOT NULL,
ALTER COLUMN "fatherLastNameEN" DROP NOT NULL,
ALTER COLUMN "motherFirstName" DROP NOT NULL,
ALTER COLUMN "motherFirstNameEN" DROP NOT NULL,
ALTER COLUMN "motherLastName" DROP NOT NULL,
ALTER COLUMN "motherLastNameEN" DROP NOT NULL,
ALTER COLUMN "birthPlace" DROP NOT NULL;
-- AlterTable
ALTER TABLE "EmployeeWork" ALTER COLUMN "ownerName" DROP NOT NULL,
ALTER COLUMN "positionName" DROP NOT NULL,
ALTER COLUMN "jobType" DROP NOT NULL,
ALTER COLUMN "workplace" DROP NOT NULL,
ALTER COLUMN "workPermitNo" DROP NOT NULL,
ALTER COLUMN "workPermitIssuDate" DROP NOT NULL,
ALTER COLUMN "workPermitExpireDate" DROP NOT NULL,
ALTER COLUMN "workEndDate" DROP NOT NULL;

View file

@ -1,10 +0,0 @@
/*
Warnings:
- You are about to drop the column `birthPlace` on the `EmployeeOtherInfo` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "EmployeeOtherInfo" DROP COLUMN "birthPlace",
ADD COLUMN "fatherBirthPlace" TEXT,
ADD COLUMN "motherBirthPlace" TEXT;

View file

@ -1,25 +0,0 @@
/*
Warnings:
- You are about to drop the column `productGroupId` on the `Product` table. All the data in the column will be lost.
- Added the required column `productGroupId` to the `ProductType` table without a default value. This is not possible if the table is not empty.
- Added the required column `productId` to the `WorkProduct` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Product" DROP CONSTRAINT "Product_productGroupId_fkey";
-- AlterTable
ALTER TABLE "Product" DROP COLUMN "productGroupId";
-- AlterTable
ALTER TABLE "ProductType" ADD COLUMN "productGroupId" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "WorkProduct" ADD COLUMN "productId" TEXT NOT NULL;
-- AddForeignKey
ALTER TABLE "WorkProduct" ADD CONSTRAINT "WorkProduct_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ProductType" ADD CONSTRAINT "ProductType_productGroupId_fkey" FOREIGN KEY ("productGroupId") REFERENCES "ProductGroup"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View file

@ -1,11 +0,0 @@
/*
Warnings:
- Added the required column `code` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "CustomerBranch" ADD COLUMN "code" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "Product" ADD COLUMN "attributes" JSONB;

View file

@ -1,36 +0,0 @@
/*
Warnings:
- You are about to drop the column `serviceId` on the `Work` table. All the data in the column will be lost.
- Added the required column `order` to the `WorkProduct` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Work" DROP CONSTRAINT "Work_serviceId_fkey";
-- AlterTable
ALTER TABLE "Work" DROP COLUMN "serviceId";
-- AlterTable
ALTER TABLE "WorkProduct" ADD COLUMN "order" INTEGER NOT NULL;
-- CreateTable
CREATE TABLE "WorkService" (
"id" TEXT NOT NULL,
"order" INTEGER NOT NULL,
"workId" TEXT NOT NULL,
"serviceId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
"productId" TEXT,
CONSTRAINT "WorkService_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "WorkService" ADD CONSTRAINT "WorkService_workId_fkey" FOREIGN KEY ("workId") REFERENCES "Work"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "WorkService" ADD CONSTRAINT "WorkService_serviceId_fkey" FOREIGN KEY ("serviceId") REFERENCES "Service"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View file

@ -1,8 +0,0 @@
/*
Warnings:
- You are about to drop the column `order` on the `Work` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Work" DROP COLUMN "order";

View file

@ -1,18 +0,0 @@
/*
Warnings:
- The primary key for the `WorkProduct` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `id` on the `WorkProduct` table. All the data in the column will be lost.
- The primary key for the `WorkService` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `id` on the `WorkService` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "WorkProduct" DROP CONSTRAINT "WorkProduct_pkey",
DROP COLUMN "id",
ADD CONSTRAINT "WorkProduct_pkey" PRIMARY KEY ("workId", "productId");
-- AlterTable
ALTER TABLE "WorkService" DROP CONSTRAINT "WorkService_pkey",
DROP COLUMN "id",
ADD CONSTRAINT "WorkService_pkey" PRIMARY KEY ("workId", "serviceId");

View file

@ -1,12 +0,0 @@
-- AlterTable
ALTER TABLE "Employee" ALTER COLUMN "address" DROP NOT NULL,
ALTER COLUMN "addressEN" DROP NOT NULL,
ALTER COLUMN "entryDate" DROP NOT NULL,
ALTER COLUMN "tm6Number" DROP NOT NULL,
ALTER COLUMN "visaExpiryDate" DROP NOT NULL,
ALTER COLUMN "visaIssueDate" DROP NOT NULL,
ALTER COLUMN "visaIssuingPlace" DROP NOT NULL,
ALTER COLUMN "visaNumber" DROP NOT NULL,
ALTER COLUMN "visaStayUntilDate" DROP NOT NULL,
ALTER COLUMN "visaType" DROP NOT NULL,
ALTER COLUMN "workerStatus" DROP NOT NULL;

View file

@ -1,14 +0,0 @@
/*
Warnings:
- You are about to drop the column `attributes` on the `Product` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Product" DROP COLUMN "attributes";
-- AlterTable
ALTER TABLE "Service" ADD COLUMN "attributes" JSONB;
-- AlterTable
ALTER TABLE "Work" ADD COLUMN "attributes" JSONB;

View file

@ -1,8 +0,0 @@
/*
Warnings:
- You are about to drop the column `productId` on the `WorkService` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "WorkService" DROP COLUMN "productId";

View file

@ -1,22 +0,0 @@
/*
Warnings:
- You are about to drop the `WorkService` table. If the table is not empty, all the data it contains will be lost.
- Added the required column `order` to the `Work` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "WorkService" DROP CONSTRAINT "WorkService_serviceId_fkey";
-- DropForeignKey
ALTER TABLE "WorkService" DROP CONSTRAINT "WorkService_workId_fkey";
-- AlterTable
ALTER TABLE "Work" ADD COLUMN "order" INTEGER NOT NULL,
ADD COLUMN "serviceId" TEXT;
-- DropTable
DROP TABLE "WorkService";
-- AddForeignKey
ALTER TABLE "Work" ADD CONSTRAINT "Work_serviceId_fkey" FOREIGN KEY ("serviceId") REFERENCES "Service"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View file

@ -1,10 +0,0 @@
/*
Warnings:
- Changed the type of `process` on the `Product` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
*/
-- AlterTable
ALTER TABLE "Product" ADD COLUMN "remark" TEXT,
DROP COLUMN "process",
ADD COLUMN "process" INTEGER NOT NULL;

View file

@ -1,9 +0,0 @@
/*
Warnings:
- Added the required column `personName` to the `Customer` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Customer" ADD COLUMN "personName" TEXT NOT NULL,
ADD COLUMN "personNameEN" TEXT;

View file

@ -1,29 +0,0 @@
-- AlterTable
ALTER TABLE "Branch" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0;
-- AlterTable
ALTER TABLE "Customer" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0;
-- AlterTable
ALTER TABLE "CustomerBranch" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0;
-- AlterTable
ALTER TABLE "Employee" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0;
-- AlterTable
ALTER TABLE "Product" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0;
-- AlterTable
ALTER TABLE "ProductGroup" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0;
-- AlterTable
ALTER TABLE "ProductType" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0;
-- AlterTable
ALTER TABLE "Service" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0;
-- AlterTable
ALTER TABLE "User" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0;
-- AlterTable
ALTER TABLE "Work" ADD COLUMN "statusOrder" INTEGER NOT NULL DEFAULT 0;

View file

@ -1,4 +0,0 @@
-- AlterTable
ALTER TABLE "Product" ALTER COLUMN "price" SET DATA TYPE DOUBLE PRECISION,
ALTER COLUMN "agentPrice" SET DATA TYPE DOUBLE PRECISION,
ALTER COLUMN "serviceCharge" SET DATA TYPE DOUBLE PRECISION;

View file

@ -1,14 +0,0 @@
-- CreateTable
CREATE TABLE "EmployeeHistory" (
"id" TEXT NOT NULL,
"field" TEXT NOT NULL,
"valueBefore" JSONB NOT NULL,
"valueAfter" JSONB NOT NULL,
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"masterId" TEXT NOT NULL,
CONSTRAINT "EmployeeHistory_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "EmployeeHistory" ADD CONSTRAINT "EmployeeHistory_masterId_fkey" FOREIGN KEY ("masterId") REFERENCES "Employee"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View file

@ -1,7 +0,0 @@
-- AlterTable
ALTER TABLE "EmployeeHistory" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "updatedBy" TEXT,
ADD COLUMN "updatedByUserId" TEXT;
-- AddForeignKey
ALTER TABLE "EmployeeHistory" ADD CONSTRAINT "EmployeeHistory_updatedByUserId_fkey" FOREIGN KEY ("updatedByUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View file

@ -4,6 +4,103 @@ CREATE TYPE "Status" AS ENUM ('CREATED', 'ACTIVE', 'INACTIVE');
-- CreateEnum
CREATE TYPE "UserType" AS ENUM ('USER', 'MESSENGER', 'DELEGATE', 'AGENCY');
-- CreateEnum
CREATE TYPE "CustomerType" AS ENUM ('CORP', 'PERS');
-- CreateTable
CREATE TABLE "Menu" (
"id" TEXT NOT NULL,
"caption" TEXT NOT NULL,
"captionEN" TEXT NOT NULL,
"menuType" TEXT NOT NULL,
"url" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
"parentId" TEXT,
CONSTRAINT "Menu_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "RoleMenuPermission" (
"id" TEXT NOT NULL,
"userRole" TEXT NOT NULL,
"permission" TEXT NOT NULL,
"menuId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "RoleMenuPermission_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "UserMenuPermission" (
"id" TEXT NOT NULL,
"permission" TEXT NOT NULL,
"menuId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "UserMenuPermission_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "MenuComponent" (
"id" TEXT NOT NULL,
"componentId" TEXT NOT NULL,
"componentTag" TEXT NOT NULL,
"menuId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "MenuComponent_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "RoleMenuComponentPermission" (
"id" TEXT NOT NULL,
"userRole" TEXT NOT NULL,
"permission" TEXT NOT NULL,
"menuComponentId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "RoleMenuComponentPermission_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "RunningNo" (
"key" TEXT NOT NULL,
"value" INTEGER NOT NULL,
CONSTRAINT "RunningNo_pkey" PRIMARY KEY ("key")
);
-- CreateTable
CREATE TABLE "UserMenuComponentPermission" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"menuComponentId" TEXT NOT NULL,
"permission" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "UserMenuComponentPermission_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Province" (
"id" TEXT NOT NULL,
@ -11,7 +108,7 @@ CREATE TABLE "Province" (
"nameEN" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Province_pkey" PRIMARY KEY ("id")
@ -25,7 +122,7 @@ CREATE TABLE "District" (
"provinceId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "District_pkey" PRIMARY KEY ("id")
@ -40,7 +137,7 @@ CREATE TABLE "SubDistrict" (
"districtId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "SubDistrict_pkey" PRIMARY KEY ("id")
@ -55,20 +152,23 @@ CREATE TABLE "Branch" (
"nameEN" TEXT NOT NULL,
"address" TEXT NOT NULL,
"addressEN" TEXT NOT NULL,
"telephoneNo" TEXT NOT NULL,
"provinceId" TEXT,
"districtId" TEXT,
"subDistrictId" TEXT,
"zipCode" TEXT NOT NULL,
"email" TEXT NOT NULL,
"telephoneNo" TEXT NOT NULL,
"contactName" TEXT,
"lineId" TEXT,
"latitude" TEXT NOT NULL,
"longitude" TEXT NOT NULL,
"isHeadOffice" BOOLEAN NOT NULL DEFAULT false,
"headOfficeId" TEXT,
"status" "Status" NOT NULL DEFAULT 'CREATED',
"statusOrder" INTEGER NOT NULL DEFAULT 0,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Branch_pkey" PRIMARY KEY ("id")
@ -78,11 +178,10 @@ CREATE TABLE "Branch" (
CREATE TABLE "BranchContact" (
"id" TEXT NOT NULL,
"telephoneNo" TEXT NOT NULL,
"lineId" TEXT NOT NULL,
"branchId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "BranchContact_pkey" PRIMARY KEY ("id")
@ -95,7 +194,7 @@ CREATE TABLE "BranchUser" (
"userId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "BranchUser_pkey" PRIMARY KEY ("id")
@ -104,12 +203,12 @@ CREATE TABLE "BranchUser" (
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"keycloakId" TEXT NOT NULL,
"code" TEXT,
"firstName" TEXT NOT NULL,
"firstNameEN" TEXT NOT NULL,
"lastName" TEXT NOT NULL,
"lastNameEN" TEXT NOT NULL,
"username" TEXT NOT NULL,
"gender" TEXT NOT NULL,
"address" TEXT NOT NULL,
"addressEN" TEXT NOT NULL,
@ -122,6 +221,8 @@ CREATE TABLE "User" (
"registrationNo" TEXT,
"startDate" TIMESTAMP(3),
"retireDate" TIMESTAMP(3),
"checkpoint" TEXT,
"checkpointEN" TEXT,
"userType" "UserType" NOT NULL,
"userRole" TEXT NOT NULL,
"discountCondition" TEXT,
@ -131,10 +232,13 @@ CREATE TABLE "User" (
"sourceNationality" TEXT,
"importNationality" TEXT,
"trainingPlace" TEXT,
"responsibleArea" TEXT,
"birthDate" TIMESTAMP(3),
"status" "Status" NOT NULL DEFAULT 'CREATED',
"statusOrder" INTEGER NOT NULL DEFAULT 0,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
@ -144,14 +248,17 @@ CREATE TABLE "User" (
CREATE TABLE "Customer" (
"id" TEXT NOT NULL,
"code" TEXT NOT NULL,
"customerType" TEXT NOT NULL,
"personName" TEXT NOT NULL,
"personNameEN" TEXT,
"customerType" "CustomerType" NOT NULL,
"customerName" TEXT NOT NULL,
"customerNameEN" TEXT NOT NULL,
"imageUrl" TEXT,
"taxNo" TEXT,
"status" "Status" NOT NULL DEFAULT 'CREATED',
"statusOrder" INTEGER NOT NULL DEFAULT 0,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Customer_pkey" PRIMARY KEY ("id")
@ -160,12 +267,13 @@ CREATE TABLE "Customer" (
-- CreateTable
CREATE TABLE "CustomerBranch" (
"id" TEXT NOT NULL,
"branchNo" TEXT NOT NULL,
"branchNo" INTEGER NOT NULL,
"code" TEXT NOT NULL,
"legalPersonNo" TEXT NOT NULL,
"name" TEXT NOT NULL,
"nameEN" TEXT NOT NULL,
"customerId" TEXT NOT NULL,
"taxNo" TEXT NOT NULL,
"taxNo" TEXT,
"registerName" TEXT NOT NULL,
"registerDate" TIMESTAMP(3) NOT NULL,
"authorizedCapital" TEXT NOT NULL,
@ -177,12 +285,20 @@ CREATE TABLE "CustomerBranch" (
"zipCode" TEXT NOT NULL,
"email" TEXT NOT NULL,
"telephoneNo" TEXT NOT NULL,
"latitude" TEXT NOT NULL,
"longitude" TEXT NOT NULL,
"employmentOffice" TEXT NOT NULL,
"bussinessType" TEXT NOT NULL,
"bussinessTypeEN" TEXT NOT NULL,
"jobPosition" TEXT NOT NULL,
"jobPositionEN" TEXT NOT NULL,
"jobDescription" TEXT NOT NULL,
"saleEmployee" TEXT NOT NULL,
"payDate" TIMESTAMP(3) NOT NULL,
"wageRate" INTEGER NOT NULL,
"status" "Status" NOT NULL DEFAULT 'CREATED',
"statusOrder" INTEGER NOT NULL DEFAULT 0,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "CustomerBranch_pkey" PRIMARY KEY ("id")
@ -200,42 +316,70 @@ CREATE TABLE "Employee" (
"dateOfBirth" TIMESTAMP(3) NOT NULL,
"gender" TEXT NOT NULL,
"nationality" TEXT NOT NULL,
"address" TEXT NOT NULL,
"addressEN" TEXT NOT NULL,
"address" TEXT,
"addressEN" TEXT,
"provinceId" TEXT,
"districtId" TEXT,
"subDistrictId" TEXT,
"zipCode" TEXT NOT NULL,
"email" TEXT NOT NULL,
"telephoneNo" TEXT NOT NULL,
"arrivalBarricade" TEXT NOT NULL,
"arrivalCardNo" TEXT NOT NULL,
"passportType" TEXT NOT NULL,
"passportNumber" TEXT NOT NULL,
"passportIssueDate" TIMESTAMP(3) NOT NULL,
"passportExpiryDate" TIMESTAMP(3) NOT NULL,
"passportIssuingCountry" TEXT NOT NULL,
"passportIssuingPlace" TEXT NOT NULL,
"previousPassportReference" TEXT,
"visaType" TEXT,
"visaNumber" TEXT,
"visaIssueDate" TIMESTAMP(3),
"visaExpiryDate" TIMESTAMP(3),
"visaIssuingPlace" TEXT,
"visaStayUntilDate" TIMESTAMP(3),
"tm6Number" TEXT,
"entryDate" TIMESTAMP(3),
"workerStatus" TEXT,
"customerBranchId" TEXT,
"status" "Status" NOT NULL DEFAULT 'CREATED',
"statusOrder" INTEGER NOT NULL DEFAULT 0,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Employee_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "EmployeeHistory" (
"id" TEXT NOT NULL,
"field" TEXT NOT NULL,
"valueBefore" JSONB NOT NULL,
"valueAfter" JSONB NOT NULL,
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedByUserId" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"masterId" TEXT NOT NULL,
CONSTRAINT "EmployeeHistory_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "EmployeeCheckup" (
"id" TEXT NOT NULL,
"employeeId" TEXT NOT NULL,
"checkupResult" TEXT NOT NULL,
"checkupType" TEXT NOT NULL,
"checkupResult" TEXT,
"checkupType" TEXT,
"provinceId" TEXT,
"hospitalName" TEXT NOT NULL,
"remark" TEXT NOT NULL,
"medicalBenefitScheme" TEXT NOT NULL,
"insuranceCompany" TEXT NOT NULL,
"coverageStartDate" TIMESTAMP(3) NOT NULL,
"coverageExpireDate" TIMESTAMP(3) NOT NULL,
"hospitalName" TEXT,
"remark" TEXT,
"medicalBenefitScheme" TEXT,
"insuranceCompany" TEXT,
"coverageStartDate" TIMESTAMP(3),
"coverageExpireDate" TIMESTAMP(3),
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "EmployeeCheckup_pkey" PRIMARY KEY ("id")
@ -245,17 +389,18 @@ CREATE TABLE "EmployeeCheckup" (
CREATE TABLE "EmployeeWork" (
"id" TEXT NOT NULL,
"employeeId" TEXT NOT NULL,
"ownerName" TEXT NOT NULL,
"positionName" TEXT NOT NULL,
"jobType" TEXT NOT NULL,
"workplace" TEXT NOT NULL,
"workPermitNo" TEXT NOT NULL,
"workPermitIssuDate" TIMESTAMP(3) NOT NULL,
"workPermitExpireDate" TIMESTAMP(3) NOT NULL,
"workEndDate" TIMESTAMP(3) NOT NULL,
"ownerName" TEXT,
"positionName" TEXT,
"jobType" TEXT,
"workplace" TEXT,
"workPermitNo" TEXT,
"workPermitIssuDate" TIMESTAMP(3),
"workPermitExpireDate" TIMESTAMP(3),
"workEndDate" TIMESTAMP(3),
"remark" TEXT,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "EmployeeWork_pkey" PRIMARY KEY ("id")
@ -265,13 +410,20 @@ CREATE TABLE "EmployeeWork" (
CREATE TABLE "EmployeeOtherInfo" (
"id" TEXT NOT NULL,
"employeeId" TEXT NOT NULL,
"citizenId" TEXT NOT NULL,
"fatherFullName" TEXT NOT NULL,
"motherFullName" TEXT NOT NULL,
"birthPlace" TEXT NOT NULL,
"citizenId" TEXT,
"fatherBirthPlace" TEXT,
"fatherFirstName" TEXT,
"fatherLastName" TEXT,
"motherBirthPlace" TEXT,
"motherFirstName" TEXT,
"motherLastName" TEXT,
"fatherFirstNameEN" TEXT,
"fatherLastNameEN" TEXT,
"motherFirstNameEN" TEXT,
"motherLastNameEN" TEXT,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "EmployeeOtherInfo_pkey" PRIMARY KEY ("id")
@ -283,10 +435,12 @@ CREATE TABLE "Service" (
"code" TEXT NOT NULL,
"name" TEXT NOT NULL,
"detail" TEXT NOT NULL,
"attributes" JSONB,
"status" "Status" NOT NULL DEFAULT 'CREATED',
"statusOrder" INTEGER NOT NULL DEFAULT 0,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Service_pkey" PRIMARY KEY ("id")
@ -297,11 +451,13 @@ CREATE TABLE "Work" (
"id" TEXT NOT NULL,
"order" INTEGER NOT NULL,
"name" TEXT NOT NULL,
"serviceId" TEXT NOT NULL,
"attributes" JSONB,
"status" "Status" NOT NULL DEFAULT 'CREATED',
"statusOrder" INTEGER NOT NULL DEFAULT 0,
"serviceId" TEXT,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Work_pkey" PRIMARY KEY ("id")
@ -309,14 +465,15 @@ CREATE TABLE "Work" (
-- CreateTable
CREATE TABLE "WorkProduct" (
"id" TEXT NOT NULL,
"order" INTEGER NOT NULL,
"workId" TEXT NOT NULL,
"productId" TEXT NOT NULL,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "WorkProduct_pkey" PRIMARY KEY ("id")
CONSTRAINT "WorkProduct_pkey" PRIMARY KEY ("workId","productId")
);
-- CreateTable
@ -327,9 +484,10 @@ CREATE TABLE "ProductGroup" (
"detail" TEXT NOT NULL,
"remark" TEXT NOT NULL,
"status" "Status" NOT NULL DEFAULT 'CREATED',
"statusOrder" INTEGER NOT NULL DEFAULT 0,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ProductGroup_pkey" PRIMARY KEY ("id")
@ -343,10 +501,12 @@ CREATE TABLE "ProductType" (
"detail" TEXT NOT NULL,
"remark" TEXT NOT NULL,
"status" "Status" NOT NULL DEFAULT 'CREATED',
"statusOrder" INTEGER NOT NULL DEFAULT 0,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
"productGroupId" TEXT NOT NULL,
CONSTRAINT "ProductType_pkey" PRIMARY KEY ("id")
);
@ -357,22 +517,49 @@ CREATE TABLE "Product" (
"code" TEXT NOT NULL,
"name" TEXT NOT NULL,
"detail" TEXT NOT NULL,
"process" TEXT NOT NULL,
"price" INTEGER NOT NULL,
"agentPrice" INTEGER NOT NULL,
"serviceCharge" INTEGER NOT NULL,
"imageUrl" TEXT NOT NULL,
"process" INTEGER NOT NULL,
"price" DOUBLE PRECISION NOT NULL,
"agentPrice" DOUBLE PRECISION NOT NULL,
"serviceCharge" DOUBLE PRECISION NOT NULL,
"status" "Status" NOT NULL DEFAULT 'CREATED',
"statusOrder" INTEGER NOT NULL DEFAULT 0,
"remark" TEXT,
"productTypeId" TEXT,
"productGroupId" TEXT,
"createdBy" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateBy" TEXT,
"updatedBy" TEXT,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Product_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "RunningNo_key_key" ON "RunningNo"("key");
-- AddForeignKey
ALTER TABLE "Menu" ADD CONSTRAINT "Menu_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "Menu"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "RoleMenuPermission" ADD CONSTRAINT "RoleMenuPermission_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserMenuPermission" ADD CONSTRAINT "UserMenuPermission_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserMenuPermission" ADD CONSTRAINT "UserMenuPermission_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "MenuComponent" ADD CONSTRAINT "MenuComponent_menuId_fkey" FOREIGN KEY ("menuId") REFERENCES "Menu"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "RoleMenuComponentPermission" ADD CONSTRAINT "RoleMenuComponentPermission_menuComponentId_fkey" FOREIGN KEY ("menuComponentId") REFERENCES "MenuComponent"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserMenuComponentPermission" ADD CONSTRAINT "UserMenuComponentPermission_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserMenuComponentPermission" ADD CONSTRAINT "UserMenuComponentPermission_menuComponentId_fkey" FOREIGN KEY ("menuComponentId") REFERENCES "MenuComponent"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "District" ADD CONSTRAINT "District_provinceId_fkey" FOREIGN KEY ("provinceId") REFERENCES "Province"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@ -433,6 +620,12 @@ ALTER TABLE "Employee" ADD CONSTRAINT "Employee_subDistrictId_fkey" FOREIGN KEY
-- AddForeignKey
ALTER TABLE "Employee" ADD CONSTRAINT "Employee_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "EmployeeHistory" ADD CONSTRAINT "EmployeeHistory_updatedByUserId_fkey" FOREIGN KEY ("updatedByUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "EmployeeHistory" ADD CONSTRAINT "EmployeeHistory_masterId_fkey" FOREIGN KEY ("masterId") REFERENCES "Employee"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "EmployeeCheckup" ADD CONSTRAINT "EmployeeCheckup_employeeId_fkey" FOREIGN KEY ("employeeId") REFERENCES "Employee"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@ -452,7 +645,10 @@ ALTER TABLE "Work" ADD CONSTRAINT "Work_serviceId_fkey" FOREIGN KEY ("serviceId"
ALTER TABLE "WorkProduct" ADD CONSTRAINT "WorkProduct_workId_fkey" FOREIGN KEY ("workId") REFERENCES "Work"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Product" ADD CONSTRAINT "Product_productTypeId_fkey" FOREIGN KEY ("productTypeId") REFERENCES "ProductType"("id") ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE "WorkProduct" ADD CONSTRAINT "WorkProduct_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Product" ADD CONSTRAINT "Product_productGroupId_fkey" FOREIGN KEY ("productGroupId") REFERENCES "ProductGroup"("id") ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE "ProductType" ADD CONSTRAINT "ProductType_productGroupId_fkey" FOREIGN KEY ("productGroupId") REFERENCES "ProductGroup"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Product" ADD CONSTRAINT "Product_productTypeId_fkey" FOREIGN KEY ("productTypeId") REFERENCES "ProductType"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View file

@ -22,7 +22,7 @@ model Menu {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
parent Menu? @relation(name: "MenuRelation", fields: [parentId], references: [id])
@ -45,7 +45,7 @@ model RoleMenuPermission {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
}
@ -62,7 +62,7 @@ model UserMenuPermission {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
}
@ -77,7 +77,7 @@ model MenuComponent {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
roleMenuComponentPermission RoleMenuComponentPermission[]
userMennuComponentPermission UserMenuComponentPermission[]
@ -94,7 +94,7 @@ model RoleMenuComponentPermission {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
}
@ -116,7 +116,7 @@ model UserMenuComponentPermission {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
}
@ -127,7 +127,7 @@ model Province {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
district District[]
@ -148,7 +148,7 @@ model District {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
subDistrict SubDistrict[]
@ -169,7 +169,7 @@ model SubDistrict {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
branch Branch[]
@ -222,7 +222,7 @@ model Branch {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
branch Branch[] @relation(name: "HeadOfficeRelation")
@ -239,7 +239,7 @@ model BranchContact {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
}
@ -254,7 +254,7 @@ model BranchUser {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
}
@ -323,7 +323,7 @@ model User {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
branch BranchUser[]
@ -352,7 +352,7 @@ model Customer {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
branch CustomerBranch[]
@ -407,7 +407,7 @@ model CustomerBranch {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
employee Employee[]
@ -467,7 +467,7 @@ model Employee {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
employeeCheckup EmployeeCheckup[]
@ -515,7 +515,7 @@ model EmployeeCheckup {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
}
@ -537,7 +537,7 @@ model EmployeeWork {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
}
@ -562,7 +562,7 @@ model EmployeeOtherInfo {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
}
@ -581,7 +581,7 @@ model Service {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
}
@ -600,7 +600,7 @@ model Work {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
productOnWork WorkProduct[]
@ -615,7 +615,7 @@ model WorkProduct {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
@@id([workId, productId])
@ -634,7 +634,7 @@ model ProductGroup {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
type ProductType[]
@ -653,7 +653,7 @@ model ProductType {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
productGroup ProductGroup @relation(fields: [productGroupId], references: [id], onDelete: Cascade)
@ -685,6 +685,6 @@ model Product {
createdBy String?
createdAt DateTime @default(now())
updateBy String?
updatedBy String?
updatedAt DateTime @updatedAt
}

View file

@ -79,7 +79,7 @@ export class BranchContactController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "Branch cannot be found.", "branchBadReq");
}
const record = await prisma.branchContact.create({
data: { ...body, branchId, createdBy: req.user.name, updateBy: req.user.name },
data: { ...body, branchId, createdBy: req.user.name, updatedBy: req.user.name },
});
this.setStatus(HttpStatus.CREATED);
@ -107,7 +107,7 @@ export class BranchContactController extends Controller {
}
const record = await prisma.branchContact.update({
data: { ...body, updateBy: req.user.name },
data: { ...body, updatedBy: req.user.name },
where: { id: contactId, branchId },
});

View file

@ -287,7 +287,7 @@ export class BranchController extends Controller {
subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined },
headOffice: { connect: headOfficeId ? { id: headOfficeId } : undefined },
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
},
@ -403,7 +403,7 @@ export class BranchController extends Controller {
connect: headOfficeId ? { id: headOfficeId } : undefined,
disconnect: headOfficeId === null || undefined,
},
updateBy: req.user.name,
updatedBy: req.user.name,
},
where: { id: branchId },
});

View file

@ -140,7 +140,7 @@ export class BranchUserController extends Controller {
branchId,
userId: v.id,
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
})),
}),
]);
@ -250,7 +250,7 @@ export class UserBranchController extends Controller {
branchId: v.id,
userId,
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
})),
});

View file

@ -295,7 +295,7 @@ export class CustomerBranchController extends Controller {
district: { connect: districtId ? { id: districtId } : undefined },
subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined },
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
},
@ -381,7 +381,7 @@ export class CustomerBranchController extends Controller {
disconnect: subDistrictId === null || undefined,
},
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});

View file

@ -306,12 +306,12 @@ export class CustomerController extends Controller {
branchNo: i + 1,
code: `${last.key.slice(9)}${last.value.toString().padStart(6, "0")}-${(i + 1).toString().padStart(2, "0")}`,
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
})) || [],
},
},
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
},
@ -437,19 +437,19 @@ export class CustomerController extends Controller {
branchNo: i + 1,
code: `${customer.code}-${(i + 1).toString().padStart(2, "0")}`,
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
id: undefined,
},
update: {
...v,
branchNo: i + 1,
code: `${customer.code}-${(i + 1).toString().padStart(2, "0")}`,
updateBy: req.user.name,
updatedBy: req.user.name,
},
})),
}) ||
undefined,
updateBy: req.user.name,
updatedBy: req.user.name,
},
})
.then((v) => {

View file

@ -91,7 +91,7 @@ export class EmployeeCheckupController extends Controller {
province: { connect: provinceId ? { id: provinceId } : undefined },
employee: { connect: { id: employeeId } },
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
@ -143,7 +143,7 @@ export class EmployeeCheckupController extends Controller {
...rest,
province: { connect: provinceId ? { id: provinceId } : undefined },
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});

View file

@ -419,7 +419,7 @@ export class EmployeeController extends Controller {
subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined },
customerBranch: { connect: { id: customerBranchId } },
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
},
@ -578,12 +578,12 @@ export class EmployeeController extends Controller {
create: {
...v,
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
id: undefined,
},
update: {
...v,
updateBy: req.user.name,
updatedBy: req.user.name,
},
})),
}
@ -601,12 +601,12 @@ export class EmployeeController extends Controller {
create: {
...v,
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
id: undefined,
},
update: {
...v,
updateBy: req.user.name,
updatedBy: req.user.name,
},
})),
}
@ -630,7 +630,7 @@ export class EmployeeController extends Controller {
disconnect: subDistrictId === null || undefined,
},
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
});

View file

@ -62,7 +62,7 @@ export class EmployeeOtherInfo extends Controller {
...body,
employee: { connect: { id: employeeId } },
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
@ -88,7 +88,7 @@ export class EmployeeOtherInfo extends Controller {
const record = await prisma.employeeOtherInfo.update({
where: { id: otherInfoId, employeeId },
data: { ...body, createdBy: req.user.name, updateBy: req.user.name },
data: { ...body, createdBy: req.user.name, updatedBy: req.user.name },
});
this.setStatus(HttpStatus.CREATED);

View file

@ -69,7 +69,7 @@ export class EmployeeWorkController extends Controller {
...body,
employee: { connect: { id: employeeId } },
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
@ -91,7 +91,7 @@ export class EmployeeWorkController extends Controller {
const record = await prisma.employeeWork.update({
where: { id: workId, employeeId },
data: { ...body, createdBy: req.user.name, updateBy: req.user.name },
data: { ...body, createdBy: req.user.name, updatedBy: req.user.name },
});
this.setStatus(HttpStatus.CREATED);

View file

@ -29,7 +29,7 @@ export class ProductServiceController extends Controller {
"productTypeId",
"createdBy",
"createdAt",
"updateBy",
"updatedBy",
"updatedAt",
'product' as "type"
FROM "Product"
@ -49,7 +49,7 @@ export class ProductServiceController extends Controller {
null as "productTypeId",
"createdBy",
"createdAt",
"updateBy",
"updatedBy",
"updatedAt",
'service' as "type"
FROM "Service"

View file

@ -114,7 +114,7 @@ export class ProductGroup extends Controller {
statusOrder: +(body.status === "INACTIVE"),
code: `G${last.value.toString().padStart(2, "0")}`,
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
},
@ -141,7 +141,7 @@ export class ProductGroup extends Controller {
}
const record = await prisma.productGroup.update({
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updateBy: req.user.name },
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updatedBy: req.user.name },
where: { id: groupId },
});

View file

@ -174,7 +174,7 @@ export class ProductController extends Controller {
statusOrder: +(body.status === "INACTIVE"),
code: `${body.code.toLocaleUpperCase()}${last.value.toString().padStart(3, "0")}`,
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
},
@ -230,7 +230,7 @@ export class ProductController extends Controller {
}
const record = await prisma.product.update({
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updateBy: req.user.name },
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updatedBy: req.user.name },
where: { id: productId },
});

View file

@ -128,7 +128,7 @@ export class ProductType extends Controller {
statusOrder: +(body.status === "INACTIVE"),
code: `T${productGroup.code}${last.value.toString().padStart(2, "0")}`,
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
},
@ -173,7 +173,7 @@ export class ProductType extends Controller {
}
const record = await prisma.productType.update({
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updateBy: req.user.name },
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updatedBy: req.user.name },
where: { id: typeId },
});

View file

@ -246,7 +246,7 @@ export class ServiceController extends Controller {
code: `${body.code.toLocaleUpperCase()}${last.value.toString().padStart(3, "0")}`,
work: { connect: workList.map((v) => ({ id: v.id })) },
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
},
@ -308,7 +308,7 @@ export class ServiceController extends Controller {
deleteMany: {},
connect: workList.map((v) => ({ id: v.id })),
},
updateBy: req.user.name,
updatedBy: req.user.name,
},
where: { id: serviceId },
});

View file

@ -298,7 +298,7 @@ export class UserController extends Controller {
district: { connect: districtId ? { id: districtId } : undefined },
subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined },
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
@ -438,7 +438,7 @@ export class UserController extends Controller {
connect: subDistrictId ? { id: subDistrictId } : undefined,
disconnect: subDistrictId === null || undefined,
},
updateBy: req.user.name,
updatedBy: req.user.name,
},
where: { id: userId },
});

View file

@ -184,12 +184,12 @@ export class WorkController extends Controller {
order: i + 1,
productId: v,
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
})),
},
},
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});
@ -282,12 +282,12 @@ export class WorkController extends Controller {
order: i + 1,
productId: v,
createdBy: req.user.name,
updateBy: req.user.name,
updatedBy: req.user.name,
},
})),
}
: undefined,
updateBy: req.user.name,
updatedBy: req.user.name,
},
});