refactor(common): AnswerDTO
This commit is contained in:
		
							parent
							
								
									8bf927d1c9
								
							
						
					
					
						commit
						6c9c8d782d
					
				
					 2 changed files with 19 additions and 16 deletions
				
			
		|  | @ -1,14 +1,7 @@ | |||
| import { mapToUserDTO, UserDTO } from './user.js'; | ||||
| import { mapToQuestionDTO, mapToQuestionId, QuestionDTO, QuestionId } from './question.js'; | ||||
| import { mapToUserDTO } from './user.js'; | ||||
| import { mapToQuestionDTO, mapToQuestionId } from './question.js'; | ||||
| import { Answer } from '../entities/questions/answer.entity.js'; | ||||
| 
 | ||||
| export interface AnswerDTO { | ||||
|     author: UserDTO; | ||||
|     toQuestion: QuestionDTO; | ||||
|     sequenceNumber: number; | ||||
|     timestamp: string; | ||||
|     content: string; | ||||
| } | ||||
| import { AnswerDTO, AnswerId } from 'dwengo-1-common/src/interfaces/answer'; | ||||
| 
 | ||||
| /** | ||||
|  * Convert a Question entity to a DTO format. | ||||
|  | @ -23,12 +16,6 @@ export function mapToAnswerDTO(answer: Answer): AnswerDTO { | |||
|     }; | ||||
| } | ||||
| 
 | ||||
| export interface AnswerId { | ||||
|     author: string; | ||||
|     toQuestion: QuestionId; | ||||
|     sequenceNumber: number; | ||||
| } | ||||
| 
 | ||||
| export function mapToAnswerId(answer: AnswerDTO): AnswerId { | ||||
|     return { | ||||
|         author: answer.author.username, | ||||
|  |  | |||
		Reference in a new issue