You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
682 B

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. import 'reflect-metadata'
  2. import { Expose, Type } from 'class-transformer'
  3. export class CommentItem {
  4. id: number
  5. user: number
  6. username: string
  7. example: number
  8. text: string
  9. @Expose({ name: 'created_at' })
  10. createdAt: string
  11. by(userId: number) {
  12. return this.user === userId
  13. }
  14. toObject(): Object {
  15. return {
  16. id: this.id,
  17. user: this.user,
  18. username: this.username,
  19. document: this.example,
  20. text: this.text,
  21. created_at: this.createdAt
  22. }
  23. }
  24. }
  25. export class CommentItemList {
  26. count: number
  27. next: string | null
  28. prev: string | null
  29. @Type(() => CommentItem)
  30. @Expose({ name: 'results' })
  31. items: CommentItem[]
  32. }