fix: merge + types frontend controller
This commit is contained in:
		
							parent
							
								
									4ca568e738
								
							
						
					
					
						commit
						8ceed7f779
					
				
					 20 changed files with 129 additions and 92 deletions
				
			
		|  | @ -10,11 +10,11 @@ import { | |||
|     getTeacherQuestions, | ||||
|     updateClassJoinRequestStatus, | ||||
| } from '../services/teachers.js'; | ||||
| import { ClassDTO } from '../interfaces/class.js'; | ||||
| import { StudentDTO } from '../interfaces/student.js'; | ||||
| import { QuestionDTO, QuestionId } from '../interfaces/question.js'; | ||||
| import { TeacherDTO } from '../interfaces/teacher.js'; | ||||
| import { requireFields } from './error-helper.js'; | ||||
| import {TeacherDTO} from "dwengo-1-common/src/interfaces/teacher"; | ||||
| import {ClassDTO} from "dwengo-1-common/src/interfaces/class"; | ||||
| import {StudentDTO} from "dwengo-1-common/src/interfaces/student"; | ||||
| import {QuestionDTO, QuestionId} from "dwengo-1-common/src/interfaces/question"; | ||||
| 
 | ||||
| export async function getAllTeachersHandler(req: Request, res: Response): Promise<void> { | ||||
|     const full = req.query.full === 'true'; | ||||
|  |  | |||
|  | @ -16,10 +16,10 @@ export function mapToAnswerDTO(answer: Answer): AnswerDTO { | |||
|     }; | ||||
| } | ||||
| 
 | ||||
| export function mapToAnswerId(answer: AnswerDTO): AnswerId { | ||||
| export function mapToAnswerDTOId(answer: Answer): AnswerId { | ||||
|     return { | ||||
|         author: answer.author.username, | ||||
|         toQuestion: mapToQuestionDTOId(answer.toQuestion), | ||||
|         sequenceNumber: answer.sequenceNumber, | ||||
|         sequenceNumber: answer.sequenceNumber!, | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| import { Question } from '../entities/questions/question.entity.js'; | ||||
| import { mapToStudentDTO } from './student.js'; | ||||
| import { QuestionDTO, QuestionId } from 'dwengo-1-common/src/interfaces/question'; | ||||
| import {LearningObjectIdentifier} from "../entities/content/learning-object-identifier"; | ||||
| 
 | ||||
| function getLearningObjectIdentifier(question: Question): LearningObjectIdentifier { | ||||
|     return { | ||||
|  |  | |||
|  | @ -1,16 +1,12 @@ | |||
| import { mapToStudentDTO, StudentDTO } from './student.js'; | ||||
| import { mapToStudentDTO } from './student.js'; | ||||
| import { ClassJoinRequest, ClassJoinRequestStatus } from '../entities/classes/class-join-request.entity.js'; | ||||
| import { getClassJoinRequestRepository } from '../data/repositories.js'; | ||||
| import { Student } from '../entities/users/student.entity.js'; | ||||
| import { Class } from '../entities/classes/class.entity.js'; | ||||
| import {ClassJoinRequestDTO} from "dwengo-1-common/src/interfaces/class-join-request"; | ||||
| 
 | ||||
| export interface StudentRequestDTO { | ||||
|     requester: StudentDTO; | ||||
|     class: string; | ||||
|     status: ClassJoinRequestStatus; | ||||
| } | ||||
| 
 | ||||
| export function mapToStudentRequestDTO(request: ClassJoinRequest): StudentRequestDTO { | ||||
| export function mapToStudentRequestDTO(request: ClassJoinRequest): ClassJoinRequestDTO { | ||||
|     return { | ||||
|         requester: mapToStudentDTO(request.requester), | ||||
|         class: request.class.classId!, | ||||
|  |  | |||
|  | @ -1,11 +1,13 @@ | |||
| import { getAnswerRepository, getQuestionRepository } from '../data/repositories.js'; | ||||
| import {mapToQuestionDTO, mapToQuestionDTOId, QuestionDTO, QuestionId} from '../interfaces/question.js'; | ||||
| import {mapToQuestionDTO, mapToQuestionDTOId } from '../interfaces/question.js'; | ||||
| import { Question } from '../entities/questions/question.entity.js'; | ||||
| import { Answer } from '../entities/questions/answer.entity.js'; | ||||
| import { AnswerDTO, AnswerId, mapToAnswerDTO, mapToAnswerDTOId } from '../interfaces/answer.js'; | ||||
| import {mapToAnswerDTO, mapToAnswerDTOId} from '../interfaces/answer.js'; | ||||
| import { QuestionRepository } from '../data/questions/question-repository.js'; | ||||
| import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | ||||
| import { mapToStudent } from '../interfaces/student.js'; | ||||
| import {QuestionDTO, QuestionId} from "dwengo-1-common/src/interfaces/question"; | ||||
| import {AnswerDTO, AnswerId} from "dwengo-1-common/src/interfaces/answer"; | ||||
| 
 | ||||
| export async function getAllQuestions(id: LearningObjectIdentifier, full: boolean): Promise<QuestionDTO[] | QuestionId[]> { | ||||
|     const questionRepository: QuestionRepository = getQuestionRepository(); | ||||
|  |  | |||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl