Browse Source

add is_staff column to user interfaces

pull/1453/head
youichiro 3 years ago
parent
commit
46f9b73d5a
4 changed files with 13 additions and 7 deletions
  1. 3
      frontend/components/member/FormCreate.vue
  2. 12
      frontend/domain/models/user/user.ts
  3. 3
      frontend/domain/models/user/userRepository.ts
  4. 2
      frontend/services/application/user/userData.ts

3
frontend/components/member/FormCreate.vue

@ -103,7 +103,8 @@ export default Vue.extend({
get(): UserDTO {
return {
id: this.value.user,
username: this.value.username
username: this.value.username,
isStaff: false
}
},
set(val: MemberDTO) {

12
frontend/domain/models/user/user.ts

@ -2,21 +2,23 @@ export class UserItem {
constructor(
public id: number,
public username: string,
public is_superuser: boolean
public is_superuser: boolean,
public is_staff: boolean
) {}
static valueOf(
{ id, username, is_superuser }:
{ id: number, username: string, is_superuser: boolean }
{ id, username, is_superuser, is_staff }:
{ id: number, username: string, is_superuser: boolean, is_staff: boolean }
): UserItem {
return new UserItem(id, username, is_superuser)
return new UserItem(id, username, is_superuser, is_staff)
}
toObject(): Object {
return {
id: this.id,
username: this.username,
is_superuser: this.is_superuser
is_superuser: this.is_superuser,
is_staff: this.is_staff
}
}
}

3
frontend/domain/models/user/userRepository.ts

@ -3,7 +3,8 @@ import { UserItem } from '~/domain/models/user/user'
export interface UserItemResponse {
id: number,
username: string,
is_superuser: boolean
is_superuser: boolean,
is_staff: boolean
}
export interface UserRepository {

2
frontend/services/application/user/userData.ts

@ -4,9 +4,11 @@ import { UserItem } from '~/domain/models/user/user'
export class UserDTO {
id: number;
username: string;
isStaff: boolean;
constructor(item: UserItem) {
this.id = item.id;
this.username = item.username;
this.isStaff = item.is_staff;
}
}
Loading…
Cancel
Save