add user profile, profile vibe and trip vibe and social signal

This commit is contained in:
2026-05-08 19:20:27 +07:00
parent 3228ef712f
commit 7f419638b5
39 changed files with 1361 additions and 192 deletions
+43 -2
View File
@@ -1,6 +1,6 @@
import { prisma } from "@/lib/prisma";
import { Prisma } from "@/app/generated/prisma/client";
import type { ActivityCategory } from "@/app/generated/prisma/enums";
import type { ActivityCategory, Vibe } from "@/app/generated/prisma/enums";
import {
utcStartOfDay,
utcDayStartFromYmd,
@@ -8,11 +8,15 @@ import {
maxUtcDate,
} from "@/lib/trip-dates";
export type GroupSize = "SMALL" | "MEDIUM" | "LARGE";
export interface TripFilters {
q?: string;
from?: string;
to?: string;
category?: ActivityCategory;
vibe?: Vibe;
groupSize?: GroupSize;
}
export const tripRepo = {
@@ -47,6 +51,18 @@ export const tripRepo = {
andParts.push({ category: filters.category });
}
if (filters?.vibe) {
andParts.push({ vibe: filters.vibe });
}
if (filters?.groupSize === "SMALL") {
andParts.push({ maxParticipants: { lte: 10 } });
} else if (filters?.groupSize === "MEDIUM") {
andParts.push({ maxParticipants: { gte: 11, lte: 20 } });
} else if (filters?.groupSize === "LARGE") {
andParts.push({ maxParticipants: { gte: 21 } });
}
if (!filters?.from && !filters?.to) {
andParts.push({ date: { gte: todayStart } });
} else {
@@ -104,6 +120,22 @@ export const tripRepo = {
},
},
images: { orderBy: { order: "asc" }, take: 1 },
participants: {
where: { status: "CONFIRMED" },
take: 10,
orderBy: { createdAt: "asc" },
select: {
id: true,
user: {
select: {
id: true,
name: true,
image: true,
profile: { select: { interests: true } },
},
},
},
},
_count: {
select: {
participants: { where: { status: { not: "CANCELLED" } } },
@@ -129,7 +161,16 @@ export const tripRepo = {
},
images: { orderBy: { order: "asc" } },
participants: {
include: { user: { select: { id: true, name: true, image: true } } },
include: {
user: {
select: {
id: true,
name: true,
image: true,
profile: { select: { city: true, interests: true } },
},
},
},
},
reviews: {
orderBy: { createdAt: "desc" },