Cài đặt tính năng hiển thị chi phí
This commit is contained in:
Vendored
+4
-1
@@ -159,12 +159,15 @@ let TourController = class TourController {
|
||||
this.prisma = prisma;
|
||||
}
|
||||
async createTour(body, req) {
|
||||
const { title, startDate, endDate } = body;
|
||||
const { title, startDate, endDate, adultCount, childCount, childDiscount } = body;
|
||||
return this.prisma.tour.create({
|
||||
data: {
|
||||
title,
|
||||
startDate: startDate ? new Date(startDate) : null,
|
||||
endDate: endDate ? new Date(endDate) : null,
|
||||
adultCount: adultCount || 1,
|
||||
childCount: childCount || 0,
|
||||
childDiscount: childDiscount || 0,
|
||||
createdById: req.user.id,
|
||||
participants: {
|
||||
create: {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Tour" ADD COLUMN "adultCount" INTEGER NOT NULL DEFAULT 1,
|
||||
ADD COLUMN "childCount" INTEGER NOT NULL DEFAULT 0,
|
||||
ADD COLUMN "childDiscount" INTEGER NOT NULL DEFAULT 30;
|
||||
@@ -83,6 +83,10 @@ model Tour {
|
||||
createdAt DateTime @default(now())
|
||||
totalCost Decimal @default(0) @db.Decimal(15, 2)
|
||||
|
||||
adultCount Int @default(1)
|
||||
childCount Int @default(0)
|
||||
childDiscount Int @default(30)
|
||||
|
||||
createdById String
|
||||
creator User @relation("TourCreator", fields: [createdById], references: [id])
|
||||
|
||||
|
||||
+4
-1
@@ -108,12 +108,15 @@ class TourController {
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Post()
|
||||
async createTour(@Body() body: any, @Req() req: any) {
|
||||
const { title, startDate, endDate } = body;
|
||||
const { title, startDate, endDate, adultCount, childCount, childDiscount } = body;
|
||||
return this.prisma.tour.create({
|
||||
data: {
|
||||
title,
|
||||
startDate: startDate ? new Date(startDate) : null,
|
||||
endDate: endDate ? new Date(endDate) : null,
|
||||
adultCount: adultCount || 1,
|
||||
childCount: childCount || 0,
|
||||
childDiscount: childDiscount || 0,
|
||||
createdById: req.user.id,
|
||||
participants: {
|
||||
create: {
|
||||
|
||||
Reference in New Issue
Block a user