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.

34 lines
746 B

  1. import { CommentItem, CommentItemList } from '~/domain/models/comment/comment'
  2. export class CommentReadDTO {
  3. id: number;
  4. user: number;
  5. username: string;
  6. example: number;
  7. text: string;
  8. createdAt: string;
  9. constructor(item: CommentItem) {
  10. this.id = item.id;
  11. this.user = item.user;
  12. this.username = item.username;
  13. this.example = item.example;
  14. this.text = item.text;
  15. this.createdAt = item.createdAt;
  16. }
  17. }
  18. export class CommentListDTO {
  19. count: number
  20. next : string | null
  21. prev : string | null
  22. items: CommentReadDTO[]
  23. constructor(item: CommentItemList) {
  24. this.count = item.count
  25. this.next = item.next
  26. this.prev = item.prev
  27. this.items = item.items.map(_ => new CommentReadDTO(_))
  28. }
  29. }