refactor(common): Assignments
This commit is contained in:
parent
4b1c343592
commit
757c89d841
7 changed files with 21 additions and 17 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<AssignmentDTO[]> {
|
||||
const classRepository = getClassRepository();
|
||||
|
|
|
@ -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<StudentDTO[] | string[]> {
|
||||
const studentRepository = getStudentRepository();
|
||||
|
|
4
common/src/interfaces/answer.d.ts
vendored
4
common/src/interfaces/answer.d.ts
vendored
|
@ -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;
|
||||
|
|
11
common/src/interfaces/assignment.d.ts
vendored
Normal file
11
common/src/interfaces/assignment.d.ts
vendored
Normal file
|
@ -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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue