model Account { id String @id @default(uuid()) email String @unique passwordHash String…
- User
model Account { id String @id @default(uuid()) email String @unique passwordHash String roleId String role Role @relation(fields: [roleId], references: [id]) isActive Boolean @default(true) lastLoginAt DateTime? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt
// Связи с профилями разных типов profileId String profileType ProfileType profile Profile @relation(fields: [profileId], references: [id]) }
model Profile { id String @id @default(uuid()) accountId String @unique account Account @relation(fields: [accountId], references: [id]) type ProfileType firstName String? lastName String? profileImage String? bio String? @db.Text createdAt DateTime @default(now()) updatedAt DateTime @updatedAt
// Дополнительные поля для разных типов профилей nickname String? rank String? unit String? city String? birthDate DateTime? registeredAt DateTime? community String? specialization String? department String? description String? @db.Text isElite Boolean? @default(false) }
enum ProfileType { STUDENT TEACHER ADMIN }
// Модель курса с расширенной функциональностью model Course { id String @id @default(uuid()) title String description String? @db.Text imageUrl String? // URL изображения курса
// Даты проведения startDate DateTime endDate DateTime
// Связи с преподавателем teacherId String teacher Profile @relation(fields: [teacherId], references: [id])
// Материалы и структура курса materials CourseMaterial[] enrollments CourseEnrollment[] homework CourseHomework[] // Добавлено
// Мета-информация version String? // Например "V5" для "Курс Молодого Бойца V5" category CourseCategory // Добавлено isPublished Boolean @default(false)
// Timestamps createdAt DateTime @default(now()) updatedAt DateTime @updatedAt }
// Материалы курса model CourseMaterial { id String @id @default(uuid()) courseId String course Course @relation(fields: [courseId], references: [id]) title String content String @db.Text type MaterialType order Int
createdAt DateTime @default(now()) updatedAt DateTime @updatedAt }
// Типы материалов курса enum MaterialType { LECTURE PRACTICE TEST ASSIGNMENT }
// Зачисление на курс model CourseEnrollment { id String @id @default(uuid()) courseId String course Course @relation(fields: [courseId], references: [id]) studentId String student Profile @relation(fields: [studentId], references: [id])
// Статус и прогресс status EnrollmentStatus courseProgress Float @default(0) // Общий прогресс курса в процентах homeworkProgress Float @default(0) // Прогресс по домашним заданиям в процентах
// Оценка grade Float? // Баллы за курс (например, 5.0) isCompleted Boolean @default(false)
- Assistant
- User
напиши полностью а не почастям
- Assistant
- User
а вот смотри. у нас есть несколько ролей которые находятся в разных таблицах. а что если нужно будет добавлять новые роли тогда и новые таблицы нужно будет создавать. как сделать чтоб было универсальное решение с учётом того что роли будут иметь свой уровень доступа к системе. и всё равно у тебя дополнительные таблицы StudentProfile, TeacherProfile и AdminProfile. договорились же что будем использовать универсальное решение. слишком много полей у некоторых моделей. сделай декомпозицию
- Assistant
- User
убери additionalData Json? нужна строгая структура
- Assistant