diff --git a/backend/src/controllers/assignments.ts b/backend/src/controllers/assignments.ts index 16dbb310..e2978363 100644 --- a/backend/src/controllers/assignments.ts +++ b/backend/src/controllers/assignments.ts @@ -1,6 +1,7 @@ import { Request, Response } from 'express'; import { createAssignment, getAllAssignments, getAssignment, getAssignmentsSubmissions } from '../services/assignments.js'; -import { AssignmentDTO } from '../interfaces/assignment.js'; + +import { AssignmentDTO } from 'dwengo-1-common/src/interfaces/assignment'; // Typescript is annoy with with parameter forwarding from class.ts interface AssignmentParams { diff --git a/backend/src/interfaces/assignment.ts b/backend/src/interfaces/assignment.ts index eefa8c96..c437f155 100644 --- a/backend/src/interfaces/assignment.ts +++ b/backend/src/interfaces/assignment.ts @@ -2,17 +2,7 @@ import { FALLBACK_LANG } from '../config.js'; import { Assignment } from '../entities/assignments/assignment.entity.js'; import { Class } from '../entities/classes/class.entity.js'; import { languageMap } from '../entities/content/language.js'; -import { GroupDTO } from './group.js'; - -export interface AssignmentDTO { - id: number; - class: string; // Id of class 'within' - title: string; - description: string; - learningPath: string; - language: string; - groups?: GroupDTO[] | string[]; // TODO -} +import { AssignmentDTO } from 'dwengo-1-common/src/interfaces/assignment'; export function mapToAssignmentDTOId(assignment: Assignment): AssignmentDTO { return { diff --git a/backend/src/interfaces/group.ts b/backend/src/interfaces/group.ts index a25c5b8e..93701dce 100644 --- a/backend/src/interfaces/group.ts +++ b/backend/src/interfaces/group.ts @@ -1,6 +1,7 @@ import { Group } from '../entities/assignments/group.entity.js'; -import { AssignmentDTO, mapToAssignmentDTO } from './assignment.js'; +import { mapToAssignmentDTO } from './assignment.js'; import { mapToStudentDTO, StudentDTO } from './student.js'; +import { AssignmentDTO } from 'dwengo-1-common/src/interfaces/assignment'; export interface GroupDTO { assignment: number | AssignmentDTO; diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index a21a96fa..0d8807c5 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -1,6 +1,7 @@ import { getAssignmentRepository, getClassRepository, getGroupRepository, getSubmissionRepository } from '../data/repositories.js'; -import { AssignmentDTO, mapToAssignment, mapToAssignmentDTO, mapToAssignmentDTOId } from '../interfaces/assignment.js'; +import { mapToAssignment, mapToAssignmentDTO, mapToAssignmentDTOId } from '../interfaces/assignment.js'; import { mapToSubmissionDTO, mapToSubmissionDTOId, SubmissionDTO, SubmissionDTOId } from '../interfaces/submission.js'; +import { AssignmentDTO } from 'dwengo-1-common/src/interfaces/assignment'; export async function getAllAssignments(classid: string, full: boolean): Promise { const classRepository = getClassRepository(); diff --git a/backend/src/services/students.ts b/backend/src/services/students.ts index 66327b6d..5382a67c 100644 --- a/backend/src/services/students.ts +++ b/backend/src/services/students.ts @@ -1,10 +1,10 @@ import { getClassRepository, getGroupRepository, getStudentRepository, getSubmissionRepository } from '../data/repositories.js'; -import { AssignmentDTO } from '../interfaces/assignment.js'; import { ClassDTO, mapToClassDTO } from '../interfaces/class.js'; import { GroupDTO, mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; import { mapToStudent, mapToStudentDTO, StudentDTO } from '../interfaces/student.js'; import { mapToSubmissionDTO, mapToSubmissionDTOId, SubmissionDTO, SubmissionDTOId } from '../interfaces/submission.js'; import { getAllAssignments } from './assignments.js'; +import { AssignmentDTO } from 'dwengo-1-common/src/interfaces/assignment'; export async function getAllStudents(full: boolean): Promise { const studentRepository = getStudentRepository(); diff --git a/common/src/interfaces/answer.d.ts b/common/src/interfaces/answer.d.ts index 96ed063b..88cc07be 100644 --- a/common/src/interfaces/answer.d.ts +++ b/common/src/interfaces/answer.d.ts @@ -1,5 +1,5 @@ -import { UserDTO } from 'dwengo-1-backend/src/interfaces/user.js' -import { QuestionDTO } from 'dwengo-1-backend/src/interfaces/question.js' +import { UserDTO } from 'dwengo-1-backend/src/interfaces/user.js'; +import { QuestionDTO } from 'dwengo-1-backend/src/interfaces/question.js'; export interface AnswerDTO { author: UserDTO; diff --git a/common/src/interfaces/assignment.d.ts b/common/src/interfaces/assignment.d.ts new file mode 100644 index 00000000..88bf10c6 --- /dev/null +++ b/common/src/interfaces/assignment.d.ts @@ -0,0 +1,11 @@ +import { GroupDTO } from 'dwengo-1-backend/src/interfaces/group.js'; + +export interface AssignmentDTO { + id: number; + class: string; // Id of class 'within' + title: string; + description: string; + learningPath: string; + language: string; + groups?: GroupDTO[] | string[]; // TODO +}