generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" } enum Role { USER ADMIN USER_MODERATOR LISTING_MODERATOR } enum UserStatus { PENDING ACTIVE DISABLED REJECTED REMOVED } enum ListingStatus { DRAFT PENDING PUBLISHED REJECTED REMOVED } enum EvCharging { NONE FREE PAID } model User { id String @id @default(cuid()) email String @unique passwordHash String @default("") name String? role Role @default(USER) status UserStatus @default(PENDING) emailVerifiedAt DateTime? approvedAt DateTime? rejectedAt DateTime? rejectedReason String? removedAt DateTime? removedById String? removedReason String? listings Listing[] approvedListings Listing[] @relation("ListingApprovedBy") verificationTokens VerificationToken[] createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model Listing { id String @id @default(cuid()) ownerId String owner User @relation(fields: [ownerId], references: [id]) status ListingStatus @default(PENDING) approvedAt DateTime? approvedById String? approvedBy User? @relation("ListingApprovedBy", fields: [approvedById], references: [id]) rejectedAt DateTime? rejectedById String? rejectedReason String? removedAt DateTime? removedById String? removedReason String? country String region String city String streetAddress String? addressNote String? latitude Float? longitude Float? maxGuests Int bedrooms Int beds Int bathrooms Int hasSauna Boolean @default(false) hasFireplace Boolean @default(false) hasWifi Boolean @default(false) petsAllowed Boolean @default(false) byTheLake Boolean @default(false) hasAirConditioning Boolean @default(false) evCharging EvCharging @default(NONE) priceHintPerNightCents Int? contactName String contactEmail String contactPhone String? externalUrl String? published Boolean @default(true) translations ListingTranslation[] images ListingImage[] createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model ListingTranslation { id String @id @default(cuid()) listingId String listing Listing @relation(fields: [listingId], references: [id]) locale String title String slug String description String teaser String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@unique([listingId, locale]) @@unique([slug, locale]) } model ListingImage { id String @id @default(cuid()) listingId String listing Listing @relation(fields: [listingId], references: [id]) url String altText String? isCover Boolean @default(false) order Int @default(0) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model VerificationToken { id String @id @default(cuid()) userId String user User @relation(fields: [userId], references: [id]) token String @unique type String expiresAt DateTime consumedAt DateTime? createdAt DateTime @default(now()) @@index([userId]) }