Data structure
Assignment
Entity
import {
Column, CreateDateColumn, UpdateDateColumn,
Entity, PrimaryGeneratedColumn, OneToMany, ManyToOne
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { AssignmentTask } from '../assignmenttasks/assignmenttask.entity'
import { Submission } from '../submissions/submission.entity'
import { User } from '../users/user.entity'
@Entity()
export class Assignment {
@PrimaryGeneratedColumn()
id: number;
@Column()
title: string;
@Column({ nullable: true })
description: string;
@Column({ nullable: true })
type: string;
@Column({ default: false })
public: boolean;
@Column({ nullable: true, type: "timestamp" })
dueDate: Date;
@CreateDateColumn({ type: "timestamp" })
createdAt: Date;
@UpdateDateColumn({ type: "timestamp" })
updatedAt: Date;
@OneToMany(() => AssignmentTask, assignmentTask => assignmentTask.assignment)
@ApiProperty({ type: Number })
assignmentTasks: AssignmentTask[];
@OneToMany(() => Submission, submission => submission.id)
@ApiProperty({ type: Number })
submissions: Submission[];
@ManyToOne(() => User)
@ApiProperty({ type: Number })
owner: User;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Data Transfer Object
export class CreateAssignmentDto {
title: string;
description: string;
dueDate: Date;
}
1
2
3
4
5
2
3
4
5
Comment
Entity
import {
Column, Entity,
PrimaryGeneratedColumn, CreateDateColumn,
UpdateDateColumn, ManyToOne
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { User } from '../users/user.entity'
import { Task } from '../tasks/task.entity'
@Entity()
export class Comment {
@PrimaryGeneratedColumn()
id: number;
@Column({ nullable: true })
content: string;
@Column({ default: 1 })
stars: number;
@CreateDateColumn({ type: "timestamp" })
createdAt: Date;
@UpdateDateColumn({ type: "timestamp" })
updatedAt: Date;
@ManyToOne(() => User)
@ApiProperty({ type: Number })
owner: User;
@ManyToOne(() => Task)
@ApiProperty({ type: Number })
task: Task;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Data Transfer Object
export class CreateCommentDto {
content: string;
stars: number;
owner: number;
task: number;
}
1
2
3
4
5
6
2
3
4
5
6
Domain
Entity
import {
Column, Entity,
PrimaryGeneratedColumn, CreateDateColumn,
UpdateDateColumn, OneToMany
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { Task } from '../tasks/task.entity'
@Entity()
export class Domain {
@PrimaryGeneratedColumn()
id: number;
@Column({ nullable: true })
name: string;
@Column({ nullable: true })
description: string;
@CreateDateColumn({ type: "timestamp" })
createdAt: Date;
@UpdateDateColumn({ type: "timestamp" })
updatedAt: Date;
@OneToMany(() => Task, task => task.domain)
@ApiProperty({ type: Number })
tasks: Task[];
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Data Transfer Object
export class CreateDomainDto {
name: string;
description: string;
}
1
2
3
4
2
3
4
Rating
Entity
import {
Column, CreateDateColumn, UpdateDateColumn,
Entity, PrimaryGeneratedColumn, ManyToOne
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { Domain } from '../domains/domain.entity'
@Entity()
export class Rating {
@PrimaryGeneratedColumn()
id: number;
@Column()
type: string;
@Column()
ownerid: number;
@Column({ type: "real" })
value: number;
@Column({ type: "real" })
deviation: number;
@Column({ type: "real" })
volatility: number;
@Column({ type: "real" })
result: number;
@Column()
latest: boolean;
@CreateDateColumn({ type: "timestamp" })
createdAt: Date;
@UpdateDateColumn({ type: "timestamp" })
updatedAt: Date;
@ManyToOne(() => Domain)
@ApiProperty({ type: Number })
domain: Domain;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Data Transfer Object
export class CreateRatingDto {
type: string;
ownerid: number;
domain: number;
value: number;
deviation: number;
volatility: number;
result: number;
latest?: boolean;
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Submission
Entity
import {
Column, Entity,
PrimaryGeneratedColumn, CreateDateColumn,
UpdateDateColumn, OneToMany, ManyToOne
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { User } from '../users/user.entity';
import { Task } from '../tasks/task.entity';
import { AssignmentTask } from '../assignmenttasks/assignmenttask.entity'
import { Assignment } from '../assignments/assignment.entity'
export type levelType = 'task' | 'assignment'
@Entity()
export class Submission {
@PrimaryGeneratedColumn()
id: number;
@Column({ nullable: true })
course: string;
@Column({ nullable: true })
plugin: string;
@Column({ nullable: true, type: "json" })
solution: object;
@Column({ nullable: true, type: "real" })
grade: number;
@Column({ nullable: true, type: "json" })
feedback: object;
@Column({ default: true })
rated: boolean;
@Column({ nullable: true, type: "real" })
rating: number;
@Column({ type: "enum", enum: ['task', 'assignment'], default: 'task' })
level: levelType;
@CreateDateColumn({ type: "timestamp" })
createdAt: Date;
@UpdateDateColumn({ type: "timestamp" })
updatedAt: Date;
@ManyToOne(() => Task, task => task.submissions)
@ApiProperty({ type: Number })
task: Task;
@ManyToOne(() => AssignmentTask, assignmentTask => assignmentTask.submissions)
@ApiProperty({ type: Number })
assignmentTask: AssignmentTask;
@ManyToOne(() => Assignment, assignment => assignment.submissions)
@ApiProperty({ type: Number })
assignment: AssignmentTask;
@ManyToOne(() => User, user => user.submissions)
@ApiProperty({ type: Number })
user: User;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Data Transfer Object
export class CreateSubmissionDto {
course: string;
plugin: string;
solution: object;
task: number;
assignment: number;
assignmentTask: number;
user: number;
level?: string;
rated: boolean;
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Task
Entity
import {
Column, Entity,
PrimaryGeneratedColumn, CreateDateColumn,
UpdateDateColumn, OneToMany, ManyToOne
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { AssignmentTask } from '../assignmenttasks/assignmenttask.entity'
import { Submission } from '../submissions/submission.entity'
import { Domain } from '../domains/domain.entity'
import { User } from '../users/user.entity'
@Entity()
export class Task {
@PrimaryGeneratedColumn()
id: number;
@Column({ nullable: true })
title: string;
@Column({ nullable: true })
description: string;
@Column({ default: false })
public: boolean;
@Column({ nullable: true, type: "real" })
rating: number;
@Column("text", { array: true, default: '{}' })
tags: string[];
@Column({ nullable: true })
plugin: string;
@Column({ nullable: true, type: "json" })
details: object;
@CreateDateColumn({ type: "timestamp" })
createdAt: Date;
@UpdateDateColumn({ type: "timestamp" })
updatedAt: Date;
@OneToMany(() => AssignmentTask, assignmentTask => assignmentTask.task)
@ApiProperty({ type: Number })
assignmentTasks: AssignmentTask[];
@OneToMany(() => Submission, submission => submission.id)
@ApiProperty({ type: Number })
submissions: Submission[];
@ManyToOne(() => Domain, domain => domain.tasks)
@ApiProperty({ type: Number })
domain: Domain;
@ManyToOne(() => User)
@ApiProperty({ type: Number })
owner: User;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Data Transfer Object
export class CreateTaskDto {
title: string;
description: string;
public: boolean;
plugin: string;
details: any;
domain: number;
tags?: string[];
rating?: number;
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
User
Entity
import { Column, Entity, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { Submission } from '../submissions/submission.entity'
@Entity()
export class User {
@PrimaryGeneratedColumn()
id: number;
@Column({ nullable: true })
ltiid: number;
@Column({ unique: true })
name: string;
@Column({ nullable: true, select: false })
password: string;
@Column({ nullable: true, unique: true, select: false })
email: string;
@Column({ nullable: true })
role: string;
@Column({ nullable: true })
origin: string;
@Column({ default: true })
isActive: boolean;
@OneToMany(() => Submission, submission => submission.id)
@ApiProperty({ type: Number })
submissions: Submission[];
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Data Transfer Object
export class CreateUserDto {
name: string;
password?: string;
email?: string;
role: string;
origin: string;
ltiid?: number;
isActive?: boolean;
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9