瀏覽代碼

Data structure Prototype

master
kj1352 5 年之前
父節點
當前提交
85f4028c08
共有 4 個檔案被更改,包括 161 行新增10 行删除
  1. +29
    -10
      src/app/structure/course.ts
  2. +45
    -0
      src/app/structure/forum.ts
  3. +33
    -0
      src/app/structure/quiz.ts
  4. +54
    -0
      src/app/structure/test.ts

+ 29
- 10
src/app/structure/course.ts 查看文件

@@ -1,4 +1,7 @@
import { IUser } from './user';
import { IQuiz } from './quiz';
import { ITest } from './test';
import { IForum } from './forum';

export type ICourse = {
id: string | number,
@@ -6,9 +9,24 @@ export type ICourse = {
name: string,
description?: string,
code: string,
teacher : IUser,
chapterList: Array<IChapter>;
enrolledList: Array<IUser>;
teacher: IUser,
chapterList: Array<IChapter>,
enrolledList: Array<IUser>,
timeTable: Array<ISchedule>,
testList: Array<ITest>,
forum: IForum
};

export type ISchedule = {
id: string | number,
dateTime: Date,
attendanceList: Array<IAttendance>
};

export type IAttendance = {
student: IUser,
status: 'PRESENT' | 'ABSENT' | 'LATE',
additionalNote: string
};

export type IChapter = {
@@ -23,25 +41,26 @@ export type ITopic = {
id: string | number,
name: string,
description?: string,
media: IVideo | IAudio | IText,
type: 'VIDEO' | 'AUDIO' | 'RICH_TEXT' | 'QUIZ'
media: IVideo | IAudio | IRichText | IQuiz,
attachments: Array<IAttachment>,
};

type IVideo = {
export type IVideo = {
id: string | number,
url: string,
transcript: string,
notes: Array<INotes>
};

type IAudio = {
export type IAudio = {
id: string | number,
url: string,
transcript: string,
notes: Array<INotes>
};

type INotes = {
export type INotes = {
id: string | number,
seekTime: string,
type: 'PUBLIC' | 'PRIVATE',
@@ -49,19 +68,19 @@ type INotes = {
createdBy: IUser
};

type IText = {
export type IRichText = {
id: string | number,
transcript: string
};

type IAttachment = {
export type IAttachment = {
id: string | number,
name: string,
description?: string,
url: string
};

type IResource = {
export type IResource = {
id: string,
name: string,
description?: string,


+ 45
- 0
src/app/structure/forum.ts 查看文件

@@ -0,0 +1,45 @@
import { IUser } from './user';

export type IForum = {
id: string | number,
name: string,
description?: string,
moderatorList: Array<IUser>,
postList: Array<IPost>
};

export type IPost = {
id: string | number,
heading: string,
description: string,
isBookmarked: boolean,
hashTags: Array<string>,
taggedFriends: Array<IUser>,
externalLink: string,
files: Array<Blob>,
author: IUser,
dateTime: Date,
likedUsers: Array<IUser>,
dislikedUsers: Array<IUser>,
reports: Array<IReport>
commentList: Array<IComment>,
answerList: Array<IPost>
};

export type IComment = {
id: string | number,
description: string,
author: IUser,
dateTime: Date,
likedUsers: Array<IUser>,
dislikedUsers: Array<IUser>,
reports: Array<IReport>,
replyList: Array<IComment>,
replyThreadLimit: number
}

export type IReport = {
user: IUser,
description: string,
dateTime: Date
};

+ 33
- 0
src/app/structure/quiz.ts 查看文件

@@ -0,0 +1,33 @@
import { IUser } from './user';

export type IQuiz = {
id: string | number,
name: string,
description?: string,
questionList: Array<IQuestion>,
quizAttendanceList: Array<IQuizAttendance>,
canRetake: boolean
};

export type IQuizAttendance = {
student: IUser,
answerList: Array<IAnswer>
};

export type IAnswer = {
questionId: string,
answer: string
};

export type IQuestion = {
id: string | number,
question: string,
answer: string,
type: 'SINGLE_SELECT' | 'MULTI_SELECT' | 'FILL_IN_THE_BLANK',
optionList?: Array<IOption>
};

export type IOption = {
id: string | number,
heading: string
};

+ 54
- 0
src/app/structure/test.ts 查看文件

@@ -0,0 +1,54 @@
import { IUser } from './user';

export type ITest = {
id: string | number,
dateTime: Date,
durationInMinutes: number,
description?: string,
totalMarks: number,
rules: string,
categoricalQuestionList: Array<ICategory>,
canRetake: boolean,
testAttendanceList: Array<ITestAttendance>,
};

export type ITestAttendance = {
student: IUser,
answerList: Array<IAnswer>,
evaluator: IUser,
};

export type IAnswer = {
questionId: string,
answer: string,
status: 'CORRECT' | 'WRONG' | 'PARTIAL' // Using this so that the teacher can check the theoritical answers and decide the status,
marksAllotted?: string // For providing partial marks based on the textual answer written by the student
};

export type ICategory = {
unitValue: number,
maximumMarks: number, // So the teacher can add extra questions
description?: string,
question: IQuestion,
};

export type IQuestion = {
id: string | number,
heading: string,
answer: string | Array<string>
type: 'TEXT' | 'SINGLE_SELECT' | 'MULTI_SELECT' | 'MATCH_THE_FOLLOWING',
options?: Array<IOption>,
leftGroup?: Array<IMatchOption>,
rightGroup?: Array<IMatchOption>,
};

export type IOption = {
id: string | number,
name: string,
};

export type IMatchOption = {
id: string,
color: string,
name: string
};