User Story: As a developer, I need a well-defined Prisma schema to effectively manage database operations for the app's features.
Description
Create a comprehensive Prisma schema that defines the data models for the cosplay-photographer scheduling app. This schema should cover user accounts, profiles, messaging, portfolio, bookings, reviews, and subscriptions. The database is managed on PlanetScale.
Acceptance Criteria
User Account Model: Define fields for user registration, authentication, and role (cosplayer/photographer).
Profile Model: Include details like bio, preferences, and portfolio links.
Messaging Model: Structure for storing messages, sender and receiver details.
Portfolio Model: Fields for image URLs, descriptions, and photographer details.
Booking Model: Schema for managing booking dates, user details, and status.
Review Model: Structure for ratings, text reviews, and associated user information.
Subscription Model: Define subscription tiers, user subscription details, and payment status.
Validation and Relations: Ensure proper relations between models and data validation rules.
Technical Notes
Utilize Prisma's latest features for schema definition and relationships.
Ensure scalability and performance optimization in the schema design.
Example Prisma Schema
model User {
id Int @id @default(autoincrement())
email String @unique
password String
role UserRole
profile Profile?
messages Message[]
bookings Booking[]
reviews Review[]
subscriptions Subscription[]
}
model Profile {
id Int @id @default(autoincrement())
userId Int
bio String?
portfolio String?
user User @relation(fields: [userId], references: [id])
}
model Message {
id Int @id @default(autoincrement())
content String
fromId Int
toId Int
fromUser User @relation("MessageFrom", fields: [fromId], references: [id])
toUser User @relation("MessageTo", fields: [toId], references: [id])
createdAt DateTime @default(now())
}
model Booking {
id Int @id @default(autoincrement())
date DateTime
status BookingStatus
userId Int
user User @relation(fields: [userId], references: [id])
}
model Review {
id Int @id @default(autoincrement())
rating Int
text String?
userId Int
user User @relation(fields: [userId], references: [id])
}
model Subscription {
id Int @id @default(autoincrement())
type SubscriptionType
status SubscriptionStatus
userId Int
user User @relation(fields: [userId], references: [id])
}
enum UserRole {
COSPLAYER
PHOTOGRAPHER
}
enum BookingStatus {
PENDING
CONFIRMED
CANCELLED
}
enum SubscriptionType {
BASIC
PREMIUM
}
enum SubscriptionStatus {
ACTIVE
INACTIVE
}
Dependencies
Familiarity with Prisma and its schema definition practices.
Ticket: Define Prisma Schema for App Features
User Story: As a developer, I need a well-defined Prisma schema to effectively manage database operations for the app's features.
Description
Create a comprehensive Prisma schema that defines the data models for the cosplay-photographer scheduling app. This schema should cover user accounts, profiles, messaging, portfolio, bookings, reviews, and subscriptions. The database is managed on PlanetScale.
Acceptance Criteria
Technical Notes
Example Prisma Schema
Dependencies
Time Estimate