kreativortex/types/prisma.ts
Jessica Rekcah 0d339a35e2 init
2025-11-29 10:25:34 +07:00

174 lines
3.4 KiB
TypeScript

/**
* File: prisma.ts
* Created by: AI Assistant
* Date: 2025-11-29
* Purpose: Prisma type definitions for kreatiVortex platform
* Part of: kreatiVortex - Platform Pembelajaran Tari Online
*/
export interface UserWithRelations {
id: string;
name: string;
email: string;
emailVerified: boolean;
image?: string;
createdAt: Date;
updatedAt: Date;
role: UserRole;
profile?: UserProfile;
classesTeaching?: Class[];
classesEnrolled?: Class[];
videos?: Video[];
forumPosts?: ForumPost[];
assignments?: Assignment[];
}
export interface UserRole {
id: string;
name: 'ADMINISTRATOR' | 'PENDIDIK' | 'CALON_PENDIDIK' | 'UMUM';
description: string;
permissions: string[];
}
export interface UserProfile {
id: string;
userId: string;
nim?: string;
phone?: string;
address?: string;
bio?: string;
avatar?: string;
createdAt: Date;
updatedAt: Date;
}
export interface Class {
id: string;
name: string;
description: string;
code: string;
educatorId: string;
educator: UserWithRelations;
isActive: boolean;
maxStudents?: number;
createdAt: Date;
updatedAt: Date;
createdBy: string;
updatedBy: string;
students?: UserWithRelations[];
videos?: Video[];
forums?: Forum[];
assignments?: Assignment[];
}
export interface Video {
id: string;
title: string;
description?: string;
videoUrl: string;
videoType: 'YOUTUBE' | 'LOCAL';
thumbnailUrl?: string;
duration?: number;
uploaderId: string;
uploader: UserWithRelations;
classId?: string;
class?: Class;
isPublic: boolean;
viewCount: number;
createdAt: Date;
updatedAt: Date;
createdBy: string;
updatedBy: string;
comments?: Comment[];
}
export interface Forum {
id: string;
title: string;
description?: string;
type: 'GENERAL' | 'CLASS';
classId?: string;
class?: Class;
createdBy: string;
creator: UserWithRelations;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
updatedBy: string;
posts?: ForumPost[];
}
export interface ForumPost {
id: string;
title: string;
content: string;
forumId: string;
forum: Forum;
authorId: string;
author: UserWithRelations;
parentId?: string;
parent?: ForumPost;
replies?: ForumPost[];
isPinned: boolean;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
updatedBy: string;
comments?: Comment[];
}
export interface Assignment {
id: string;
title: string;
description: string;
dueDate: Date;
classId: string;
class: Class;
educatorId: string;
educator: UserWithRelations;
maxScore: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
createdBy: string;
updatedBy: string;
submissions?: AssignmentSubmission[];
}
export interface AssignmentSubmission {
id: string;
assignmentId: string;
assignment: Assignment;
studentId: string;
student: UserWithRelations;
documentUrl: string;
documentType: string;
score?: number;
feedback?: string;
status: 'SUBMITTED' | 'REVIEWED' | 'REVISED' | 'APPROVED';
submittedAt: Date;
reviewedAt?: Date;
reviewedBy?: string;
reviewer?: UserWithRelations;
createdAt: Date;
updatedAt: Date;
updatedBy: string;
}
export interface Comment {
id: string;
content: string;
authorId: string;
author: UserWithRelations;
videoId?: string;
video?: Video;
forumPostId?: string;
forumPost?: ForumPost;
parentId?: string;
parent?: Comment;
replies?: Comment[];
isActive: boolean;
createdAt: Date;
updatedAt: Date;
updatedBy: string;
}