Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fff2abf0a1 |
@@ -1,16 +1,13 @@
|
||||
import { Expose } from 'class-transformer';
|
||||
|
||||
|
||||
export class UserResponseDTO {
|
||||
constructor(partial: Partial<UserResponseDTO>) {
|
||||
Object.assign(this, partial);
|
||||
this.id = partial.id;
|
||||
|
||||
}
|
||||
@Expose()
|
||||
id: string;
|
||||
|
||||
@Expose()
|
||||
username: string;
|
||||
|
||||
@Expose()
|
||||
avatar: string;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
import { Expose } from 'class-transformer';
|
||||
|
||||
export class WordResponseDTO {
|
||||
constructor(partial: Partial<WordResponseDTO>) {
|
||||
Object.assign(this, partial);
|
||||
if (partial.id) this.id = partial.id
|
||||
if (partial.value) this.value = partial.value
|
||||
if (partial.ownerId) this.ownerId = partial.ownerId
|
||||
if (partial.enabled) this.enabled = partial.enabled
|
||||
}
|
||||
@Expose()
|
||||
|
||||
id: number;
|
||||
|
||||
@Expose()
|
||||
value: string;
|
||||
|
||||
@Expose()
|
||||
ownerId: string;
|
||||
|
||||
@Expose()
|
||||
enabled: boolean;
|
||||
|
||||
toJSON() {
|
||||
return { ...this } // here I make a POJO's copy of the class instance
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user