fix: tags không có trong csdl gây nên lỗi crash backend
This commit is contained in:
Vendored
+3
-1
@@ -211,12 +211,13 @@ let TourController = class TourController {
|
||||
this.prisma = prisma;
|
||||
}
|
||||
async createTour(body, req) {
|
||||
const { title, startDate, endDate, adultCount, childCount, childDiscount } = body;
|
||||
const { title, startDate, endDate, adultCount, childCount, childDiscount, tags } = body;
|
||||
return this.prisma.tour.create({
|
||||
data: {
|
||||
title,
|
||||
startDate: startDate ? new Date(startDate) : null,
|
||||
endDate: endDate ? new Date(endDate) : null,
|
||||
tags: tags || [],
|
||||
adultCount: adultCount || 1,
|
||||
childCount: childCount || 0,
|
||||
childDiscount: childDiscount || 0,
|
||||
@@ -384,6 +385,7 @@ let TourController = class TourController {
|
||||
title: body.title,
|
||||
description: body.description,
|
||||
startDate: body.startDate ? new Date(body.startDate) : undefined,
|
||||
tags: body.tags,
|
||||
endDate: body.endDate ? new Date(body.endDate) : undefined,
|
||||
adultCount: body.adultCount !== undefined ? Number(body.adultCount) : undefined,
|
||||
childCount: body.childCount !== undefined ? Number(body.childCount) : undefined,
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user