fix: Add missing relations to Prisma schema (Pet/Booking, Invoice/Booking)
This commit is contained in:
@@ -9,6 +9,19 @@ COPY . .
|
||||
RUN npx prisma generate
|
||||
RUN npm run build
|
||||
|
||||
FROM node:22-alpine AS dev
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json yarn.lock* ./
|
||||
RUN yarn install --frozen-lockfile 2>/dev/null || npm install
|
||||
|
||||
COPY . .
|
||||
RUN npx prisma generate
|
||||
|
||||
EXPOSE 3000
|
||||
CMD ["npm", "run", "start:dev"]
|
||||
|
||||
FROM node:22-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
+23
-14
@@ -1,3 +1,12 @@
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
model Client {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
@@ -15,6 +24,7 @@ model Client {
|
||||
bookings Booking[]
|
||||
invoices Invoice[]
|
||||
messages Message[] @relation("ClientMessages")
|
||||
pricing ClientPricing[]
|
||||
|
||||
@@map("clients")
|
||||
}
|
||||
@@ -27,13 +37,14 @@ model Pet {
|
||||
species String
|
||||
breed String?
|
||||
age Int?
|
||||
weight String? // e.g. "55 lbs"
|
||||
weight String?
|
||||
color String?
|
||||
tags String[] @default([])
|
||||
notes String? @default("")
|
||||
customFields Json?
|
||||
clientId String
|
||||
client Client @relation(fields: [clientId], references: [id], onDelete: Cascade)
|
||||
bookings Booking[] @relation("PetBookings")
|
||||
|
||||
@@map("pets")
|
||||
}
|
||||
@@ -44,10 +55,11 @@ model Service {
|
||||
updatedAt DateTime @updatedAt
|
||||
name String
|
||||
description String @default("")
|
||||
duration Int // minutes
|
||||
basePrice Float // dollars
|
||||
duration Int
|
||||
basePrice Float
|
||||
|
||||
perClientPricing ClientPricing[]
|
||||
bookings Booking[]
|
||||
|
||||
@@map("services")
|
||||
}
|
||||
@@ -57,7 +69,7 @@ model ClientPricing {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
price Float
|
||||
discountType String @default("none") // none, percentage, flat
|
||||
discountType String @default("none")
|
||||
discountValue Float @default(0)
|
||||
|
||||
serviceId String
|
||||
@@ -78,7 +90,6 @@ model Booking {
|
||||
status BookingStatus @default(scheduled)
|
||||
notes String? @default("")
|
||||
customFields Json?
|
||||
|
||||
clientId String
|
||||
client Client @relation(fields: [clientId], references: [id])
|
||||
serviceId String
|
||||
@@ -86,10 +97,9 @@ model Booking {
|
||||
assignedStaff String?
|
||||
priceOverride Float?
|
||||
petId String?
|
||||
pet Pet? @relation(fields: [petId], references: [id])
|
||||
invoice Invoice?
|
||||
|
||||
recurringRule Json? // { interval: "weekly" | "biweekly" | "monthly", count: Int, endDate: DateTime? }
|
||||
pet Pet? @relation("PetBookings", fields: [petId], references: [id])
|
||||
invoice Invoice? @relation(references: [id])
|
||||
recurringRule Json?
|
||||
|
||||
@@map("bookings")
|
||||
}
|
||||
@@ -117,10 +127,9 @@ model Invoice {
|
||||
|
||||
clientId String
|
||||
client Client @relation(fields: [clientId], references: [id])
|
||||
bookingId String?
|
||||
booking Booking? @relation(fields: [bookingId], references: [id])
|
||||
|
||||
items InvoiceItem[]
|
||||
bookingId String? @unique
|
||||
booking Booking? @relation(references: [id])
|
||||
invoiceItems InvoiceItem[]
|
||||
|
||||
@@map("invoices")
|
||||
}
|
||||
@@ -156,7 +165,7 @@ model Message {
|
||||
|
||||
clientId String
|
||||
client Client @relation("ClientMessages", fields: [clientId], references: [id])
|
||||
staffId String // staff member identifier
|
||||
staffId String
|
||||
|
||||
@@map("messages")
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ async function bootstrap() {
|
||||
SwaggerModule.setup('api/docs', app, document);
|
||||
|
||||
const port = process.env.PORT || 3000;
|
||||
await app.listen(port);
|
||||
console.log(`API running on http://localhost:${port}`);
|
||||
await app.listen(port, '0.0.0.0');
|
||||
console.log(`API running on http://0.0.0.0:${port}`);
|
||||
}
|
||||
bootstrap();
|
||||
|
||||
+2
-17
@@ -47,7 +47,7 @@ services:
|
||||
JWT_SECRET: ${JWT_SECRET:-change-me-in-production}
|
||||
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY:-sk_test_placeholder}
|
||||
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET:-whsec_placeholder}
|
||||
CORS_ORIGIN: http://localhost:3001
|
||||
CORS_ORIGIN: "*"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
@@ -70,27 +70,12 @@ services:
|
||||
ports:
|
||||
- "3001:3001"
|
||||
environment:
|
||||
REACT_APP_API_URL: http://localhost:3000
|
||||
REACT_APP_API_URL: http://api:3000
|
||||
depends_on:
|
||||
- api
|
||||
networks:
|
||||
- petmaster-net
|
||||
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: petmaster-nginx
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./web/nginx.conf:/etc/nginx/nginx.conf
|
||||
depends_on:
|
||||
- web
|
||||
- api
|
||||
networks:
|
||||
- petmaster-net
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
driver: local
|
||||
|
||||
@@ -9,6 +9,18 @@ RUN yarn install --frozen-lockfile 2>/dev/null || npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM node:22-alpine AS dev
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json yarn.lock* ./
|
||||
RUN yarn install
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 3001
|
||||
CMD ["npm", "run", "start", "--", "--port", "3001"]
|
||||
|
||||
FROM nginx:alpine
|
||||
COPY --from=builder /app/build /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
Reference in New Issue
Block a user