feat: add quotation structure
This commit is contained in:
parent
be8f8d462f
commit
d0e207de7e
2 changed files with 231 additions and 4 deletions
108
src/controllers/quotation-controller.ts
Normal file
108
src/controllers/quotation-controller.ts
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
import { PayCondition, Status } from "@prisma/client";
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
Path,
|
||||
Post,
|
||||
Put,
|
||||
Query,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
import { RequestWithUser } from "../interfaces/user";
|
||||
|
||||
type QuotationCreate = {
|
||||
status?: Status;
|
||||
|
||||
payCondition: PayCondition;
|
||||
|
||||
paySplitCount?: number;
|
||||
paySplit?: Date[];
|
||||
|
||||
payBillDate?: number;
|
||||
|
||||
workerCount: number;
|
||||
workerId: string[]; // EmployeeId
|
||||
|
||||
urgent?: boolean;
|
||||
|
||||
service: {
|
||||
id: string;
|
||||
// Other fields will come from original data
|
||||
work?: {
|
||||
// Name field will come from original data
|
||||
product: {
|
||||
id: string;
|
||||
amount: number;
|
||||
discount: number;
|
||||
pricePerUnit: number;
|
||||
}[];
|
||||
}[];
|
||||
};
|
||||
};
|
||||
|
||||
type QuotationUpdate = {
|
||||
status?: "ACTIVE" | "INACTIVE";
|
||||
|
||||
payCondition: PayCondition;
|
||||
|
||||
paySplitCount?: number;
|
||||
paySplit?: Date[];
|
||||
|
||||
payBillDate?: number;
|
||||
|
||||
workerCount: number;
|
||||
workerId: string[]; // EmployeeId
|
||||
|
||||
urgent?: boolean;
|
||||
|
||||
service: {
|
||||
id: string;
|
||||
// Other fields will come from original data
|
||||
work?: {
|
||||
// Name field will come from original data
|
||||
product: {
|
||||
id: string;
|
||||
amount: number;
|
||||
discount: number;
|
||||
pricePerUnit: number;
|
||||
}[];
|
||||
}[];
|
||||
};
|
||||
};
|
||||
|
||||
@Route("/api/v1/quotation")
|
||||
@Tags("Quotation")
|
||||
export class QuotationController extends Controller {
|
||||
@Get("{quotationId}")
|
||||
@Security("keycloak")
|
||||
async getQuotationById(
|
||||
@Path() quotationId: string,
|
||||
@Query() page: number = 1,
|
||||
@Query() pageSize: number = 30,
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
@Security("keycloak")
|
||||
async getQuotationList(@Query() page: number = 1, @Query() pageSize: number = 30) {}
|
||||
|
||||
@Post()
|
||||
@Security("keycloak")
|
||||
async createQuotation(@Request() req: RequestWithUser, @Body() body: QuotationCreate) {}
|
||||
|
||||
@Put("{quotationId}")
|
||||
@Security("keycloak")
|
||||
async editQuotation(
|
||||
@Request() req: RequestWithUser,
|
||||
@Path() quotationId: string,
|
||||
@Body() body: QuotationUpdate,
|
||||
) {}
|
||||
|
||||
@Delete("{quotationId}")
|
||||
@Security("keycloak")
|
||||
async deleteQuotationById(@Request() req: RequestWithUser, @Path() quotationId: string) {}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue