diff --git a/backend/src/controllers/teachers.ts b/backend/src/controllers/teachers.ts index 7376abed..7f1beb54 100644 --- a/backend/src/controllers/teachers.ts +++ b/backend/src/controllers/teachers.ts @@ -8,7 +8,8 @@ import { getStudentsByTeacher, getTeacher, } from '../services/teachers.js'; -import { TeacherDTO } from '../interfaces/teacher.js'; + +import { TeacherDTO } from 'dwengo-1-common/src/interfaces/teacher'; export async function getAllTeachersHandler(req: Request, res: Response): Promise { const full = req.query.full === 'true'; diff --git a/backend/src/interfaces/teacher-invitation.ts b/backend/src/interfaces/teacher-invitation.ts index 8a792280..8df92fd1 100644 --- a/backend/src/interfaces/teacher-invitation.ts +++ b/backend/src/interfaces/teacher-invitation.ts @@ -1,14 +1,7 @@ import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity.js'; import { mapToClassDTO } from './class.js'; import { mapToUserDTO } from './user.js'; -import { ClassDTO } from 'dwengo-1-common/src/interfaces/class'; -import { UserDTO } from 'dwengo-1-common/src/interfaces/user'; - -export interface TeacherInvitationDTO { - sender: string | UserDTO; - receiver: string | UserDTO; - class: string | ClassDTO; -} +import { TeacherInvitationDTO } from 'dwengo-1-common/src/interfaces/teacher-invitation'; export function mapToTeacherInvitationDTO(invitation: TeacherInvitation): TeacherInvitationDTO { return { diff --git a/backend/src/interfaces/teacher.ts b/backend/src/interfaces/teacher.ts index 31b4723f..a1ba33fd 100644 --- a/backend/src/interfaces/teacher.ts +++ b/backend/src/interfaces/teacher.ts @@ -1,18 +1,6 @@ import { Teacher } from '../entities/users/teacher.entity.js'; import { getTeacherRepository } from '../data/repositories.js'; - -export interface TeacherDTO { - id: string; - username: string; - firstName: string; - lastName: string; - endpoints?: { - classes: string; - questions: string; - invitations: string; - groups: string; - }; -} +import { TeacherDTO } from 'dwengo-1-common/src/interfaces/teacher'; export function mapToTeacherDTO(teacher: Teacher): TeacherDTO { return { diff --git a/backend/src/services/classes.ts b/backend/src/services/classes.ts index 542f8f19..ecc4b43e 100644 --- a/backend/src/services/classes.ts +++ b/backend/src/services/classes.ts @@ -1,9 +1,10 @@ import { getClassRepository, getStudentRepository, getTeacherInvitationRepository, getTeacherRepository } from '../data/repositories.js'; import { mapToClassDTO } from '../interfaces/class.js'; import { mapToStudentDTO, StudentDTO } from '../interfaces/student.js'; -import { mapToTeacherInvitationDTO, mapToTeacherInvitationDTOIds, TeacherInvitationDTO } from '../interfaces/teacher-invitation.js'; +import { mapToTeacherInvitationDTO, mapToTeacherInvitationDTOIds } from '../interfaces/teacher-invitation.js'; import { getLogger } from '../logging/initalize.js'; import { ClassDTO } from 'dwengo-1-common/src/interfaces/class'; +import { TeacherInvitationDTO } from 'dwengo-1-common/src/interfaces/teacher-invitation'; const logger = getLogger(); diff --git a/backend/src/services/teachers.ts b/backend/src/services/teachers.ts index eca54214..9589d0ba 100644 --- a/backend/src/services/teachers.ts +++ b/backend/src/services/teachers.ts @@ -3,8 +3,9 @@ import { mapToClassDTO } from '../interfaces/class.js'; import { getClassStudents } from './classes.js'; import { StudentDTO } from '../interfaces/student.js'; import { mapToQuestionDTO, mapToQuestionId, QuestionDTO, QuestionId } from '../interfaces/question.js'; -import { mapToTeacher, mapToTeacherDTO, TeacherDTO } from '../interfaces/teacher.js'; +import { mapToTeacher, mapToTeacherDTO } from '../interfaces/teacher.js'; import { ClassDTO } from 'dwengo-1-common/src/interfaces/class'; +import { TeacherDTO } from 'dwengo-1-common/src/interfaces/teacher'; export async function getAllTeachers(full: boolean): Promise { const teacherRepository = getTeacherRepository(); diff --git a/common/src/interfaces/teacher-invitation.d.ts b/common/src/interfaces/teacher-invitation.d.ts new file mode 100644 index 00000000..13709322 --- /dev/null +++ b/common/src/interfaces/teacher-invitation.d.ts @@ -0,0 +1,8 @@ +import { UserDTO } from './user'; +import { ClassDTO } from './class'; + +export interface TeacherInvitationDTO { + sender: string | UserDTO; + receiver: string | UserDTO; + class: string | ClassDTO; +} diff --git a/common/src/interfaces/teacher.d.ts b/common/src/interfaces/teacher.d.ts new file mode 100644 index 00000000..05bf74a0 --- /dev/null +++ b/common/src/interfaces/teacher.d.ts @@ -0,0 +1,12 @@ +export interface TeacherDTO { + id: string; + username: string; + firstName: string; + lastName: string; + endpoints?: { + classes: string; + questions: string; + invitations: string; + groups: string; + }; +}