argos/dmp-frontend/src/app/models/invitation/User.ts

26 lines
583 B
TypeScript
Raw Normal View History

2018-01-05 16:40:19 +01:00
import { FormGenerator } from '../interfaces/FormGenerator';
import { Serializable } from '../interfaces/Serializable';
import { FormGroup, FormBuilder } from '@angular/forms';
2018-10-05 17:00:54 +02:00
export class User implements Serializable<User>, FormGenerator<FormGroup> {
2018-01-05 16:40:19 +01:00
2018-10-05 17:00:54 +02:00
public id: string;
public email: string;
public name: string;
2018-01-05 16:40:19 +01:00
2018-10-05 17:00:54 +02:00
fromJSONObject(item: any): User {
this.id = item.id;
this.email = item.email;
this.name = item.name;
return this;
}
2018-01-05 16:40:19 +01:00
2018-10-05 17:00:54 +02:00
buildForm(): FormGroup {
return new FormBuilder().group({
id: [this.id],
email: [this.email],
name: [this.name]
});
}
}