it_solutions_test/prisma/schema.prisma
Илья Братских bd22447bd3 Add a GraphQL digital card that migrates and seeds itself on startup.
The NestJS API serves the public profile through Apollo Sandbox and loads only the relations selected by the query.
2026-11-02 05:30:54 +03:00

166 lines
3.7 KiB
Plaintext

// The profile is the aggregate root. Skills, jobs, projects, education and
// awards do not exist outside it and are replaced together when the seed changes.
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
datasource db {
provider = "postgresql"
}
model Profile {
id String @id @default(cuid())
slug String @unique
contentHash String
name String
title String
description String
location String
availability String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
links Link[]
skills Skill[]
experiences Experience[]
projects Project[]
education Education?
awards Award[]
}
enum LinkKind {
GITHUB
WEBSITE
TELEGRAM
EMAIL
PHONE
}
model Link {
id String @id @default(cuid())
profileId String
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
kind LinkKind
label String
url String
sortOrder Int
@@index([profileId, sortOrder])
}
enum SkillGroup {
LANGUAGE
BACKEND
FRONTEND
MOBILE
DATA
SYSTEMS
}
model Skill {
id String @id @default(cuid())
profileId String
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
name String
group SkillGroup
sortOrder Int
projects ProjectSkill[]
@@unique([profileId, name])
@@index([profileId, sortOrder])
}
model Experience {
id String @id @default(cuid())
profileId String
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
company String
position String
startYear Int
endYear Int?
summary String
sortOrder Int
achievements Achievement[]
@@index([profileId, sortOrder])
}
model Achievement {
id String @id @default(cuid())
experienceId String
experience Experience @relation(fields: [experienceId], references: [id], onDelete: Cascade)
description String
sortOrder Int
@@index([experienceId, sortOrder])
}
enum ProjectStatus {
ACTIVE
COMPLETED
PROTOTYPE
}
model Project {
id String @id @default(cuid())
profileId String
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
name String
url String?
description String
role String?
status ProjectStatus?
startYear Int?
endYear Int?
sortOrder Int
highlights ProjectHighlight[]
skills ProjectSkill[]
@@index([profileId, sortOrder])
}
model ProjectHighlight {
id String @id @default(cuid())
projectId String
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
text String
sortOrder Int
@@index([projectId, sortOrder])
}
model ProjectSkill {
projectId String
skillId String
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
skill Skill @relation(fields: [skillId], references: [id], onDelete: Cascade)
@@id([projectId, skillId])
@@index([skillId])
}
model Education {
id String @id @default(cuid())
profileId String @unique
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
institution String
specialty String
specialtyCode String
graduatedYear Int
}
model Award {
id String @id @default(cuid())
profileId String
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
title String
result String
year Int?
url String?
sortOrder Int
@@index([profileId, sortOrder])
}