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

91 lines
1.6 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-26 16:11:08 +08:00
import { ResourceDto } from "./resource";
2025-02-26 23:18:14 +08:00
import { DepartmentDto } from "./department";
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[];
2025-02-26 23:18:14 +08:00
terms:TermDto[]
depts:DepartmentDto[]
};
export type LectureMeta = {
2025-02-21 17:32:25 +08:00
type?: string;
2025-02-26 16:35:59 +08:00
views?: number;
videoUrl?: string;
videoThumbnail?: string;
2025-02-23 21:43:06 +08:00
videoIds?: string[];
videoThumbnailIds?: string[];
};
export type Lecture = Post & {
2025-02-26 16:11:08 +08:00
resources?: ResourceDto[];
meta?: LectureMeta;
};
export type SectionMeta = {
objectives?: string[];
};
export type Section = Post & {
meta?: SectionMeta;
};
export type SectionDto = Section & {
lectures: Lecture[];
};
export type CourseMeta = {
thumbnail?: string;
2025-02-23 22:51:37 +08:00
objectives?: string[];
2025-02-24 09:33:13 +08:00
views?: number;
likes?: number;
hates?: number;
};
export type Course = Post & {
meta?: CourseMeta;
};
export type CourseDto = Course & {
enrollments?: Enrollment[];
sections?: SectionDto[];
2025-02-25 16:43:42 +08:00
terms: TermDto[];
2025-02-24 19:56:43 +08:00
lectureCount?: number;
2025-02-26 16:11:08 +08:00
depts: Department[];
2025-02-26 22:03:18 +08:00
studentIds: string[];
2025-02-05 15:10:40 +08:00
};