training_data/packages/common/src/models/post.ts

78 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-02-20 20:02:27 +08:00
import {
Post,
Department,
Staff,
Enrollment,
Taxonomy,
Term,
} from "@prisma/client";
2025-02-05 15:10:40 +08:00
import { StaffDto } from "./staff";
2025-02-20 20:02:27 +08:00
import { TermDto } from "./term";
2025-02-05 15:10:40 +08:00
export type PostComment = {
id: string;
type: string;
title: string;
content: string;
authorId: string;
domainId: string;
referenceId: string;
resources: string[];
createdAt: Date;
updatedAt: Date;
parentId: string;
author: {
id: string;
showname: string;
username: string;
avatar: string;
};
2025-02-05 15:10:40 +08:00
};
export type PostDto = Post & {
readed: boolean;
readedCount: number;
author: StaffDto;
limitedComments: PostComment[];
commentsCount: number;
perms?: {
delete: boolean;
// edit: boolean;
};
watchableDepts: Department[];
watchableStaffs: Staff[];
};
export type LectureMeta = {
2025-02-21 17:32:25 +08:00
type?: string;
videoUrl?: string;
videoThumbnail?: string;
2025-02-23 20:12:25 +08:00
fileIds?: string[];
};
export type Lecture = Post & {
meta?: LectureMeta;
};
export type SectionMeta = {
objectives?: string[];
};
export type Section = Post & {
meta?: SectionMeta;
};
export type SectionDto = Section & {
lectures: Lecture[];
};
export type CourseMeta = {
thumbnail?: string;
requirements?: string[];
objectives?: string[];
};
export type Course = Post & {
meta?: CourseMeta;
};
export type CourseDto = Course & {
enrollments?: Enrollment[];
sections?: SectionDto[];
2025-02-20 20:02:27 +08:00
terms: Term[];
2025-02-05 15:10:40 +08:00
};