refactor(common): User
This commit is contained in:
parent
1a0704c16f
commit
3b51b0f1f6
4 changed files with 16 additions and 15 deletions
|
@ -1,7 +1,8 @@
|
||||||
import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity.js';
|
import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity.js';
|
||||||
import { mapToClassDTO } from './class.js';
|
import { mapToClassDTO } from './class.js';
|
||||||
import { mapToUserDTO, UserDTO } from './user.js';
|
import { mapToUserDTO } from './user.js';
|
||||||
import { ClassDTO } from 'dwengo-1-common/src/interfaces/class';
|
import { ClassDTO } from 'dwengo-1-common/src/interfaces/class';
|
||||||
|
import { UserDTO } from 'dwengo-1-common/src/interfaces/user';
|
||||||
|
|
||||||
export interface TeacherInvitationDTO {
|
export interface TeacherInvitationDTO {
|
||||||
sender: string | UserDTO;
|
sender: string | UserDTO;
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
import { User } from '../entities/users/user.entity.js';
|
import { User } from '../entities/users/user.entity.js';
|
||||||
|
import { UserDTO } from 'dwengo-1-common/src/interfaces/user';
|
||||||
export interface UserDTO {
|
|
||||||
id?: string;
|
|
||||||
username: string;
|
|
||||||
firstName: string;
|
|
||||||
lastName: string;
|
|
||||||
endpoints?: {
|
|
||||||
self: string;
|
|
||||||
classes: string;
|
|
||||||
questions: string;
|
|
||||||
invitations: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function mapToUserDTO(user: User): UserDTO {
|
export function mapToUserDTO(user: User): UserDTO {
|
||||||
return {
|
return {
|
||||||
|
|
2
common/src/interfaces/answer.d.ts
vendored
2
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 { QuestionDTO } from 'dwengo-1-backend/src/interfaces/question.js';
|
||||||
|
import { UserDTO } from './user';
|
||||||
|
|
||||||
export interface AnswerDTO {
|
export interface AnswerDTO {
|
||||||
author: UserDTO;
|
author: UserDTO;
|
||||||
|
|
12
common/src/interfaces/user.d.ts
vendored
Normal file
12
common/src/interfaces/user.d.ts
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
export interface UserDTO {
|
||||||
|
id?: string;
|
||||||
|
username: string;
|
||||||
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
|
endpoints?: {
|
||||||
|
self: string;
|
||||||
|
classes: string;
|
||||||
|
questions: string;
|
||||||
|
invitations: string;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue