diff --git a/README.md b/README.md index e215bc4..0025b0c 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,77 @@ -This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). +# SeTrip -## Getting Started +Aplikasi open trip pendakian yang mempertemukan **organizer** (pembuat trip) dengan **peserta** yang ingin naik gunung bareng atau mencari teman trip. -First, run the development server: +Stack: [Next.js](https://nextjs.org) (App Router), NextAuth, Prisma (PostgreSQL), Tailwind CSS. + +## Alur aplikasi + +### 1. Autentikasi + +- Pengguna baru mendaftar di `/register` (nama, email, password disimpan di database). +- Login di `/login` melalui NextAuth; sesi dipakai di server action dan di halaman client (misalnya navbar, form buat trip). + +Tanpa login, pengguna tetap bisa melihat daftar trip dan detail trip, tetapi tidak bisa membuat trip atau join. + +### 2. Organizer: membuat trip + +1. Setelah login, organizer membuka **Buat Trip** (`/create-trip`) dari navbar, halaman `/trips`, beranda, atau tombol mengambang (+). +2. Halaman form (`app/create-trip/page.tsx`) memvalidasi sesi di client; jika belum login, ditampilkan ajakan login. +3. Organizer mengisi judul, gunung, lokasi, deskripsi (opsional), rentang tanggal (DatePicker), maks peserta, harga (format Rupiah), dan URL gambar opsional (`ImageUrlInput`). +4. Submit memanggil server action `createTripAction` (`features/trip/actions.ts`): + - Memastikan ada sesi. + - Mem-parse dan memvalidasi input dengan Zod (`features/trip/schemas.ts`). + - `tripService.createTrip` menulis trip baru ke database lewat `tripRepo.create`, menghubungkan `organizerId` ke user yang login, dan menyimpan gambar jika ada. +5. Trip baru berstatus **OPEN** (default schema), lalu pengguna diarahkan ke detail trip `/trips/[id]`. + +Organizer **tidak** bisa join trip sendiri; di detail trip tombol join diganti pesan bahwa user adalah organizer. + +### 3. Peserta: mencari trip dan join + +1. **Beranda** (`/`) dan **Open Trip** (`/trips`) menampilkan trip dengan status **OPEN** dan tanggal berangkat tidak di masa lalu (`tripService.getOpenTrips` + filter di repository). +2. Filter pencarian (`TripFilter`) mengirim query string; daftar trip disaring di server. +3. Dari kartu trip (`TripCard`), pengguna membuka **detail** `/trips/[id]` (`app/trips/[id]/page.tsx`): + - Peserta aktif = baris `TripParticipant` yang statusnya bukan `CANCELLED`. + - Slot tersisa dan progress bar memakai jumlah peserta aktif tersebut. +4. **Join** (`JoinTripButton` + `joinTripAction`): + - Jika belum login: tautan ke `/login`. + - Jika trip bukan `OPEN` dan user belum join: pendaftaran ditutup (kecuali user sudah terdaftar dan ingin membatalkan, mengikuti logika UI). + - `tripService.joinTrip` memeriksa: trip ada, status `OPEN`, bukan organizer, belum terdaftar aktif, kapasitas belum penuh; lalu menambah atau mengaktifkan kembali partisipasi (lihat bagian perbaikan bug di bawah). +5. Jika jumlah peserta aktif mencapai `maxParticipants`, status trip diperbarui menjadi **FULL**. +6. **Batal ikut** memanggil `cancelJoinAction` → `tripService.cancelJoin`: partisipasi ditandai `CANCELLED`; jika trip sebelumnya `FULL` dan setelah batal slot kosong lagi, status dikembalikan ke **OPEN**. + +### 4. Ringkasan peran data + +| Konsep | Penyimpanan | +|--------|-------------| +| Trip | Model `Trip` (judul, gunung, lokasi, tanggal, kuota, harga, status, relasi ke organizer) | +| Peserta | `TripParticipant` unik per `(tripId, userId)` dengan status `CONFIRMED` / `CANCELLED` (default schema juga mengenal `PENDING`; alur UI saat ini memakai `CONFIRMED` saat join) | + +## Menjalankan secara lokal + +Pastikan PostgreSQL berjalan dan variabel `DATABASE_URL` di `.env` mengarah ke database yang valid. ```bash +npm install +npx prisma migrate dev +npm run seed # opsional: data contoh npm run dev -# or -yarn dev -# or -pnpm dev -# or -bun dev ``` -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. +Buka [http://localhost:3000](http://localhost:3000). -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. +## Perbaikan bug (yang relevan dengan join & listing) -This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. +1. **Join lagi setelah “Batal ikut”** + Satu user hanya boleh satu baris partisipasi per trip (`@@unique([tripId, userId])`). Kode lama mencoba `create` lagi setelah status `CANCELLED`, sehingga bisa gagal dengan pelanggaran unik. Sekarang jika sudah ada baris `CANCELLED`, partisipasi **diaktifkan kembali** (`CONFIRMED`) lewat `participantRepo.reactivate`, bukan insert baru. + +2. **Jumlah peserta di kartu / daftar** + `_count.participants` di query listing sebelumnya menghitung semua baris termasuk yang `CANCELLED`, sehingga “slot tersisa” di `TripCard` bisa salah. Count sekarang hanya menghitung peserta dengan status **bukan** `CANCELLED`. + +3. **Segar halaman setelah join/batal/buat trip** + Setelah aksi trip, cache halaman `/trips` dan `/` ikut di-`revalidatePath` agar jumlah slot dan daftar di beranda konsisten tanpa harus refresh manual. ## Learn More -To learn more about Next.js, take a look at the following resources: - -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. +- [Next.js Documentation](https://nextjs.org/docs) +- [Prisma Documentation](https://www.prisma.io/docs) diff --git a/app/create-trip/page.tsx b/app/create-trip/page.tsx index e487db8..b0d0124 100644 --- a/app/create-trip/page.tsx +++ b/app/create-trip/page.tsx @@ -8,6 +8,7 @@ import DatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; import { createTripAction } from "@/features/trip/actions"; import { ImageUrlInput } from "@/features/trip/components/image-url-input"; +import { formatLocalCalendarYmd } from "@/lib/trip-dates"; const SAMPLE_MOUNTAINS = [ { name: "Gunung Papandayan", location: "Garut, Jawa Barat" }, @@ -72,10 +73,15 @@ export default function CreateTripPage() { setLoading(true); const formData = new FormData(e.currentTarget); - // Set date values from DatePicker state - formData.set("date", startDate.toISOString().split("T")[0]); + // Hari kalender lokal → YYYY-MM-DD (bukan toISOString, supaya tidak geser ke UTC) + formData.set("date", formatLocalCalendarYmd(startDate)); if (endDate) { - formData.set("endDate", endDate.toISOString().split("T")[0]); + const startYmd = formatLocalCalendarYmd(startDate); + const endYmd = formatLocalCalendarYmd(endDate); + // Satu hari: tanggal pulang sama dengan berangkat → jangan kirim endDate (trip 1 hari) + if (endYmd !== startYmd) { + formData.set("endDate", endYmd); + } } // Set raw price number formData.set("price", parseRupiahInput(priceDisplay)); @@ -222,6 +228,12 @@ export default function CreateTripPage() { +

+ Pilih satu tanggal untuk trip satu hari + . Pilih rentang untuk trip lebih dari satu hari + . Tanggal disimpan sebagai hari kalender yang kamu klik; filter Open Trip memakai{" "} + UTC yang sama. +

