settings and users dialog
This commit is contained in:
7
src/app/models/user.model.spec.ts
Normal file
7
src/app/models/user.model.spec.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { UserModel } from './user.model';
|
||||
|
||||
describe('User.Model', () => {
|
||||
it('should create an instance', () => {
|
||||
expect(new UserModel()).toBeTruthy();
|
||||
});
|
||||
});
|
28
src/app/models/user.model.ts
Normal file
28
src/app/models/user.model.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import _ from 'lodash';
|
||||
import {BaseModel} from './base.model';
|
||||
import {IdModel} from './id.model';
|
||||
|
||||
export class UserModel extends BaseModel{
|
||||
_id: IdModel = null;
|
||||
name = '';
|
||||
origName = '';
|
||||
email = '';
|
||||
level = '';
|
||||
location = '';
|
||||
device_name = '';
|
||||
edit = false;
|
||||
|
||||
deserialize(input: any): this {
|
||||
Object.assign(this, input);
|
||||
this.origName = this.name;
|
||||
return this;
|
||||
}
|
||||
|
||||
sendFormat(mode = 'user') {
|
||||
const keys = ['name', 'email', 'location', 'device_name'];
|
||||
if (mode === 'admin') {
|
||||
keys.push('level');
|
||||
}
|
||||
return _.pick(this, keys);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user