settings and users dialog

This commit is contained in:
VLE2FE
2020-07-29 13:14:29 +02:00
parent 55248e25ef
commit 4876ba3c0c
26 changed files with 479 additions and 41 deletions

View File

@ -0,0 +1,7 @@
import { UserModel } from './user.model';
describe('User.Model', () => {
it('should create an instance', () => {
expect(new UserModel()).toBeTruthy();
});
});

View 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);
}
}