fix: tags không có trong csdl gây nên lỗi crash backend

This commit is contained in:
2026-06-16 11:15:39 +07:00
parent bc49e081c6
commit 8cca4a83ca
9 changed files with 189 additions and 10 deletions
+3 -1
View File
@@ -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,