Skip to content

Commit 32effe7

Browse files
Merge pull request #51 from SELab-2/14-implement-logical-database-scheme
entity interfaces
2 parents f7aa4cd + d2074ed commit 32effe7

File tree

8 files changed

+86
-8
lines changed

8 files changed

+86
-8
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { GroupInterface } from "./group_interface";
2+
3+
export interface AssignmentInterface {
4+
id: string;
5+
uuid: string;
6+
start_date: Date;
7+
deadline: Date;
8+
extra_instructions: string;
9+
10+
set_start_date: (new_start_date: Date) => void;
11+
set_deadline: (new_deadline: Date) => void;
12+
set_extra_instructions: (new_instructions: string) => void;
13+
14+
get_groups: () => [GroupInterface];
15+
16+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { AssignmentInterface } from "./assignment_interface";
2+
import { GroupInterface } from "./group_interface";
3+
import { StudentInterface } from "./student_interface";
4+
import { TeacherInterface } from "./teacher_interface";
5+
6+
export interface ClassInterface {
7+
id: string;
8+
name: string;
9+
year: number;
10+
11+
set_year: (new_year: number) => void;
12+
set_name: (new_name: string) => void;
13+
14+
get_teachers: () => [TeacherInterface]; // Get this class' teachers.
15+
get_students: () => [StudentInterface]; // Get this class' students.
16+
create_invite_link: () => string; // Create an invite link for teachers and students to join the class.
17+
18+
get_assignments: () => [AssignmentInterface]; // Get the assignments for this class.
19+
create_assignment: () => AssignmentInterface; // Create a new assignment.
20+
21+
get_all_groups: () => [GroupInterface]; // Get all existing groups that consist exclusively of students from this class.
22+
23+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { ClassInterface } from "./class_interface";
2+
3+
export interface GroupInterface {
4+
id: string;
5+
class: ClassInterface;
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { ClassInterface } from "./class_interface"
2+
import { UserInterface } from "./user_interface";
3+
4+
export interface JoinRequestsInterface {
5+
get_class: () => ClassInterface; // Get the class that the users request to join.
6+
get_join_requests: () => [UserInterface]; // Get one list with both all students wanting to join and all teachers wanting to join.
7+
accept: (student_or_teacher: UserInterface) => void; // Accept a teacher or student (from the join request list) to enter the class.
8+
deny: (student_or_teacher: UserInterface) => void; // Deny a teacher or student (from the join request list) to enter the class.
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { AssignmentInterface } from "./assignment_interface";
2+
import { UserInterface } from "./user_interface";
3+
4+
export interface StudentInterface extends UserInterface {
5+
ask_question_for_assignment: (assignment: AssignmentInterface) => void; // TODO: correct arguments.
6+
send_submission_for_assignment: (assignment: AssignmentInterface) => void;
7+
}

backend/src/core/entities/teacher.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ITeacher } from "./teacher_interface";
1+
import { ClassInterface } from "./class_interface";
2+
import { TeacherInterface } from "./teacher_interface";
23

34
export class Teacher implements ITeacher {
45

@@ -8,6 +9,8 @@ export class Teacher implements ITeacher {
89
first_name: string; // Teacher's first name
910
family_name: string; // Teacher's family name
1011
password_hash: string; // Teacher's hashed password
12+
get_classes: () => [ClassInterface];
13+
create_class: () => ClassInterface;
1114

1215
// Optional variables
1316
name_school?: string; // Teacher's school
@@ -18,12 +21,17 @@ export class Teacher implements ITeacher {
1821
first_name: string,
1922
family_name: string,
2023
password_hash: string,
24+
get_classes: () => [ClassInterface],
25+
create_class: () => ClassInterface,
2126
name_school?: string) {
2227
this.id = id;
2328
this.email = email;
2429
this.first_name = first_name;
2530
this.family_name = family_name;
2631
this.password_hash = password_hash;
2732
this.name_school = name_school;
33+
this.get_classes = get_classes;
34+
this.create_class = create_class;
2835
}
36+
2937
}
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
export interface ITeacher {
2-
// Necessary variables
3-
id: string; // Teacher id
4-
email: string; // Teacher's email
5-
first_name: string; // Teacher's first name
6-
family_name: string; // Teacher's family name
7-
password_hash: string; // Teacher's hashed password
1+
import { ClassInterface } from "./class_interface";
2+
import { UserInterface } from "./user_interface";
83

4+
export interface TeacherInterface extends UserInterface{
95
// Optional variables
106
name_school?: string; // Teacher's school
7+
8+
create_class: () => ClassInterface;
119
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { ClassInterface } from "./class_interface";
2+
3+
export interface UserInterface {
4+
// Necessary variables
5+
id: string; // User's id
6+
email: string; // User's email
7+
first_name: string; // User's first name
8+
family_name: string; // User's family name
9+
password_hash: string; // User's hashed password
10+
get_classes: () => [ClassInterface];
11+
}

0 commit comments

Comments
 (0)