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.

24 lines
555 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. export class UserItem {
  2. constructor(
  3. public id: number,
  4. public username: string,
  5. public is_superuser: boolean,
  6. public is_staff: boolean
  7. ) {}
  8. static valueOf(
  9. { id, username, is_superuser, is_staff }:
  10. { id: number, username: string, is_superuser: boolean, is_staff: boolean }
  11. ): UserItem {
  12. return new UserItem(id, username, is_superuser, is_staff)
  13. }
  14. toObject(): Object {
  15. return {
  16. id: this.id,
  17. username: this.username,
  18. is_superuser: this.is_superuser,
  19. is_staff: this.is_staff
  20. }
  21. }
  22. }