feat: add pay split field

This commit is contained in:
Methapon Metanipat 2024-10-03 13:41:36 +07:00
parent ab91d0923f
commit 2765aac661
3 changed files with 14 additions and 5 deletions

View file

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

View file

@ -1066,8 +1066,9 @@ model Quotation {
model QuotationPaySplit {
id String @id @default(cuid())
no Int
date DateTime @db.Date
no Int
date DateTime @db.Date
amount Float
quotation Quotation? @relation(fields: [quotationId], references: [id])
quotationId String?

View file

@ -38,7 +38,7 @@ type QuotationCreate = {
payCondition: PayCondition;
paySplitCount?: number;
paySplit?: Date[];
paySplit?: { date: Date; amount: number }[];
payBillDate?: Date;
@ -96,7 +96,7 @@ type QuotationUpdate = {
payCondition?: PayCondition;
paySplitCount?: number;
paySplit?: Date[];
paySplit?: { date: Date; amount: number }[];
payBillDate?: Date;
@ -394,7 +394,7 @@ export class QuotationController extends Controller {
createMany: {
data: (rest.paySplit || []).map((v, i) => ({
no: i + 1,
date: v,
...v,
})),
},
},