{ @@ -208,6 +208,16 @@ export interface PrismaClient< */ get trip(): Prisma.TripDelegate; + /** + * `prisma.tripReview`: Exposes CRUD operations for the **TripReview** model. + * Example usage: + * ```ts + * // Fetch zero or more TripReviews + * const tripReviews = await prisma.tripReview.findMany() + * ``` + */ + get tripReview(): Prisma.TripReviewDelegate; + /** * `prisma.tripImage`: Exposes CRUD operations for the **TripImage** model. * Example usage: diff --git a/app/generated/prisma/internal/prismaNamespace.ts b/app/generated/prisma/internal/prismaNamespace.ts index 9b823f5..167671c 100644 --- a/app/generated/prisma/internal/prismaNamespace.ts +++ b/app/generated/prisma/internal/prismaNamespace.ts @@ -386,6 +386,7 @@ type FieldRefInputType = Model extends never ? never : FieldRe export const ModelName = { User: 'User', Trip: 'Trip', + TripReview: 'TripReview', TripImage: 'TripImage', TripParticipant: 'TripParticipant' } as const @@ -403,7 +404,7 @@ export type TypeMap + fields: Prisma.TripReviewFieldRefs + operations: { + findUnique: { + args: Prisma.TripReviewFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.TripReviewFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.TripReviewFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.TripReviewFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.TripReviewFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.TripReviewCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.TripReviewCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.TripReviewCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.TripReviewDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.TripReviewUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.TripReviewDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.TripReviewUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.TripReviewUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.TripReviewUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.TripReviewAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.TripReviewGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.TripReviewCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } TripImage: { payload: Prisma.$TripImagePayload fields: Prisma.TripImageFieldRefs @@ -774,6 +849,19 @@ export const TripScalarFieldEnum = { export type TripScalarFieldEnum = (typeof TripScalarFieldEnum)[keyof typeof TripScalarFieldEnum] +export const TripReviewScalarFieldEnum = { + id: 'id', + rating: 'rating', + comment: 'comment', + createdAt: 'createdAt', + updatedAt: 'updatedAt', + tripId: 'tripId', + userId: 'userId' +} as const + +export type TripReviewScalarFieldEnum = (typeof TripReviewScalarFieldEnum)[keyof typeof TripReviewScalarFieldEnum] + + export const TripImageScalarFieldEnum = { id: 'id', url: 'url', @@ -1006,6 +1094,7 @@ export type PrismaClientOptions = ({ export type GlobalOmitConfig = { user?: Prisma.UserOmit trip?: Prisma.TripOmit + tripReview?: Prisma.TripReviewOmit tripImage?: Prisma.TripImageOmit tripParticipant?: Prisma.TripParticipantOmit } diff --git a/app/generated/prisma/internal/prismaNamespaceBrowser.ts b/app/generated/prisma/internal/prismaNamespaceBrowser.ts index 6675056..64ac317 100644 --- a/app/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/app/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -53,6 +53,7 @@ export const AnyNull = runtime.AnyNull export const ModelName = { User: 'User', Trip: 'Trip', + TripReview: 'TripReview', TripImage: 'TripImage', TripParticipant: 'TripParticipant' } as const @@ -105,6 +106,19 @@ export const TripScalarFieldEnum = { export type TripScalarFieldEnum = (typeof TripScalarFieldEnum)[keyof typeof TripScalarFieldEnum] +export const TripReviewScalarFieldEnum = { + id: 'id', + rating: 'rating', + comment: 'comment', + createdAt: 'createdAt', + updatedAt: 'updatedAt', + tripId: 'tripId', + userId: 'userId' +} as const + +export type TripReviewScalarFieldEnum = (typeof TripReviewScalarFieldEnum)[keyof typeof TripReviewScalarFieldEnum] + + export const TripImageScalarFieldEnum = { id: 'id', url: 'url', diff --git a/app/generated/prisma/models.ts b/app/generated/prisma/models.ts index d59fef0..28a8f96 100644 --- a/app/generated/prisma/models.ts +++ b/app/generated/prisma/models.ts @@ -10,6 +10,7 @@ */ export type * from './models/User' export type * from './models/Trip' +export type * from './models/TripReview' export type * from './models/TripImage' export type * from './models/TripParticipant' export type * from './commonInputTypes' \ No newline at end of file diff --git a/app/generated/prisma/models/Trip.ts b/app/generated/prisma/models/Trip.ts index 636b99c..ce18263 100644 --- a/app/generated/prisma/models/Trip.ts +++ b/app/generated/prisma/models/Trip.ts @@ -287,6 +287,7 @@ export type TripWhereInput = { organizer?: Prisma.XOR participants?: Prisma.TripParticipantListRelationFilter images?: Prisma.TripImageListRelationFilter + reviews?: Prisma.TripReviewListRelationFilter } export type TripOrderByWithRelationInput = { @@ -306,6 +307,7 @@ export type TripOrderByWithRelationInput = { organizer?: Prisma.UserOrderByWithRelationInput participants?: Prisma.TripParticipantOrderByRelationAggregateInput images?: Prisma.TripImageOrderByRelationAggregateInput + reviews?: Prisma.TripReviewOrderByRelationAggregateInput } export type TripWhereUniqueInput = Prisma.AtLeast<{ @@ -328,6 +330,7 @@ export type TripWhereUniqueInput = Prisma.AtLeast<{ organizer?: Prisma.XOR participants?: Prisma.TripParticipantListRelationFilter images?: Prisma.TripImageListRelationFilter + reviews?: Prisma.TripReviewListRelationFilter }, "id"> export type TripOrderByWithAggregationInput = { @@ -386,6 +389,7 @@ export type TripCreateInput = { organizer: Prisma.UserCreateNestedOneWithoutTripsInput participants?: Prisma.TripParticipantCreateNestedManyWithoutTripInput images?: Prisma.TripImageCreateNestedManyWithoutTripInput + reviews?: Prisma.TripReviewCreateNestedManyWithoutTripInput } export type TripUncheckedCreateInput = { @@ -404,6 +408,7 @@ export type TripUncheckedCreateInput = { organizerId: string participants?: Prisma.TripParticipantUncheckedCreateNestedManyWithoutTripInput images?: Prisma.TripImageUncheckedCreateNestedManyWithoutTripInput + reviews?: Prisma.TripReviewUncheckedCreateNestedManyWithoutTripInput } export type TripUpdateInput = { @@ -422,6 +427,7 @@ export type TripUpdateInput = { organizer?: Prisma.UserUpdateOneRequiredWithoutTripsNestedInput participants?: Prisma.TripParticipantUpdateManyWithoutTripNestedInput images?: Prisma.TripImageUpdateManyWithoutTripNestedInput + reviews?: Prisma.TripReviewUpdateManyWithoutTripNestedInput } export type TripUncheckedUpdateInput = { @@ -440,6 +446,7 @@ export type TripUncheckedUpdateInput = { organizerId?: Prisma.StringFieldUpdateOperationsInput | string participants?: Prisma.TripParticipantUncheckedUpdateManyWithoutTripNestedInput images?: Prisma.TripImageUncheckedUpdateManyWithoutTripNestedInput + reviews?: Prisma.TripReviewUncheckedUpdateManyWithoutTripNestedInput } export type TripCreateManyInput = { @@ -620,6 +627,20 @@ export type EnumTripStatusFieldUpdateOperationsInput = { set?: $Enums.TripStatus } +export type TripCreateNestedOneWithoutReviewsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.TripCreateOrConnectWithoutReviewsInput + connect?: Prisma.TripWhereUniqueInput +} + +export type TripUpdateOneRequiredWithoutReviewsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.TripCreateOrConnectWithoutReviewsInput + upsert?: Prisma.TripUpsertWithoutReviewsInput + connect?: Prisma.TripWhereUniqueInput + update?: Prisma.XOR, Prisma.TripUncheckedUpdateWithoutReviewsInput> +} + export type TripCreateNestedOneWithoutImagesInput = { create?: Prisma.XOR connectOrCreate?: Prisma.TripCreateOrConnectWithoutImagesInput @@ -663,6 +684,7 @@ export type TripCreateWithoutOrganizerInput = { updatedAt?: Date | string participants?: Prisma.TripParticipantCreateNestedManyWithoutTripInput images?: Prisma.TripImageCreateNestedManyWithoutTripInput + reviews?: Prisma.TripReviewCreateNestedManyWithoutTripInput } export type TripUncheckedCreateWithoutOrganizerInput = { @@ -680,6 +702,7 @@ export type TripUncheckedCreateWithoutOrganizerInput = { updatedAt?: Date | string participants?: Prisma.TripParticipantUncheckedCreateNestedManyWithoutTripInput images?: Prisma.TripImageUncheckedCreateNestedManyWithoutTripInput + reviews?: Prisma.TripReviewUncheckedCreateNestedManyWithoutTripInput } export type TripCreateOrConnectWithoutOrganizerInput = { @@ -727,6 +750,94 @@ export type TripScalarWhereInput = { organizerId?: Prisma.StringFilter<"Trip"> | string } +export type TripCreateWithoutReviewsInput = { + id?: string + title: string + description?: string | null + mountain: string + location: string + date: Date | string + endDate?: Date | string | null + maxParticipants: number + price: number + status?: $Enums.TripStatus + createdAt?: Date | string + updatedAt?: Date | string + organizer: Prisma.UserCreateNestedOneWithoutTripsInput + participants?: Prisma.TripParticipantCreateNestedManyWithoutTripInput + images?: Prisma.TripImageCreateNestedManyWithoutTripInput +} + +export type TripUncheckedCreateWithoutReviewsInput = { + id?: string + title: string + description?: string | null + mountain: string + location: string + date: Date | string + endDate?: Date | string | null + maxParticipants: number + price: number + status?: $Enums.TripStatus + createdAt?: Date | string + updatedAt?: Date | string + organizerId: string + participants?: Prisma.TripParticipantUncheckedCreateNestedManyWithoutTripInput + images?: Prisma.TripImageUncheckedCreateNestedManyWithoutTripInput +} + +export type TripCreateOrConnectWithoutReviewsInput = { + where: Prisma.TripWhereUniqueInput + create: Prisma.XOR +} + +export type TripUpsertWithoutReviewsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.TripWhereInput +} + +export type TripUpdateToOneWithWhereWithoutReviewsInput = { + where?: Prisma.TripWhereInput + data: Prisma.XOR +} + +export type TripUpdateWithoutReviewsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + title?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + mountain?: Prisma.StringFieldUpdateOperationsInput | string + location?: Prisma.StringFieldUpdateOperationsInput | string + date?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + endDate?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + maxParticipants?: Prisma.IntFieldUpdateOperationsInput | number + price?: Prisma.IntFieldUpdateOperationsInput | number + status?: Prisma.EnumTripStatusFieldUpdateOperationsInput | $Enums.TripStatus + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + organizer?: Prisma.UserUpdateOneRequiredWithoutTripsNestedInput + participants?: Prisma.TripParticipantUpdateManyWithoutTripNestedInput + images?: Prisma.TripImageUpdateManyWithoutTripNestedInput +} + +export type TripUncheckedUpdateWithoutReviewsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + title?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + mountain?: Prisma.StringFieldUpdateOperationsInput | string + location?: Prisma.StringFieldUpdateOperationsInput | string + date?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + endDate?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + maxParticipants?: Prisma.IntFieldUpdateOperationsInput | number + price?: Prisma.IntFieldUpdateOperationsInput | number + status?: Prisma.EnumTripStatusFieldUpdateOperationsInput | $Enums.TripStatus + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + organizerId?: Prisma.StringFieldUpdateOperationsInput | string + participants?: Prisma.TripParticipantUncheckedUpdateManyWithoutTripNestedInput + images?: Prisma.TripImageUncheckedUpdateManyWithoutTripNestedInput +} + export type TripCreateWithoutImagesInput = { id?: string title: string @@ -742,6 +853,7 @@ export type TripCreateWithoutImagesInput = { updatedAt?: Date | string organizer: Prisma.UserCreateNestedOneWithoutTripsInput participants?: Prisma.TripParticipantCreateNestedManyWithoutTripInput + reviews?: Prisma.TripReviewCreateNestedManyWithoutTripInput } export type TripUncheckedCreateWithoutImagesInput = { @@ -759,6 +871,7 @@ export type TripUncheckedCreateWithoutImagesInput = { updatedAt?: Date | string organizerId: string participants?: Prisma.TripParticipantUncheckedCreateNestedManyWithoutTripInput + reviews?: Prisma.TripReviewUncheckedCreateNestedManyWithoutTripInput } export type TripCreateOrConnectWithoutImagesInput = { @@ -792,6 +905,7 @@ export type TripUpdateWithoutImagesInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string organizer?: Prisma.UserUpdateOneRequiredWithoutTripsNestedInput participants?: Prisma.TripParticipantUpdateManyWithoutTripNestedInput + reviews?: Prisma.TripReviewUpdateManyWithoutTripNestedInput } export type TripUncheckedUpdateWithoutImagesInput = { @@ -809,6 +923,7 @@ export type TripUncheckedUpdateWithoutImagesInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string organizerId?: Prisma.StringFieldUpdateOperationsInput | string participants?: Prisma.TripParticipantUncheckedUpdateManyWithoutTripNestedInput + reviews?: Prisma.TripReviewUncheckedUpdateManyWithoutTripNestedInput } export type TripCreateWithoutParticipantsInput = { @@ -826,6 +941,7 @@ export type TripCreateWithoutParticipantsInput = { updatedAt?: Date | string organizer: Prisma.UserCreateNestedOneWithoutTripsInput images?: Prisma.TripImageCreateNestedManyWithoutTripInput + reviews?: Prisma.TripReviewCreateNestedManyWithoutTripInput } export type TripUncheckedCreateWithoutParticipantsInput = { @@ -843,6 +959,7 @@ export type TripUncheckedCreateWithoutParticipantsInput = { updatedAt?: Date | string organizerId: string images?: Prisma.TripImageUncheckedCreateNestedManyWithoutTripInput + reviews?: Prisma.TripReviewUncheckedCreateNestedManyWithoutTripInput } export type TripCreateOrConnectWithoutParticipantsInput = { @@ -876,6 +993,7 @@ export type TripUpdateWithoutParticipantsInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string organizer?: Prisma.UserUpdateOneRequiredWithoutTripsNestedInput images?: Prisma.TripImageUpdateManyWithoutTripNestedInput + reviews?: Prisma.TripReviewUpdateManyWithoutTripNestedInput } export type TripUncheckedUpdateWithoutParticipantsInput = { @@ -893,6 +1011,7 @@ export type TripUncheckedUpdateWithoutParticipantsInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string organizerId?: Prisma.StringFieldUpdateOperationsInput | string images?: Prisma.TripImageUncheckedUpdateManyWithoutTripNestedInput + reviews?: Prisma.TripReviewUncheckedUpdateManyWithoutTripNestedInput } export type TripCreateManyOrganizerInput = { @@ -925,6 +1044,7 @@ export type TripUpdateWithoutOrganizerInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string participants?: Prisma.TripParticipantUpdateManyWithoutTripNestedInput images?: Prisma.TripImageUpdateManyWithoutTripNestedInput + reviews?: Prisma.TripReviewUpdateManyWithoutTripNestedInput } export type TripUncheckedUpdateWithoutOrganizerInput = { @@ -942,6 +1062,7 @@ export type TripUncheckedUpdateWithoutOrganizerInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string participants?: Prisma.TripParticipantUncheckedUpdateManyWithoutTripNestedInput images?: Prisma.TripImageUncheckedUpdateManyWithoutTripNestedInput + reviews?: Prisma.TripReviewUncheckedUpdateManyWithoutTripNestedInput } export type TripUncheckedUpdateManyWithoutOrganizerInput = { @@ -967,11 +1088,13 @@ export type TripUncheckedUpdateManyWithoutOrganizerInput = { export type TripCountOutputType = { participants: number images: number + reviews: number } export type TripCountOutputTypeSelect = { participants?: boolean | TripCountOutputTypeCountParticipantsArgs images?: boolean | TripCountOutputTypeCountImagesArgs + reviews?: boolean | TripCountOutputTypeCountReviewsArgs } /** @@ -998,6 +1121,13 @@ export type TripCountOutputTypeCountImagesArgs = { + where?: Prisma.TripReviewWhereInput +} + export type TripSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -1016,6 +1146,7 @@ export type TripSelect participants?: boolean | Prisma.Trip$participantsArgs images?: boolean | Prisma.Trip$imagesArgs + reviews?: boolean | Prisma.Trip$reviewsArgs _count?: boolean | Prisma.TripCountOutputTypeDefaultArgs }, ExtArgs["result"]["trip"]> @@ -1074,6 +1205,7 @@ export type TripInclude participants?: boolean | Prisma.Trip$participantsArgs images?: boolean | Prisma.Trip$imagesArgs + reviews?: boolean | Prisma.Trip$reviewsArgs _count?: boolean | Prisma.TripCountOutputTypeDefaultArgs } export type TripIncludeCreateManyAndReturn = { @@ -1089,6 +1221,7 @@ export type $TripPayload participants: Prisma.$TripParticipantPayload[] images: Prisma.$TripImagePayload[] + reviews: Prisma.$TripReviewPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: string @@ -1501,6 +1634,7 @@ export interface Prisma__TripClient = {}>(args?: Prisma.Subset>): Prisma.Prisma__UserClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> participants = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> images = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + reviews = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -1991,6 +2125,30 @@ export type Trip$imagesArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null + where?: Prisma.TripReviewWhereInput + orderBy?: Prisma.TripReviewOrderByWithRelationInput | Prisma.TripReviewOrderByWithRelationInput[] + cursor?: Prisma.TripReviewWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.TripReviewScalarFieldEnum | Prisma.TripReviewScalarFieldEnum[] +} + /** * Trip without action */ diff --git a/app/generated/prisma/models/TripReview.ts b/app/generated/prisma/models/TripReview.ts new file mode 100644 index 0000000..0d48a43 --- /dev/null +++ b/app/generated/prisma/models/TripReview.ts @@ -0,0 +1,1597 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `TripReview` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums" +import type * as Prisma from "../internal/prismaNamespace" + +/** + * Model TripReview + * + */ +export type TripReviewModel = runtime.Types.Result.DefaultSelection + +export type AggregateTripReview = { + _count: TripReviewCountAggregateOutputType | null + _avg: TripReviewAvgAggregateOutputType | null + _sum: TripReviewSumAggregateOutputType | null + _min: TripReviewMinAggregateOutputType | null + _max: TripReviewMaxAggregateOutputType | null +} + +export type TripReviewAvgAggregateOutputType = { + rating: number | null +} + +export type TripReviewSumAggregateOutputType = { + rating: number | null +} + +export type TripReviewMinAggregateOutputType = { + id: string | null + rating: number | null + comment: string | null + createdAt: Date | null + updatedAt: Date | null + tripId: string | null + userId: string | null +} + +export type TripReviewMaxAggregateOutputType = { + id: string | null + rating: number | null + comment: string | null + createdAt: Date | null + updatedAt: Date | null + tripId: string | null + userId: string | null +} + +export type TripReviewCountAggregateOutputType = { + id: number + rating: number + comment: number + createdAt: number + updatedAt: number + tripId: number + userId: number + _all: number +} + + +export type TripReviewAvgAggregateInputType = { + rating?: true +} + +export type TripReviewSumAggregateInputType = { + rating?: true +} + +export type TripReviewMinAggregateInputType = { + id?: true + rating?: true + comment?: true + createdAt?: true + updatedAt?: true + tripId?: true + userId?: true +} + +export type TripReviewMaxAggregateInputType = { + id?: true + rating?: true + comment?: true + createdAt?: true + updatedAt?: true + tripId?: true + userId?: true +} + +export type TripReviewCountAggregateInputType = { + id?: true + rating?: true + comment?: true + createdAt?: true + updatedAt?: true + tripId?: true + userId?: true + _all?: true +} + +export type TripReviewAggregateArgs = { + /** + * Filter which TripReview to aggregate. + */ + where?: Prisma.TripReviewWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of TripReviews to fetch. + */ + orderBy?: Prisma.TripReviewOrderByWithRelationInput | Prisma.TripReviewOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.TripReviewWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` TripReviews from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` TripReviews. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned TripReviews + **/ + _count?: true | TripReviewCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: TripReviewAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: TripReviewSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: TripReviewMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: TripReviewMaxAggregateInputType +} + +export type GetTripReviewAggregateType = { + [P in keyof T & keyof AggregateTripReview]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type TripReviewGroupByArgs = { + where?: Prisma.TripReviewWhereInput + orderBy?: Prisma.TripReviewOrderByWithAggregationInput | Prisma.TripReviewOrderByWithAggregationInput[] + by: Prisma.TripReviewScalarFieldEnum[] | Prisma.TripReviewScalarFieldEnum + having?: Prisma.TripReviewScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: TripReviewCountAggregateInputType | true + _avg?: TripReviewAvgAggregateInputType + _sum?: TripReviewSumAggregateInputType + _min?: TripReviewMinAggregateInputType + _max?: TripReviewMaxAggregateInputType +} + +export type TripReviewGroupByOutputType = { + id: string + rating: number + comment: string | null + createdAt: Date + updatedAt: Date + tripId: string + userId: string + _count: TripReviewCountAggregateOutputType | null + _avg: TripReviewAvgAggregateOutputType | null + _sum: TripReviewSumAggregateOutputType | null + _min: TripReviewMinAggregateOutputType | null + _max: TripReviewMaxAggregateOutputType | null +} + +export type GetTripReviewGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof TripReviewGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type TripReviewWhereInput = { + AND?: Prisma.TripReviewWhereInput | Prisma.TripReviewWhereInput[] + OR?: Prisma.TripReviewWhereInput[] + NOT?: Prisma.TripReviewWhereInput | Prisma.TripReviewWhereInput[] + id?: Prisma.StringFilter<"TripReview"> | string + rating?: Prisma.IntFilter<"TripReview"> | number + comment?: Prisma.StringNullableFilter<"TripReview"> | string | null + createdAt?: Prisma.DateTimeFilter<"TripReview"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"TripReview"> | Date | string + tripId?: Prisma.StringFilter<"TripReview"> | string + userId?: Prisma.StringFilter<"TripReview"> | string + trip?: Prisma.XOR + user?: Prisma.XOR +} + +export type TripReviewOrderByWithRelationInput = { + id?: Prisma.SortOrder + rating?: Prisma.SortOrder + comment?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + tripId?: Prisma.SortOrder + userId?: Prisma.SortOrder + trip?: Prisma.TripOrderByWithRelationInput + user?: Prisma.UserOrderByWithRelationInput +} + +export type TripReviewWhereUniqueInput = Prisma.AtLeast<{ + id?: string + tripId_userId?: Prisma.TripReviewTripIdUserIdCompoundUniqueInput + AND?: Prisma.TripReviewWhereInput | Prisma.TripReviewWhereInput[] + OR?: Prisma.TripReviewWhereInput[] + NOT?: Prisma.TripReviewWhereInput | Prisma.TripReviewWhereInput[] + rating?: Prisma.IntFilter<"TripReview"> | number + comment?: Prisma.StringNullableFilter<"TripReview"> | string | null + createdAt?: Prisma.DateTimeFilter<"TripReview"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"TripReview"> | Date | string + tripId?: Prisma.StringFilter<"TripReview"> | string + userId?: Prisma.StringFilter<"TripReview"> | string + trip?: Prisma.XOR + user?: Prisma.XOR +}, "id" | "tripId_userId"> + +export type TripReviewOrderByWithAggregationInput = { + id?: Prisma.SortOrder + rating?: Prisma.SortOrder + comment?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + tripId?: Prisma.SortOrder + userId?: Prisma.SortOrder + _count?: Prisma.TripReviewCountOrderByAggregateInput + _avg?: Prisma.TripReviewAvgOrderByAggregateInput + _max?: Prisma.TripReviewMaxOrderByAggregateInput + _min?: Prisma.TripReviewMinOrderByAggregateInput + _sum?: Prisma.TripReviewSumOrderByAggregateInput +} + +export type TripReviewScalarWhereWithAggregatesInput = { + AND?: Prisma.TripReviewScalarWhereWithAggregatesInput | Prisma.TripReviewScalarWhereWithAggregatesInput[] + OR?: Prisma.TripReviewScalarWhereWithAggregatesInput[] + NOT?: Prisma.TripReviewScalarWhereWithAggregatesInput | Prisma.TripReviewScalarWhereWithAggregatesInput[] + id?: Prisma.StringWithAggregatesFilter<"TripReview"> | string + rating?: Prisma.IntWithAggregatesFilter<"TripReview"> | number + comment?: Prisma.StringNullableWithAggregatesFilter<"TripReview"> | string | null + createdAt?: Prisma.DateTimeWithAggregatesFilter<"TripReview"> | Date | string + updatedAt?: Prisma.DateTimeWithAggregatesFilter<"TripReview"> | Date | string + tripId?: Prisma.StringWithAggregatesFilter<"TripReview"> | string + userId?: Prisma.StringWithAggregatesFilter<"TripReview"> | string +} + +export type TripReviewCreateInput = { + id?: string + rating: number + comment?: string | null + createdAt?: Date | string + updatedAt?: Date | string + trip: Prisma.TripCreateNestedOneWithoutReviewsInput + user: Prisma.UserCreateNestedOneWithoutTripReviewsInput +} + +export type TripReviewUncheckedCreateInput = { + id?: string + rating: number + comment?: string | null + createdAt?: Date | string + updatedAt?: Date | string + tripId: string + userId: string +} + +export type TripReviewUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + rating?: Prisma.IntFieldUpdateOperationsInput | number + comment?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + trip?: Prisma.TripUpdateOneRequiredWithoutReviewsNestedInput + user?: Prisma.UserUpdateOneRequiredWithoutTripReviewsNestedInput +} + +export type TripReviewUncheckedUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + rating?: Prisma.IntFieldUpdateOperationsInput | number + comment?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + tripId?: Prisma.StringFieldUpdateOperationsInput | string + userId?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type TripReviewCreateManyInput = { + id?: string + rating: number + comment?: string | null + createdAt?: Date | string + updatedAt?: Date | string + tripId: string + userId: string +} + +export type TripReviewUpdateManyMutationInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + rating?: Prisma.IntFieldUpdateOperationsInput | number + comment?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type TripReviewUncheckedUpdateManyInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + rating?: Prisma.IntFieldUpdateOperationsInput | number + comment?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + tripId?: Prisma.StringFieldUpdateOperationsInput | string + userId?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type TripReviewListRelationFilter = { + every?: Prisma.TripReviewWhereInput + some?: Prisma.TripReviewWhereInput + none?: Prisma.TripReviewWhereInput +} + +export type TripReviewOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type TripReviewTripIdUserIdCompoundUniqueInput = { + tripId: string + userId: string +} + +export type TripReviewCountOrderByAggregateInput = { + id?: Prisma.SortOrder + rating?: Prisma.SortOrder + comment?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + tripId?: Prisma.SortOrder + userId?: Prisma.SortOrder +} + +export type TripReviewAvgOrderByAggregateInput = { + rating?: Prisma.SortOrder +} + +export type TripReviewMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + rating?: Prisma.SortOrder + comment?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + tripId?: Prisma.SortOrder + userId?: Prisma.SortOrder +} + +export type TripReviewMinOrderByAggregateInput = { + id?: Prisma.SortOrder + rating?: Prisma.SortOrder + comment?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + tripId?: Prisma.SortOrder + userId?: Prisma.SortOrder +} + +export type TripReviewSumOrderByAggregateInput = { + rating?: Prisma.SortOrder +} + +export type TripReviewCreateNestedManyWithoutUserInput = { + create?: Prisma.XOR | Prisma.TripReviewCreateWithoutUserInput[] | Prisma.TripReviewUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.TripReviewCreateOrConnectWithoutUserInput | Prisma.TripReviewCreateOrConnectWithoutUserInput[] + createMany?: Prisma.TripReviewCreateManyUserInputEnvelope + connect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] +} + +export type TripReviewUncheckedCreateNestedManyWithoutUserInput = { + create?: Prisma.XOR | Prisma.TripReviewCreateWithoutUserInput[] | Prisma.TripReviewUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.TripReviewCreateOrConnectWithoutUserInput | Prisma.TripReviewCreateOrConnectWithoutUserInput[] + createMany?: Prisma.TripReviewCreateManyUserInputEnvelope + connect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] +} + +export type TripReviewUpdateManyWithoutUserNestedInput = { + create?: Prisma.XOR | Prisma.TripReviewCreateWithoutUserInput[] | Prisma.TripReviewUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.TripReviewCreateOrConnectWithoutUserInput | Prisma.TripReviewCreateOrConnectWithoutUserInput[] + upsert?: Prisma.TripReviewUpsertWithWhereUniqueWithoutUserInput | Prisma.TripReviewUpsertWithWhereUniqueWithoutUserInput[] + createMany?: Prisma.TripReviewCreateManyUserInputEnvelope + set?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + disconnect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + delete?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + connect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + update?: Prisma.TripReviewUpdateWithWhereUniqueWithoutUserInput | Prisma.TripReviewUpdateWithWhereUniqueWithoutUserInput[] + updateMany?: Prisma.TripReviewUpdateManyWithWhereWithoutUserInput | Prisma.TripReviewUpdateManyWithWhereWithoutUserInput[] + deleteMany?: Prisma.TripReviewScalarWhereInput | Prisma.TripReviewScalarWhereInput[] +} + +export type TripReviewUncheckedUpdateManyWithoutUserNestedInput = { + create?: Prisma.XOR | Prisma.TripReviewCreateWithoutUserInput[] | Prisma.TripReviewUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.TripReviewCreateOrConnectWithoutUserInput | Prisma.TripReviewCreateOrConnectWithoutUserInput[] + upsert?: Prisma.TripReviewUpsertWithWhereUniqueWithoutUserInput | Prisma.TripReviewUpsertWithWhereUniqueWithoutUserInput[] + createMany?: Prisma.TripReviewCreateManyUserInputEnvelope + set?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + disconnect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + delete?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + connect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + update?: Prisma.TripReviewUpdateWithWhereUniqueWithoutUserInput | Prisma.TripReviewUpdateWithWhereUniqueWithoutUserInput[] + updateMany?: Prisma.TripReviewUpdateManyWithWhereWithoutUserInput | Prisma.TripReviewUpdateManyWithWhereWithoutUserInput[] + deleteMany?: Prisma.TripReviewScalarWhereInput | Prisma.TripReviewScalarWhereInput[] +} + +export type TripReviewCreateNestedManyWithoutTripInput = { + create?: Prisma.XOR | Prisma.TripReviewCreateWithoutTripInput[] | Prisma.TripReviewUncheckedCreateWithoutTripInput[] + connectOrCreate?: Prisma.TripReviewCreateOrConnectWithoutTripInput | Prisma.TripReviewCreateOrConnectWithoutTripInput[] + createMany?: Prisma.TripReviewCreateManyTripInputEnvelope + connect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] +} + +export type TripReviewUncheckedCreateNestedManyWithoutTripInput = { + create?: Prisma.XOR | Prisma.TripReviewCreateWithoutTripInput[] | Prisma.TripReviewUncheckedCreateWithoutTripInput[] + connectOrCreate?: Prisma.TripReviewCreateOrConnectWithoutTripInput | Prisma.TripReviewCreateOrConnectWithoutTripInput[] + createMany?: Prisma.TripReviewCreateManyTripInputEnvelope + connect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] +} + +export type TripReviewUpdateManyWithoutTripNestedInput = { + create?: Prisma.XOR | Prisma.TripReviewCreateWithoutTripInput[] | Prisma.TripReviewUncheckedCreateWithoutTripInput[] + connectOrCreate?: Prisma.TripReviewCreateOrConnectWithoutTripInput | Prisma.TripReviewCreateOrConnectWithoutTripInput[] + upsert?: Prisma.TripReviewUpsertWithWhereUniqueWithoutTripInput | Prisma.TripReviewUpsertWithWhereUniqueWithoutTripInput[] + createMany?: Prisma.TripReviewCreateManyTripInputEnvelope + set?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + disconnect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + delete?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + connect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + update?: Prisma.TripReviewUpdateWithWhereUniqueWithoutTripInput | Prisma.TripReviewUpdateWithWhereUniqueWithoutTripInput[] + updateMany?: Prisma.TripReviewUpdateManyWithWhereWithoutTripInput | Prisma.TripReviewUpdateManyWithWhereWithoutTripInput[] + deleteMany?: Prisma.TripReviewScalarWhereInput | Prisma.TripReviewScalarWhereInput[] +} + +export type TripReviewUncheckedUpdateManyWithoutTripNestedInput = { + create?: Prisma.XOR | Prisma.TripReviewCreateWithoutTripInput[] | Prisma.TripReviewUncheckedCreateWithoutTripInput[] + connectOrCreate?: Prisma.TripReviewCreateOrConnectWithoutTripInput | Prisma.TripReviewCreateOrConnectWithoutTripInput[] + upsert?: Prisma.TripReviewUpsertWithWhereUniqueWithoutTripInput | Prisma.TripReviewUpsertWithWhereUniqueWithoutTripInput[] + createMany?: Prisma.TripReviewCreateManyTripInputEnvelope + set?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + disconnect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + delete?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + connect?: Prisma.TripReviewWhereUniqueInput | Prisma.TripReviewWhereUniqueInput[] + update?: Prisma.TripReviewUpdateWithWhereUniqueWithoutTripInput | Prisma.TripReviewUpdateWithWhereUniqueWithoutTripInput[] + updateMany?: Prisma.TripReviewUpdateManyWithWhereWithoutTripInput | Prisma.TripReviewUpdateManyWithWhereWithoutTripInput[] + deleteMany?: Prisma.TripReviewScalarWhereInput | Prisma.TripReviewScalarWhereInput[] +} + +export type TripReviewCreateWithoutUserInput = { + id?: string + rating: number + comment?: string | null + createdAt?: Date | string + updatedAt?: Date | string + trip: Prisma.TripCreateNestedOneWithoutReviewsInput +} + +export type TripReviewUncheckedCreateWithoutUserInput = { + id?: string + rating: number + comment?: string | null + createdAt?: Date | string + updatedAt?: Date | string + tripId: string +} + +export type TripReviewCreateOrConnectWithoutUserInput = { + where: Prisma.TripReviewWhereUniqueInput + create: Prisma.XOR +} + +export type TripReviewCreateManyUserInputEnvelope = { + data: Prisma.TripReviewCreateManyUserInput | Prisma.TripReviewCreateManyUserInput[] + skipDuplicates?: boolean +} + +export type TripReviewUpsertWithWhereUniqueWithoutUserInput = { + where: Prisma.TripReviewWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type TripReviewUpdateWithWhereUniqueWithoutUserInput = { + where: Prisma.TripReviewWhereUniqueInput + data: Prisma.XOR +} + +export type TripReviewUpdateManyWithWhereWithoutUserInput = { + where: Prisma.TripReviewScalarWhereInput + data: Prisma.XOR +} + +export type TripReviewScalarWhereInput = { + AND?: Prisma.TripReviewScalarWhereInput | Prisma.TripReviewScalarWhereInput[] + OR?: Prisma.TripReviewScalarWhereInput[] + NOT?: Prisma.TripReviewScalarWhereInput | Prisma.TripReviewScalarWhereInput[] + id?: Prisma.StringFilter<"TripReview"> | string + rating?: Prisma.IntFilter<"TripReview"> | number + comment?: Prisma.StringNullableFilter<"TripReview"> | string | null + createdAt?: Prisma.DateTimeFilter<"TripReview"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"TripReview"> | Date | string + tripId?: Prisma.StringFilter<"TripReview"> | string + userId?: Prisma.StringFilter<"TripReview"> | string +} + +export type TripReviewCreateWithoutTripInput = { + id?: string + rating: number + comment?: string | null + createdAt?: Date | string + updatedAt?: Date | string + user: Prisma.UserCreateNestedOneWithoutTripReviewsInput +} + +export type TripReviewUncheckedCreateWithoutTripInput = { + id?: string + rating: number + comment?: string | null + createdAt?: Date | string + updatedAt?: Date | string + userId: string +} + +export type TripReviewCreateOrConnectWithoutTripInput = { + where: Prisma.TripReviewWhereUniqueInput + create: Prisma.XOR +} + +export type TripReviewCreateManyTripInputEnvelope = { + data: Prisma.TripReviewCreateManyTripInput | Prisma.TripReviewCreateManyTripInput[] + skipDuplicates?: boolean +} + +export type TripReviewUpsertWithWhereUniqueWithoutTripInput = { + where: Prisma.TripReviewWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type TripReviewUpdateWithWhereUniqueWithoutTripInput = { + where: Prisma.TripReviewWhereUniqueInput + data: Prisma.XOR +} + +export type TripReviewUpdateManyWithWhereWithoutTripInput = { + where: Prisma.TripReviewScalarWhereInput + data: Prisma.XOR +} + +export type TripReviewCreateManyUserInput = { + id?: string + rating: number + comment?: string | null + createdAt?: Date | string + updatedAt?: Date | string + tripId: string +} + +export type TripReviewUpdateWithoutUserInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + rating?: Prisma.IntFieldUpdateOperationsInput | number + comment?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + trip?: Prisma.TripUpdateOneRequiredWithoutReviewsNestedInput +} + +export type TripReviewUncheckedUpdateWithoutUserInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + rating?: Prisma.IntFieldUpdateOperationsInput | number + comment?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + tripId?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type TripReviewUncheckedUpdateManyWithoutUserInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + rating?: Prisma.IntFieldUpdateOperationsInput | number + comment?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + tripId?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type TripReviewCreateManyTripInput = { + id?: string + rating: number + comment?: string | null + createdAt?: Date | string + updatedAt?: Date | string + userId: string +} + +export type TripReviewUpdateWithoutTripInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + rating?: Prisma.IntFieldUpdateOperationsInput | number + comment?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + user?: Prisma.UserUpdateOneRequiredWithoutTripReviewsNestedInput +} + +export type TripReviewUncheckedUpdateWithoutTripInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + rating?: Prisma.IntFieldUpdateOperationsInput | number + comment?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + userId?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type TripReviewUncheckedUpdateManyWithoutTripInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + rating?: Prisma.IntFieldUpdateOperationsInput | number + comment?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + userId?: Prisma.StringFieldUpdateOperationsInput | string +} + + + +export type TripReviewSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + rating?: boolean + comment?: boolean + createdAt?: boolean + updatedAt?: boolean + tripId?: boolean + userId?: boolean + trip?: boolean | Prisma.TripDefaultArgs + user?: boolean | Prisma.UserDefaultArgs +}, ExtArgs["result"]["tripReview"]> + +export type TripReviewSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + rating?: boolean + comment?: boolean + createdAt?: boolean + updatedAt?: boolean + tripId?: boolean + userId?: boolean + trip?: boolean | Prisma.TripDefaultArgs + user?: boolean | Prisma.UserDefaultArgs +}, ExtArgs["result"]["tripReview"]> + +export type TripReviewSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + rating?: boolean + comment?: boolean + createdAt?: boolean + updatedAt?: boolean + tripId?: boolean + userId?: boolean + trip?: boolean | Prisma.TripDefaultArgs + user?: boolean | Prisma.UserDefaultArgs +}, ExtArgs["result"]["tripReview"]> + +export type TripReviewSelectScalar = { + id?: boolean + rating?: boolean + comment?: boolean + createdAt?: boolean + updatedAt?: boolean + tripId?: boolean + userId?: boolean +} + +export type TripReviewOmit = runtime.Types.Extensions.GetOmit<"id" | "rating" | "comment" | "createdAt" | "updatedAt" | "tripId" | "userId", ExtArgs["result"]["tripReview"]> +export type TripReviewInclude = { + trip?: boolean | Prisma.TripDefaultArgs + user?: boolean | Prisma.UserDefaultArgs +} +export type TripReviewIncludeCreateManyAndReturn = { + trip?: boolean | Prisma.TripDefaultArgs + user?: boolean | Prisma.UserDefaultArgs +} +export type TripReviewIncludeUpdateManyAndReturn = { + trip?: boolean | Prisma.TripDefaultArgs + user?: boolean | Prisma.UserDefaultArgs +} + +export type $TripReviewPayload = { + name: "TripReview" + objects: { + trip: Prisma.$TripPayload + user: Prisma.$UserPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: string + rating: number + comment: string | null + createdAt: Date + updatedAt: Date + tripId: string + userId: string + }, ExtArgs["result"]["tripReview"]> + composites: {} +} + +export type TripReviewGetPayload = runtime.Types.Result.GetResult + +export type TripReviewCountArgs = + Omit & { + select?: TripReviewCountAggregateInputType | true + } + +export interface TripReviewDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['TripReview'], meta: { name: 'TripReview' } } + /** + * Find zero or one TripReview that matches the filter. + * @param {TripReviewFindUniqueArgs} args - Arguments to find a TripReview + * @example + * // Get one TripReview + * const tripReview = await prisma.tripReview.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__TripReviewClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one TripReview that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {TripReviewFindUniqueOrThrowArgs} args - Arguments to find a TripReview + * @example + * // Get one TripReview + * const tripReview = await prisma.tripReview.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__TripReviewClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first TripReview that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {TripReviewFindFirstArgs} args - Arguments to find a TripReview + * @example + * // Get one TripReview + * const tripReview = await prisma.tripReview.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__TripReviewClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first TripReview that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {TripReviewFindFirstOrThrowArgs} args - Arguments to find a TripReview + * @example + * // Get one TripReview + * const tripReview = await prisma.tripReview.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__TripReviewClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more TripReviews that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {TripReviewFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all TripReviews + * const tripReviews = await prisma.tripReview.findMany() + * + * // Get first 10 TripReviews + * const tripReviews = await prisma.tripReview.findMany({ take: 10 }) + * + * // Only select the `id` + * const tripReviewWithIdOnly = await prisma.tripReview.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a TripReview. + * @param {TripReviewCreateArgs} args - Arguments to create a TripReview. + * @example + * // Create one TripReview + * const TripReview = await prisma.tripReview.create({ + * data: { + * // ... data to create a TripReview + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__TripReviewClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many TripReviews. + * @param {TripReviewCreateManyArgs} args - Arguments to create many TripReviews. + * @example + * // Create many TripReviews + * const tripReview = await prisma.tripReview.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many TripReviews and returns the data saved in the database. + * @param {TripReviewCreateManyAndReturnArgs} args - Arguments to create many TripReviews. + * @example + * // Create many TripReviews + * const tripReview = await prisma.tripReview.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many TripReviews and only return the `id` + * const tripReviewWithIdOnly = await prisma.tripReview.createManyAndReturn({ + * select: { id: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> + + /** + * Delete a TripReview. + * @param {TripReviewDeleteArgs} args - Arguments to delete one TripReview. + * @example + * // Delete one TripReview + * const TripReview = await prisma.tripReview.delete({ + * where: { + * // ... filter to delete one TripReview + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__TripReviewClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one TripReview. + * @param {TripReviewUpdateArgs} args - Arguments to update one TripReview. + * @example + * // Update one TripReview + * const tripReview = await prisma.tripReview.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__TripReviewClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more TripReviews. + * @param {TripReviewDeleteManyArgs} args - Arguments to filter TripReviews to delete. + * @example + * // Delete a few TripReviews + * const { count } = await prisma.tripReview.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more TripReviews. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {TripReviewUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many TripReviews + * const tripReview = await prisma.tripReview.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more TripReviews and returns the data updated in the database. + * @param {TripReviewUpdateManyAndReturnArgs} args - Arguments to update many TripReviews. + * @example + * // Update many TripReviews + * const tripReview = await prisma.tripReview.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more TripReviews and only return the `id` + * const tripReviewWithIdOnly = await prisma.tripReview.updateManyAndReturn({ + * select: { id: true }, + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> + + /** + * Create or update one TripReview. + * @param {TripReviewUpsertArgs} args - Arguments to update or create a TripReview. + * @example + * // Update or create a TripReview + * const tripReview = await prisma.tripReview.upsert({ + * create: { + * // ... data to create a TripReview + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the TripReview we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__TripReviewClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of TripReviews. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {TripReviewCountArgs} args - Arguments to filter TripReviews to count. + * @example + * // Count the number of TripReviews + * const count = await prisma.tripReview.count({ + * where: { + * // ... the filter for the TripReviews we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a TripReview. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {TripReviewAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by TripReview. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {TripReviewGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends TripReviewGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: TripReviewGroupByArgs['orderBy'] } + : { orderBy?: TripReviewGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetTripReviewGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the TripReview model + */ +readonly fields: TripReviewFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for TripReview. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__TripReviewClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + trip = {}>(args?: Prisma.Subset>): Prisma.Prisma__TripClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + user = {}>(args?: Prisma.Subset>): Prisma.Prisma__UserClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the TripReview model + */ +export interface TripReviewFieldRefs { + readonly id: Prisma.FieldRef<"TripReview", 'String'> + readonly rating: Prisma.FieldRef<"TripReview", 'Int'> + readonly comment: Prisma.FieldRef<"TripReview", 'String'> + readonly createdAt: Prisma.FieldRef<"TripReview", 'DateTime'> + readonly updatedAt: Prisma.FieldRef<"TripReview", 'DateTime'> + readonly tripId: Prisma.FieldRef<"TripReview", 'String'> + readonly userId: Prisma.FieldRef<"TripReview", 'String'> +} + + +// Custom InputTypes +/** + * TripReview findUnique + */ +export type TripReviewFindUniqueArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null + /** + * Filter, which TripReview to fetch. + */ + where: Prisma.TripReviewWhereUniqueInput +} + +/** + * TripReview findUniqueOrThrow + */ +export type TripReviewFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null + /** + * Filter, which TripReview to fetch. + */ + where: Prisma.TripReviewWhereUniqueInput +} + +/** + * TripReview findFirst + */ +export type TripReviewFindFirstArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null + /** + * Filter, which TripReview to fetch. + */ + where?: Prisma.TripReviewWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of TripReviews to fetch. + */ + orderBy?: Prisma.TripReviewOrderByWithRelationInput | Prisma.TripReviewOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for TripReviews. + */ + cursor?: Prisma.TripReviewWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` TripReviews from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` TripReviews. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of TripReviews. + */ + distinct?: Prisma.TripReviewScalarFieldEnum | Prisma.TripReviewScalarFieldEnum[] +} + +/** + * TripReview findFirstOrThrow + */ +export type TripReviewFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null + /** + * Filter, which TripReview to fetch. + */ + where?: Prisma.TripReviewWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of TripReviews to fetch. + */ + orderBy?: Prisma.TripReviewOrderByWithRelationInput | Prisma.TripReviewOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for TripReviews. + */ + cursor?: Prisma.TripReviewWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` TripReviews from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` TripReviews. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of TripReviews. + */ + distinct?: Prisma.TripReviewScalarFieldEnum | Prisma.TripReviewScalarFieldEnum[] +} + +/** + * TripReview findMany + */ +export type TripReviewFindManyArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null + /** + * Filter, which TripReviews to fetch. + */ + where?: Prisma.TripReviewWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of TripReviews to fetch. + */ + orderBy?: Prisma.TripReviewOrderByWithRelationInput | Prisma.TripReviewOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing TripReviews. + */ + cursor?: Prisma.TripReviewWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` TripReviews from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` TripReviews. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of TripReviews. + */ + distinct?: Prisma.TripReviewScalarFieldEnum | Prisma.TripReviewScalarFieldEnum[] +} + +/** + * TripReview create + */ +export type TripReviewCreateArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null + /** + * The data needed to create a TripReview. + */ + data: Prisma.XOR +} + +/** + * TripReview createMany + */ +export type TripReviewCreateManyArgs = { + /** + * The data used to create many TripReviews. + */ + data: Prisma.TripReviewCreateManyInput | Prisma.TripReviewCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * TripReview createManyAndReturn + */ +export type TripReviewCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelectCreateManyAndReturn | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * The data used to create many TripReviews. + */ + data: Prisma.TripReviewCreateManyInput | Prisma.TripReviewCreateManyInput[] + skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewIncludeCreateManyAndReturn | null +} + +/** + * TripReview update + */ +export type TripReviewUpdateArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null + /** + * The data needed to update a TripReview. + */ + data: Prisma.XOR + /** + * Choose, which TripReview to update. + */ + where: Prisma.TripReviewWhereUniqueInput +} + +/** + * TripReview updateMany + */ +export type TripReviewUpdateManyArgs = { + /** + * The data used to update TripReviews. + */ + data: Prisma.XOR + /** + * Filter which TripReviews to update + */ + where?: Prisma.TripReviewWhereInput + /** + * Limit how many TripReviews to update. + */ + limit?: number +} + +/** + * TripReview updateManyAndReturn + */ +export type TripReviewUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * The data used to update TripReviews. + */ + data: Prisma.XOR + /** + * Filter which TripReviews to update + */ + where?: Prisma.TripReviewWhereInput + /** + * Limit how many TripReviews to update. + */ + limit?: number + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewIncludeUpdateManyAndReturn | null +} + +/** + * TripReview upsert + */ +export type TripReviewUpsertArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null + /** + * The filter to search for the TripReview to update in case it exists. + */ + where: Prisma.TripReviewWhereUniqueInput + /** + * In case the TripReview found by the `where` argument doesn't exist, create a new TripReview with this data. + */ + create: Prisma.XOR + /** + * In case the TripReview was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * TripReview delete + */ +export type TripReviewDeleteArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null + /** + * Filter which TripReview to delete. + */ + where: Prisma.TripReviewWhereUniqueInput +} + +/** + * TripReview deleteMany + */ +export type TripReviewDeleteManyArgs = { + /** + * Filter which TripReviews to delete + */ + where?: Prisma.TripReviewWhereInput + /** + * Limit how many TripReviews to delete. + */ + limit?: number +} + +/** + * TripReview without action + */ +export type TripReviewDefaultArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null +} diff --git a/app/generated/prisma/models/User.ts b/app/generated/prisma/models/User.ts index 2c32c84..3a5f587 100644 --- a/app/generated/prisma/models/User.ts +++ b/app/generated/prisma/models/User.ts @@ -200,6 +200,7 @@ export type UserWhereInput = { updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string trips?: Prisma.TripListRelationFilter participations?: Prisma.TripParticipantListRelationFilter + tripReviews?: Prisma.TripReviewListRelationFilter } export type UserOrderByWithRelationInput = { @@ -212,6 +213,7 @@ export type UserOrderByWithRelationInput = { updatedAt?: Prisma.SortOrder trips?: Prisma.TripOrderByRelationAggregateInput participations?: Prisma.TripParticipantOrderByRelationAggregateInput + tripReviews?: Prisma.TripReviewOrderByRelationAggregateInput } export type UserWhereUniqueInput = Prisma.AtLeast<{ @@ -227,6 +229,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{ updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string trips?: Prisma.TripListRelationFilter participations?: Prisma.TripParticipantListRelationFilter + tripReviews?: Prisma.TripReviewListRelationFilter }, "id" | "email"> export type UserOrderByWithAggregationInput = { @@ -265,6 +268,7 @@ export type UserCreateInput = { updatedAt?: Date | string trips?: Prisma.TripCreateNestedManyWithoutOrganizerInput participations?: Prisma.TripParticipantCreateNestedManyWithoutUserInput + tripReviews?: Prisma.TripReviewCreateNestedManyWithoutUserInput } export type UserUncheckedCreateInput = { @@ -277,6 +281,7 @@ export type UserUncheckedCreateInput = { updatedAt?: Date | string trips?: Prisma.TripUncheckedCreateNestedManyWithoutOrganizerInput participations?: Prisma.TripParticipantUncheckedCreateNestedManyWithoutUserInput + tripReviews?: Prisma.TripReviewUncheckedCreateNestedManyWithoutUserInput } export type UserUpdateInput = { @@ -289,6 +294,7 @@ export type UserUpdateInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string trips?: Prisma.TripUpdateManyWithoutOrganizerNestedInput participations?: Prisma.TripParticipantUpdateManyWithoutUserNestedInput + tripReviews?: Prisma.TripReviewUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateInput = { @@ -301,6 +307,7 @@ export type UserUncheckedUpdateInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string trips?: Prisma.TripUncheckedUpdateManyWithoutOrganizerNestedInput participations?: Prisma.TripParticipantUncheckedUpdateManyWithoutUserNestedInput + tripReviews?: Prisma.TripReviewUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateManyInput = { @@ -394,6 +401,20 @@ export type UserUpdateOneRequiredWithoutTripsNestedInput = { update?: Prisma.XOR, Prisma.UserUncheckedUpdateWithoutTripsInput> } +export type UserCreateNestedOneWithoutTripReviewsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.UserCreateOrConnectWithoutTripReviewsInput + connect?: Prisma.UserWhereUniqueInput +} + +export type UserUpdateOneRequiredWithoutTripReviewsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.UserCreateOrConnectWithoutTripReviewsInput + upsert?: Prisma.UserUpsertWithoutTripReviewsInput + connect?: Prisma.UserWhereUniqueInput + update?: Prisma.XOR, Prisma.UserUncheckedUpdateWithoutTripReviewsInput> +} + export type UserCreateNestedOneWithoutParticipationsInput = { create?: Prisma.XOR connectOrCreate?: Prisma.UserCreateOrConnectWithoutParticipationsInput @@ -417,6 +438,7 @@ export type UserCreateWithoutTripsInput = { createdAt?: Date | string updatedAt?: Date | string participations?: Prisma.TripParticipantCreateNestedManyWithoutUserInput + tripReviews?: Prisma.TripReviewCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutTripsInput = { @@ -428,6 +450,7 @@ export type UserUncheckedCreateWithoutTripsInput = { createdAt?: Date | string updatedAt?: Date | string participations?: Prisma.TripParticipantUncheckedCreateNestedManyWithoutUserInput + tripReviews?: Prisma.TripReviewUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutTripsInput = { @@ -455,6 +478,7 @@ export type UserUpdateWithoutTripsInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string participations?: Prisma.TripParticipantUpdateManyWithoutUserNestedInput + tripReviews?: Prisma.TripReviewUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutTripsInput = { @@ -466,6 +490,71 @@ export type UserUncheckedUpdateWithoutTripsInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string participations?: Prisma.TripParticipantUncheckedUpdateManyWithoutUserNestedInput + tripReviews?: Prisma.TripReviewUncheckedUpdateManyWithoutUserNestedInput +} + +export type UserCreateWithoutTripReviewsInput = { + id?: string + name: string + email: string + password: string + image?: string | null + createdAt?: Date | string + updatedAt?: Date | string + trips?: Prisma.TripCreateNestedManyWithoutOrganizerInput + participations?: Prisma.TripParticipantCreateNestedManyWithoutUserInput +} + +export type UserUncheckedCreateWithoutTripReviewsInput = { + id?: string + name: string + email: string + password: string + image?: string | null + createdAt?: Date | string + updatedAt?: Date | string + trips?: Prisma.TripUncheckedCreateNestedManyWithoutOrganizerInput + participations?: Prisma.TripParticipantUncheckedCreateNestedManyWithoutUserInput +} + +export type UserCreateOrConnectWithoutTripReviewsInput = { + where: Prisma.UserWhereUniqueInput + create: Prisma.XOR +} + +export type UserUpsertWithoutTripReviewsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.UserWhereInput +} + +export type UserUpdateToOneWithWhereWithoutTripReviewsInput = { + where?: Prisma.UserWhereInput + data: Prisma.XOR +} + +export type UserUpdateWithoutTripReviewsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + password?: Prisma.StringFieldUpdateOperationsInput | string + image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + trips?: Prisma.TripUpdateManyWithoutOrganizerNestedInput + participations?: Prisma.TripParticipantUpdateManyWithoutUserNestedInput +} + +export type UserUncheckedUpdateWithoutTripReviewsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + password?: Prisma.StringFieldUpdateOperationsInput | string + image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + trips?: Prisma.TripUncheckedUpdateManyWithoutOrganizerNestedInput + participations?: Prisma.TripParticipantUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateWithoutParticipationsInput = { @@ -477,6 +566,7 @@ export type UserCreateWithoutParticipationsInput = { createdAt?: Date | string updatedAt?: Date | string trips?: Prisma.TripCreateNestedManyWithoutOrganizerInput + tripReviews?: Prisma.TripReviewCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutParticipationsInput = { @@ -488,6 +578,7 @@ export type UserUncheckedCreateWithoutParticipationsInput = { createdAt?: Date | string updatedAt?: Date | string trips?: Prisma.TripUncheckedCreateNestedManyWithoutOrganizerInput + tripReviews?: Prisma.TripReviewUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutParticipationsInput = { @@ -515,6 +606,7 @@ export type UserUpdateWithoutParticipationsInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string trips?: Prisma.TripUpdateManyWithoutOrganizerNestedInput + tripReviews?: Prisma.TripReviewUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutParticipationsInput = { @@ -526,6 +618,7 @@ export type UserUncheckedUpdateWithoutParticipationsInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string trips?: Prisma.TripUncheckedUpdateManyWithoutOrganizerNestedInput + tripReviews?: Prisma.TripReviewUncheckedUpdateManyWithoutUserNestedInput } @@ -536,11 +629,13 @@ export type UserUncheckedUpdateWithoutParticipationsInput = { export type UserCountOutputType = { trips: number participations: number + tripReviews: number } export type UserCountOutputTypeSelect = { trips?: boolean | UserCountOutputTypeCountTripsArgs participations?: boolean | UserCountOutputTypeCountParticipationsArgs + tripReviews?: boolean | UserCountOutputTypeCountTripReviewsArgs } /** @@ -567,6 +662,13 @@ export type UserCountOutputTypeCountParticipationsArgs = { + where?: Prisma.TripReviewWhereInput +} + export type UserSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -578,6 +680,7 @@ export type UserSelect participations?: boolean | Prisma.User$participationsArgs + tripReviews?: boolean | Prisma.User$tripReviewsArgs _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs }, ExtArgs["result"]["user"]> @@ -615,6 +718,7 @@ export type UserOmit = { trips?: boolean | Prisma.User$tripsArgs participations?: boolean | Prisma.User$participationsArgs + tripReviews?: boolean | Prisma.User$tripReviewsArgs _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs } export type UserIncludeCreateManyAndReturn = {} @@ -625,6 +729,7 @@ export type $UserPayload[] participations: Prisma.$TripParticipantPayload[] + tripReviews: Prisma.$TripReviewPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: string @@ -1030,6 +1135,7 @@ export interface Prisma__UserClient = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> participations = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + tripReviews = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -1506,6 +1612,30 @@ export type User$participationsArgs = { + /** + * Select specific fields to fetch from the TripReview + */ + select?: Prisma.TripReviewSelect | null + /** + * Omit specific fields from the TripReview + */ + omit?: Prisma.TripReviewOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.TripReviewInclude | null + where?: Prisma.TripReviewWhereInput + orderBy?: Prisma.TripReviewOrderByWithRelationInput | Prisma.TripReviewOrderByWithRelationInput[] + cursor?: Prisma.TripReviewWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.TripReviewScalarFieldEnum | Prisma.TripReviewScalarFieldEnum[] +} + /** * User without action */ diff --git a/app/login/page.tsx b/app/login/page.tsx index 17ca9cb..fb2aa6d 100644 --- a/app/login/page.tsx +++ b/app/login/page.tsx @@ -1,13 +1,19 @@ "use client"; -import { useState } from "react"; +import { useState, Suspense } from "react"; import { signIn } from "next-auth/react"; -import { useRouter } from "next/navigation"; +import { useRouter, useSearchParams } from "next/navigation"; import Link from "next/link"; import Image from "next/image"; -export default function LoginPage() { +function safeInternalPath(raw: string | null): string { + if (!raw || !raw.startsWith("/") || raw.startsWith("//")) return "/"; + return raw; +} + +function LoginForm() { const router = useRouter(); + const searchParams = useSearchParams(); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); @@ -31,7 +37,8 @@ export default function LoginPage() { if (result?.error) { setError(result.error); } else { - router.push("/"); + const next = safeInternalPath(searchParams.get("callbackUrl")); + router.push(next); router.refresh(); } } @@ -126,3 +133,11 @@ export default function LoginPage() {
); } + +export default function LoginPage() { + return ( + + + + ); +} diff --git a/app/profile/page.tsx b/app/profile/page.tsx new file mode 100644 index 0000000..296a907 --- /dev/null +++ b/app/profile/page.tsx @@ -0,0 +1,217 @@ +import { redirect } from "next/navigation"; +import Image from "next/image"; +import Link from "next/link"; +import { getServerSession } from "next-auth"; +import { authOptions } from "@/lib/auth"; +import { profileService } from "@/server/services/profile.service"; +import { TripCard } from "@/features/trip/components/trip-card"; +import { ProfileTripRow } from "@/features/profile/components/profile-trip-row"; + +export default async function ProfilePage() { + const session = await getServerSession(authOptions); + if (!session?.user) { + redirect("/login?callbackUrl=/profile"); + } + + const data = await profileService.getProfileDashboard(session.user.id); + const { user, organizedTrips, activeJoined, cancelledJoined, reviewable } = + data; + + const memberSince = new Intl.DateTimeFormat("id-ID", { + month: "long", + year: "numeric", + }).format(user.createdAt); + + return ( +
+
+
+ {user.image ? ( + + ) : ( +
+ {user.name.charAt(0).toUpperCase()} +
+ )} +
+

+ {user.name} +

+

{user.email}

+

+ Anggota sejak {memberSince} +

+

+ Di sini kamu bisa lihat trip yang kamu buat sebagai{" "} + organizer, + trip yang kamu{" "} + ikuti{" "} + sebagai peserta, dan{" "} + ulasan untuk + trip yang sudah selesai (lewat halaman trip). +

+
+
+ + + Buat trip + +
+ + {/* Trip selesai — akses ulasan (trip ini tidak muncul di Open Trip) */} + {reviewable.length > 0 && ( +
+

+ Trip selesai & ulasan +

+

+ Trip yang sudah lewat tidak tampil di daftar Open Trip. Buka trip di + bawah ini lalu scroll ke bagian ulasan di halaman detail untuk + memberi atau mengubah rating. +

+
    + {reviewable.map((p) => { + const t = p.trip; + const hasReview = t.reviews.length > 0; + return ( +
  • + + {hasReview ? "Ubah ulasan →" : "Beri ulasan →"} + + } + /> +
  • + ); + })} +
+
+ )} + +
+
+

+ Trip yang kamu buat + + ({organizedTrips.length}) + +

+ {organizedTrips.length === 0 ? ( +

+ Belum ada trip.{" "} + + Buat trip pertama + +

+ ) : ( +
+ {organizedTrips.map((trip) => ( + + ))} +
+ )} +
+ +
+

+ Trip yang kamu ikuti + + ({activeJoined.length}) + +

+ {activeJoined.length === 0 ? ( +

+ Belum join trip.{" "} + + Cari open trip + +

+ ) : ( +
    + {activeJoined.map((p) => { + const t = p.trip; + return ( +
  • + + {p.status === "CONFIRMED" ? "Terdaftar" : p.status} + + } + /> +
  • + ); + })} +
+ )} + + {cancelledJoined.length > 0 && ( +
+

+ Riwayat batal ({cancelledJoined.length}) +

+
    + {cancelledJoined.map((p) => { + const t = p.trip; + return ( +
  • + Dibatalkan + } + /> +
  • + ); + })} +
+
+ )} +
+
+
+ ); +} diff --git a/app/trips/[id]/page.tsx b/app/trips/[id]/page.tsx index c719c55..e22e4a7 100644 --- a/app/trips/[id]/page.tsx +++ b/app/trips/[id]/page.tsx @@ -6,6 +6,11 @@ import { tripService } from "@/server/services/trip.service"; import { formatRupiah, formatDateRange } from "@/lib/utils"; import { JoinTripButton } from "@/features/trip/components/join-trip-button"; import { ImageGallery } from "@/features/trip/components/image-gallery"; +import { TripReviewSection } from "@/features/review/components/trip-review-section"; +import { + isPastTripLastDayForReview, + isTripDepartureDayPast, +} from "@/lib/trip-dates"; export default async function TripDetailPage({ params, @@ -38,6 +43,26 @@ export default async function TripDetailPage({ ) : null; + const isDeparturePast = isTripDepartureDayPast(trip.date); + const canReview = + !!session?.user && + !isOrganizer && + currentParticipation?.status === "CONFIRMED" && + isPastTripLastDayForReview(trip.date, trip.endDate); + + const myReview = session?.user + ? trip.reviews.find((r) => r.userId === session.user.id) ?? null + : null; + + const averageRating = + trip.reviews.length > 0 + ? Math.round( + (trip.reviews.reduce((s, r) => s + r.rating, 0) / + trip.reviews.length) * + 10 + ) / 10 + : null; + return (
{/* Breadcrumb */} @@ -180,6 +205,25 @@ export default async function TripDetailPage({ isJoined={!!currentParticipation} isFull={spotsLeft <= 0} tripStatus={trip.status} + isDeparturePast={isDeparturePast} + /> + + ({ + id: r.id, + rating: r.rating, + comment: r.comment, + createdAt: r.createdAt, + user: r.user, + }))} + averageRating={averageRating} + canReview={canReview} + myReview={ + myReview + ? { rating: myReview.rating, comment: myReview.comment } + : null + } /> {/* Participants List */} diff --git a/components/shared/navbar.tsx b/components/shared/navbar.tsx index 2de9ff4..d03e232 100644 --- a/components/shared/navbar.tsx +++ b/components/shared/navbar.tsx @@ -44,13 +44,26 @@ export function Navbar() { > Buat Trip + + Profil +
-
+ {session.user.name?.charAt(0).toUpperCase()} -
- + + {session.user.name} - + + ))} +
+
+
+ +