fix: tính năng tìm đường ngắn nhất và chỉ đường cho người dùng
This commit is contained in:
Vendored
+66
-17
@@ -824,27 +824,13 @@ let TourController = class TourController {
|
||||
}
|
||||
}
|
||||
});
|
||||
const noteContent = `<h2>${filteredTitle} - Initial Planning</h2>
|
||||
<p><strong>Start Date:</strong> ${startDate ? new Date(startDate).toLocaleDateString() : 'TBD'}</p>
|
||||
<p><strong>End Date:</strong> ${endDate ? new Date(endDate).toLocaleDateString() : 'TBD'}</p>
|
||||
<p><strong>Adult Participants:</strong> ${adultCount || 1}</p>
|
||||
<p><strong>Child Participants:</strong> ${childCount || 0}</p>
|
||||
<h3>Key Items to Plan:</h3>
|
||||
<ul>
|
||||
<li>Accommodations</li>
|
||||
<li>Transportation</li>
|
||||
<li>Activities & Attractions</li>
|
||||
<li>Budget & Expenses</li>
|
||||
<li>Important Contact Numbers</li>
|
||||
<li>Special Requirements & Notes</li>
|
||||
</ul>
|
||||
<p><em>Add your planning notes here...</em></p>`;
|
||||
const noteContent = `<h1>${filteredTitle}</h1><h2>Ghi chú chung</h2><p><em>Nội dung ghi chú tổng quan của chuyến đi...</em></p>`;
|
||||
try {
|
||||
await this.prisma.tourNote.create({
|
||||
data: {
|
||||
tourId: tour.id,
|
||||
userId: req.user.id,
|
||||
title: `[${filteredTitle}] - Initial Planning`,
|
||||
title: `Ghi chú: ${filteredTitle}`,
|
||||
content: noteContent
|
||||
}
|
||||
});
|
||||
@@ -2260,6 +2246,19 @@ let PhotoController = class PhotoController {
|
||||
console.log(`[EXIF GPS] Sử dụng tọa độ dự phòng từ Frontend: lat=${lat}, lng=${lng}`);
|
||||
}
|
||||
}
|
||||
let tags = [];
|
||||
if (req.body.tags) {
|
||||
try {
|
||||
tags = JSON.parse(req.body.tags);
|
||||
if (!Array.isArray(tags)) {
|
||||
tags = [];
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
const errorMsg = e instanceof Error ? e.message : 'Unknown error';
|
||||
console.warn('[TAGS] Failed to parse tags from request:', errorMsg);
|
||||
}
|
||||
}
|
||||
if (lat === undefined || lng === undefined) {
|
||||
lat = 10.7769;
|
||||
lng = 106.7009;
|
||||
@@ -2293,7 +2292,8 @@ let PhotoController = class PhotoController {
|
||||
privacy: 'PUBLIC',
|
||||
metadata: {
|
||||
lat: lat,
|
||||
lng: lng
|
||||
lng: lng,
|
||||
tags: tags
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -4210,6 +4210,45 @@ let TourNoteController = class TourNoteController {
|
||||
});
|
||||
return { success: true };
|
||||
}
|
||||
async insertSection(tourId, body, req) {
|
||||
const tour = await this.prisma.tour.findUnique({ where: { id: tourId } });
|
||||
if (!tour)
|
||||
throw new common_1.NotFoundException('Không tìm thấy tour');
|
||||
const masterNote = await this.prisma.tourNote.findFirst({
|
||||
where: { tourId, title: `Ghi chú: ${tour.title}`, isDeleted: false, userId: req.user.id }
|
||||
});
|
||||
let note = masterNote;
|
||||
if (!note) {
|
||||
note = await this.prisma.tourNote.create({
|
||||
data: {
|
||||
tourId,
|
||||
userId: req.user.id,
|
||||
title: `Ghi chú: ${tour.title}`,
|
||||
content: `# ${tour.title}\n\n## Ghi chú chung\n\n*(Nội dung ghi chú tổng quan của chuyến đi...)*\n\n`
|
||||
}
|
||||
});
|
||||
}
|
||||
const leg = await this.prisma.leg.findUnique({ where: { id: body.legId } });
|
||||
const stageHeader = leg ? `<h2>Ghi chú: ${leg.note || `Chặng ${leg.sequence}`}</h2>` : '<h2>Ghi chú:</h2>';
|
||||
let content = note.content;
|
||||
const stageIndex = content.indexOf(stageHeader);
|
||||
if (stageIndex === -1) {
|
||||
content += `<br><br>${stageHeader}${body.noteSnippet}`;
|
||||
}
|
||||
else {
|
||||
const nextHeaderIndex = content.indexOf('<h2>', stageIndex + stageHeader.length);
|
||||
if (nextHeaderIndex !== -1) {
|
||||
content = content.slice(0, nextHeaderIndex) + body.noteSnippet + content.slice(nextHeaderIndex);
|
||||
}
|
||||
else {
|
||||
content += body.noteSnippet;
|
||||
}
|
||||
}
|
||||
return this.prisma.tourNote.update({
|
||||
where: { id: note.id },
|
||||
data: { content }
|
||||
});
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, exports.Roles)(client_1.ParticipantRole.OWNER, client_1.ParticipantRole.MANAGER, client_1.ParticipantRole.MEMBER, client_1.ParticipantRole.MEMBER_NO_FINANCE),
|
||||
@@ -4250,6 +4289,16 @@ __decorate([
|
||||
__metadata("design:paramtypes", [String, String, Object]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], TourNoteController.prototype, "deleteNote", null);
|
||||
__decorate([
|
||||
(0, exports.Roles)(client_1.ParticipantRole.OWNER, client_1.ParticipantRole.MANAGER, client_1.ParticipantRole.MEMBER, client_1.ParticipantRole.MEMBER_NO_FINANCE),
|
||||
(0, common_1.Post)('insert'),
|
||||
__param(0, (0, common_1.Param)('tourId')),
|
||||
__param(1, (0, common_1.Body)()),
|
||||
__param(2, (0, common_1.Req)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [String, Object, Object]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], TourNoteController.prototype, "insertSection", null);
|
||||
TourNoteController = __decorate([
|
||||
(0, common_1.Controller)('tours/:tourId/notes'),
|
||||
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard, TourRoleGuard),
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user