Эх сурвалжийг харах

Implement Angular Domain Model

Eldar Mukhtarov 9 сар өмнө
parent
commit
90870af364

+ 7 - 0
project/frontend-angular/src/app/models/grade.spec.ts

@@ -0,0 +1,7 @@
+import { Grade } from './grade';
+
+describe('Grade', () => {
+  it('should create an instance', () => {
+    expect(new Grade()).toBeTruthy();
+  });
+});

+ 15 - 0
project/frontend-angular/src/app/models/grade.ts

@@ -0,0 +1,15 @@
+import { Student } from "./student";
+import { Subject } from "./subject";
+
+export class Grade {
+  id?: number;
+  grade: number;
+  subject: Subject;
+  student: Student;
+
+  constructor(grade: number, subject: Subject, student: Student) {
+    this.grade = grade;
+    this.subject = subject;
+    this.student = student;
+  }
+}

+ 7 - 0
project/frontend-angular/src/app/models/student.spec.ts

@@ -0,0 +1,7 @@
+import { Student } from './student';
+
+describe('Student', () => {
+  it('should create an instance', () => {
+    expect(new Student()).toBeTruthy();
+  });
+});

+ 14 - 0
project/frontend-angular/src/app/models/student.ts

@@ -0,0 +1,14 @@
+import {Grade} from "./grade";
+
+export class Student {
+  id?: number;
+  firstname: string;
+  lastname: string;
+  grades: Grade[];
+
+  constructor(firstname: string, lastname: string) {
+    this.firstname = firstname;
+    this.lastname = lastname;
+    this.grades = [];
+  }
+}

+ 7 - 0
project/frontend-angular/src/app/models/subject.spec.ts

@@ -0,0 +1,7 @@
+import { Subject } from './subject';
+
+describe('Subject', () => {
+  it('should create an instance', () => {
+    expect(new Subject()).toBeTruthy();
+  });
+});

+ 11 - 0
project/frontend-angular/src/app/models/subject.ts

@@ -0,0 +1,11 @@
+import {Teacher} from "./teacher";
+
+export class Subject {
+  id?: number;
+  name: string;
+  teacher: Teacher | undefined;
+
+  constructor(name: string) {
+    this.name = name;
+  }
+}

+ 7 - 0
project/frontend-angular/src/app/models/teacher.spec.ts

@@ -0,0 +1,7 @@
+import { Teacher } from './teacher';
+
+describe('Teacher', () => {
+  it('should create an instance', () => {
+    expect(new Teacher()).toBeTruthy();
+  });
+});

+ 14 - 0
project/frontend-angular/src/app/models/teacher.ts

@@ -0,0 +1,14 @@
+import {Subject} from "./subject";
+
+export class Teacher {
+  id?: number;
+  firstname: string;
+  lastname: string;
+  subjects: Subject[];
+
+  constructor(firstname: string, lastname: string) {
+    this.firstname = firstname;
+    this.lastname = lastname;
+    this.subjects = [];
+  }
+}

+ 0 - 0
project/frontend-angular/src/app/student/student.css


+ 0 - 1
project/frontend-angular/src/app/student/student.html

@@ -1 +0,0 @@
-<p>student works!</p>

+ 0 - 23
project/frontend-angular/src/app/student/student.spec.ts

@@ -1,23 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { Student } from './student';
-
-describe('Student', () => {
-  let component: Student;
-  let fixture: ComponentFixture<Student>;
-
-  beforeEach(async () => {
-    await TestBed.configureTestingModule({
-      imports: [Student]
-    })
-    .compileComponents();
-
-    fixture = TestBed.createComponent(Student);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 11
project/frontend-angular/src/app/student/student.ts

@@ -1,11 +0,0 @@
-import { Component } from '@angular/core';
-
-@Component({
-  selector: 'app-student',
-  imports: [],
-  templateUrl: './student.html',
-  styleUrl: './student.css'
-})
-export class Student {
-
-}

+ 0 - 0
project/frontend-angular/src/app/teacher/teacher.css


+ 0 - 1
project/frontend-angular/src/app/teacher/teacher.html

@@ -1 +0,0 @@
-<p>teacher works!</p>

+ 0 - 23
project/frontend-angular/src/app/teacher/teacher.spec.ts

@@ -1,23 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { Teacher } from './teacher';
-
-describe('Teacher', () => {
-  let component: Teacher;
-  let fixture: ComponentFixture<Teacher>;
-
-  beforeEach(async () => {
-    await TestBed.configureTestingModule({
-      imports: [Teacher]
-    })
-    .compileComponents();
-
-    fixture = TestBed.createComponent(Teacher);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 11
project/frontend-angular/src/app/teacher/teacher.ts

@@ -1,11 +0,0 @@
-import { Component } from '@angular/core';
-
-@Component({
-  selector: 'app-teacher',
-  imports: [],
-  templateUrl: './teacher.html',
-  styleUrl: './teacher.css'
-})
-export class Teacher {
-
-}