- PrismaModule/PrismaService на pg-адаптере (Prisma 7 без движка запросов) - DTO профиля и связей; служебные id/profileId не публикуются в GraphQL - ProfileService — единственное место запросов к БД - DataLoader'ы на каждый запрос: 1 SQL на профиль + по 1 на затронутую связь - GraphQLModule.forRootAsync кладёт лоадеры в контекст - клиент Prisma генерируется в src/, иначе сборка с rootDir src не видит его - DATABASE_URL для api-контейнера собирается в docker-compose
67 lines
1.5 KiB
Plaintext
67 lines
1.5 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Get a free hosted Postgres database in seconds: `npx create-db`
|
|
|
|
generator client {
|
|
provider = "prisma-client"
|
|
output = "../src/generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
model Profile {
|
|
id Int @id @default(autoincrement())
|
|
firstName String
|
|
lastName String
|
|
description String
|
|
skills Skill[]
|
|
links Link[]
|
|
experiences Experience[]
|
|
projects Project[]
|
|
}
|
|
|
|
model Skill {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
profileId Int
|
|
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([profileId])
|
|
}
|
|
|
|
model Link {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
link String
|
|
profileId Int
|
|
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([profileId])
|
|
}
|
|
|
|
model Project {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
link String
|
|
description String
|
|
profileId Int
|
|
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([profileId])
|
|
}
|
|
|
|
model Experience {
|
|
id Int @id @default(autoincrement())
|
|
company String
|
|
position String
|
|
period String
|
|
achievements String[] @default([])
|
|
profileId Int
|
|
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([profileId])
|
|
}
|