Merge pull request #3863 from FinnStutzenstein/constructors

rework on model constructors, adapt newest changes to motion models
This commit is contained in:
Finn Stutzenstein 2018-09-10 11:57:29 +02:00 committed by GitHub
commit a5f06d3347
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 125 additions and 236 deletions

View File

@ -12,7 +12,6 @@ interface ContentObject {
* @ignore * @ignore
*/ */
export class Item extends BaseModel { export class Item extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public item_number: string; public item_number: string;
public title: string; public title: string;
@ -29,11 +28,7 @@ export class Item extends BaseModel {
public parent_id: number; public parent_id: number;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('agenda/item', input);
this._collectionString = 'agenda/item';
if (input) {
this.deserialize(input);
}
} }
public getSpeakers(): User[] { public getSpeakers(): User[] {

View File

@ -1,4 +1,4 @@
import { Deserializable } from '../deserializable.model'; import { Deserializer } from '../deserializer.model';
/** /**
* Representation of a speaker in an agenda item * Representation of a speaker in an agenda item
@ -6,7 +6,7 @@ import { Deserializable } from '../deserializable.model';
* Part of the 'speakers' list. * Part of the 'speakers' list.
* @ignore * @ignore
*/ */
export class Speaker implements Deserializable { export class Speaker extends Deserializer {
public id: number; public id: number;
public user_id: number; public user_id: number;
public begin_time: string; // TODO this is a time object public begin_time: string; // TODO this is a time object
@ -20,12 +20,6 @@ export class Speaker implements Deserializable {
* @param input * @param input
*/ */
public constructor(input?: any) { public constructor(input?: any) {
if (input) { super(input);
this.deserialize(input);
}
}
public deserialize(input: any): void {
Object.assign(this, input);
} }
} }

View File

@ -1,10 +1,10 @@
import { Deserializable } from '../deserializable.model'; import { Deserializer } from '../deserializer.model';
/** /**
* Content of the 'assignment_related_users' property * Content of the 'assignment_related_users' property
* @ignore * @ignore
*/ */
export class AssignmentUser implements Deserializable { export class AssignmentUser extends Deserializer {
public id: number; public id: number;
public user_id: number; public user_id: number;
public elected: boolean; public elected: boolean;
@ -16,12 +16,6 @@ export class AssignmentUser implements Deserializable {
* @param input * @param input
*/ */
public constructor(input?: any) { public constructor(input?: any) {
if (input) { super(input);
this.deserialize(input);
}
}
public deserialize(input: any): void {
Object.assign(this, input);
} }
} }

View File

@ -9,7 +9,6 @@ import { User } from '../users/user';
* @ignore * @ignore
*/ */
export class Assignment extends BaseModel { export class Assignment extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public title: string; public title: string;
public description: string; public description: string;
@ -22,14 +21,7 @@ export class Assignment extends BaseModel {
public tags_id: number[]; public tags_id: number[];
public constructor(input?: any) { public constructor(input?: any) {
super(); super('assignments/assignment', input);
this._collectionString = 'assignments/assignment';
this.assignment_related_users = []; // TODO Array
this.polls = Array(); // TODO Array
if (input) {
this.deserialize(input);
}
} }
public getAssignmentReleatedUsers(): BaseModel | BaseModel[] { public getAssignmentReleatedUsers(): BaseModel | BaseModel[] {
@ -47,15 +39,15 @@ export class Assignment extends BaseModel {
public deserialize(input: any): void { public deserialize(input: any): void {
Object.assign(this, input); Object.assign(this, input);
if (input.assignment_related_users instanceof Array) {
this.assignment_related_users = []; this.assignment_related_users = [];
if (input.assignment_related_users instanceof Array) {
input.assignment_related_users.forEach(assignmentUserData => { input.assignment_related_users.forEach(assignmentUserData => {
this.assignment_related_users.push(new AssignmentUser(assignmentUserData)); this.assignment_related_users.push(new AssignmentUser(assignmentUserData));
}); });
} }
if (input.polls instanceof Array) {
this.polls = []; this.polls = [];
if (input.polls instanceof Array) {
input.polls.forEach(pollData => { input.polls.forEach(pollData => {
this.polls.push(new Poll(pollData)); this.polls.push(new Poll(pollData));
}); });

View File

@ -1,4 +1,4 @@
import { Deserializable } from '../deserializable.model'; import { Deserializer } from '../deserializer.model';
/** /**
* Representation of a poll option * Representation of a poll option
@ -6,7 +6,7 @@ import { Deserializable } from '../deserializable.model';
* part of the 'polls-options'-array in poll * part of the 'polls-options'-array in poll
* @ignore * @ignore
*/ */
export class PollOption implements Deserializable { export class PollOption extends Deserializer {
public id: number; public id: number;
public candidate_id: number; public candidate_id: number;
public is_elected: boolean; public is_elected: boolean;
@ -19,12 +19,6 @@ export class PollOption implements Deserializable {
* @param input * @param input
*/ */
public constructor(input?: any) { public constructor(input?: any) {
if (input) { super(input);
this.deserialize(input);
}
}
public deserialize(input: any): void {
Object.assign(this, input);
} }
} }

View File

@ -1,11 +1,11 @@
import { PollOption } from './poll-option'; import { PollOption } from './poll-option';
import { Deserializable } from '../deserializable.model'; import { Deserializer } from '../deserializer.model';
/** /**
* Content of the 'polls' property of assignments * Content of the 'polls' property of assignments
* @ignore * @ignore
*/ */
export class Poll implements Deserializable { export class Poll extends Deserializer {
public id: number; public id: number;
public pollmethod: string; public pollmethod: string;
public description: string; public description: string;
@ -22,17 +22,14 @@ export class Poll implements Deserializable {
* @param input * @param input
*/ */
public constructor(input?: any) { public constructor(input?: any) {
this.options = [new PollOption()]; super(input);
if (input) {
this.deserialize(input);
}
} }
public deserialize(input: any): void { public deserialize(input: any): void {
Object.assign(this, input); Object.assign(this, input);
if (input.options instanceof Array) {
this.options = []; this.options = [];
if (input.options instanceof Array) {
input.options.forEach(pollOptionData => { input.options.forEach(pollOptionData => {
this.options.push(new PollOption(pollOptionData)); this.options.push(new PollOption(pollOptionData));
}); });

View File

@ -24,7 +24,7 @@ export abstract class BaseModel extends OpenSlidesComponent implements Deseriali
* *
* Has a getter but no setter. * Has a getter but no setter.
*/ */
protected abstract _collectionString: string; protected _collectionString: string;
/** /**
* force children of BaseModel to have an id * force children of BaseModel to have an id
@ -34,8 +34,13 @@ export abstract class BaseModel extends OpenSlidesComponent implements Deseriali
/** /**
* constructor that calls super from parent class * constructor that calls super from parent class
*/ */
protected constructor() { protected constructor(collectionString: string, input?: any) {
super(); super();
this._collectionString = collectionString;
if (input) {
this.deserialize(input);
}
} }
/** /**

View File

@ -6,18 +6,13 @@ import { User } from '../users/user';
* @ignore * @ignore
*/ */
export class ChatMessage extends BaseModel { export class ChatMessage extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public message: string; public message: string;
public timestamp: string; // TODO: Type for timestamp public timestamp: string; // TODO: Type for timestamp
public user_id: number; public user_id: number;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('core/chat-message', input);
this._collectionString = 'core/chat-message';
if (input) {
this.deserialize(input);
}
} }
public getUser(): User { public getUser(): User {

View File

@ -5,17 +5,12 @@ import { BaseModel } from '../base.model';
* @ignore * @ignore
*/ */
export class Config extends BaseModel { export class Config extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public key: string; public key: string;
public value: Object; public value: Object;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('core/config', input);
this._collectionString = 'core/config';
if (input) {
this.deserialize(input);
}
} }
} }

View File

@ -5,7 +5,6 @@ import { BaseModel } from '../base.model';
* @ignore * @ignore
*/ */
export class Countdown extends BaseModel { export class Countdown extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public description: string; public description: string;
public default_time: number; public default_time: number;
@ -13,11 +12,7 @@ export class Countdown extends BaseModel {
public running: boolean; public running: boolean;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('core/countdown');
this._collectionString = 'core/countdown';
if (input) {
this.deserialize(input);
}
} }
} }

View File

@ -5,16 +5,11 @@ import { BaseModel } from '../base.model';
* @ignore * @ignore
*/ */
export class ProjectorMessage extends BaseModel { export class ProjectorMessage extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public message: string; public message: string;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('core/projector-message', input);
this._collectionString = 'core/projector-message';
if (input) {
this.deserialize(input);
}
} }
} }

View File

@ -5,7 +5,6 @@ import { BaseModel } from '../base.model';
* @ignore * @ignore
*/ */
export class Projector extends BaseModel { export class Projector extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public elements: Object; public elements: Object;
public scale: number; public scale: number;
@ -17,11 +16,7 @@ export class Projector extends BaseModel {
public projectiondefaults: Object[]; public projectiondefaults: Object[];
public constructor(input?: any) { public constructor(input?: any) {
super(); super('core/projector', input);
this._collectionString = 'core/projector';
if (input) {
this.deserialize(input);
}
} }
} }

View File

@ -5,16 +5,11 @@ import { BaseModel } from '../base.model';
* @ignore * @ignore
*/ */
export class Tag extends BaseModel { export class Tag extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public name: string; public name: string;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('core/tag', input);
this._collectionString = 'core/tag';
if (input) {
this.deserialize(input);
}
} }
} }

View File

@ -0,0 +1,25 @@
import { Deserializable } from './deserializable.model';
/**
* Abstract base class for a basic implementation of Deserializable.
* The constructor also gives the possibility to give data that should be serialized.
*/
export abstract class Deserializer implements Deserializable {
/**
* Basic constructor with the possibility to give data to deserialize.
* @param input If data is given, {@method deserialize} will be called with that data
*/
protected constructor(input?: any) {
if (input) {
this.deserialize(input);
}
}
/**
* should be used to assign JSON values to the object itself.
* @param input
*/
public deserialize(input: any): void {
Object.assign(this, input);
}
}

View File

@ -1,10 +1,10 @@
import { Deserializable } from '../deserializable.model'; import { Deserializer } from '../deserializer.model';
/** /**
* The name and the type of a mediaFile. * The name and the type of a mediaFile.
* @ignore * @ignore
*/ */
export class File implements Deserializable { export class File extends Deserializer {
public name: string; public name: string;
public type: string; public type: string;
@ -14,12 +14,6 @@ export class File implements Deserializable {
* @param type The tape (jpg, png, pdf) * @param type The tape (jpg, png, pdf)
*/ */
public constructor(input?: any) { public constructor(input?: any) {
if (input) { super(input);
this.deserialize(input);
}
}
public deserialize(input: any): void {
Object.assign(this, input);
} }
} }

View File

@ -7,7 +7,6 @@ import { User } from '../users/user';
* @ignore * @ignore
*/ */
export class Mediafile extends BaseModel { export class Mediafile extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public title: string; public title: string;
public mediafile: File; public mediafile: File;
@ -18,11 +17,7 @@ export class Mediafile extends BaseModel {
public timestamp: string; public timestamp: string;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('mediafiles/mediafile', input);
this._collectionString = 'mediafiles/mediafile';
if (input) {
this.deserialize(input);
}
} }
public deserialize(input: any): void { public deserialize(input: any): void {

View File

@ -5,17 +5,12 @@ import { BaseModel } from '../base.model';
* @ignore * @ignore
*/ */
export class Category extends BaseModel { export class Category extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public name: string; public name: string;
public prefix: string; public prefix: string;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('motions/category', input);
this._collectionString = 'motions/category';
if (input) {
this.deserialize(input);
}
} }
public toString = (): string => { public toString = (): string => {

View File

@ -6,17 +6,12 @@ import { Item } from '../agenda/item';
* @ignore * @ignore
*/ */
export class MotionBlock extends BaseModel { export class MotionBlock extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public title: string; public title: string;
public agenda_item_id: number; public agenda_item_id: number;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('motions/motion-block', input);
this._collectionString = 'motions/motion-block';
if (input) {
this.deserialize(input);
}
} }
public getAgenda(): BaseModel | BaseModel[] { public getAgenda(): BaseModel | BaseModel[] {

View File

@ -5,7 +5,6 @@ import { BaseModel } from '../base.model';
* @ignore * @ignore
*/ */
export class MotionChangeReco extends BaseModel { export class MotionChangeReco extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public motion_version_id: number; public motion_version_id: number;
public rejected: boolean; public rejected: boolean;
@ -17,11 +16,7 @@ export class MotionChangeReco extends BaseModel {
public creation_time: string; public creation_time: string;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('motions/motion-change-recommendation', input);
this._collectionString = 'motions/motion-change-recommendation';
if (input) {
this.deserialize(input);
}
} }
} }

View File

@ -0,0 +1,18 @@
import { BaseModel } from '../base.model';
/**
* Representation of a motion category. Has the nested property "File"
* @ignore
*/
export class MotionCommentSection extends BaseModel {
public id: number;
public name: string;
public read_groups_id: number[];
public write_groups_id: number[];
public constructor(input?: any) {
super('motions/motion-comment-section', input);
}
}
BaseModel.registerCollectionElement('motions/motion-comment-section', MotionCommentSection);

View File

@ -0,0 +1,15 @@
import { Deserializer } from '../deserializer.model';
/**
* Representation of a Motion Comment.
*/
export class MotionComment extends Deserializer {
public id: number;
public comment: string;
public section_id: number;
public read_groups_id: number[];
public constructor(input?: any) {
super(input);
}
}

View File

@ -1,23 +1,17 @@
import { Deserializable } from '../deserializable.model'; import { Deserializer } from '../deserializer.model';
/** /**
* Representation of a Motion Version. * Representation of a Motion Log.
* *
* @ignore * @ignore
*/ */
export class MotionLog implements Deserializable { export class MotionLog extends Deserializer {
public message_list: string[]; public message_list: string[];
public person_id: number; public person_id: number;
public time: string; public time: string;
public message: string; public message: string;
public constructor(input?: any) { public constructor(input?: any) {
if (input) { super(input);
this.deserialize(input);
}
}
public deserialize(input: any): void {
Object.assign(this, input);
} }
} }

View File

@ -1,23 +1,17 @@
import { Deserializable } from '../deserializable.model'; import { Deserializer } from '../deserializer.model';
/** /**
* Representation of a Motion Submitter. * Representation of a Motion Submitter.
* *
* @ignore * @ignore
*/ */
export class MotionSubmitter implements Deserializable { export class MotionSubmitter extends Deserializer {
public id: number; public id: number;
public user_id: number; public user_id: number;
public motion_id: number; public motion_id: number;
public weight: number; public weight: number;
public constructor(input?: any) { public constructor(input?: any) {
if (input) { super(input);
this.deserialize(input);
}
}
public deserialize(input: any): void {
Object.assign(this, input);
} }
} }

View File

@ -1,30 +0,0 @@
import { Deserializable } from '../deserializable.model';
/**
* Representation of a Motion Version.
*
* @ignore
*/
export class MotionVersion implements Deserializable {
public id: number;
public version_number: number;
public creation_time: string;
public title: string;
public text: string;
public amendment_paragraphs: string;
public reason: string;
public constructor(input?: any) {
this.title = '';
this.text = '';
this.reason = '';
if (input) {
this.deserialize(input);
}
}
public deserialize(input: any): void {
Object.assign(this, input);
}
}

View File

@ -6,6 +6,7 @@ import { Workflow } from './workflow';
import { User } from '../users/user'; import { User } from '../users/user';
import { Category } from './category'; import { Category } from './category';
import { WorkflowState } from './workflow-state'; import { WorkflowState } from './workflow-state';
import { MotionComment } from './motion-comment';
/** /**
* Representation of Motion. * Representation of Motion.
@ -15,7 +16,6 @@ import { WorkflowState } from './workflow-state';
* @ignore * @ignore
*/ */
export class Motion extends BaseModel { export class Motion extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public identifier: string; public identifier: string;
public title: string; public title: string;
@ -29,7 +29,7 @@ export class Motion extends BaseModel {
public origin: string; public origin: string;
public submitters: MotionSubmitter[]; public submitters: MotionSubmitter[];
public supporters_id: number[]; public supporters_id: number[];
public comments: Object[]; public comments: MotionComment[];
public state_id: number; public state_id: number;
public state_extension: string; public state_extension: string;
public state_required_permission_to_see: string; public state_required_permission_to_see: string;
@ -45,22 +45,7 @@ export class Motion extends BaseModel {
public workflow: Workflow; public workflow: Workflow;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('motions/motion', input);
this._collectionString = 'motions/motion';
this.identifier = '';
this.title = '';
this.text = '';
this.reason = '';
this.modified_final_version = '';
this.origin = '';
this.submitters = [];
this.supporters_id = [];
this.state_required_permission_to_see = '';
this.log_messages = [];
if (input) {
this.deserialize(input);
}
this.initDataStoreValues(); this.initDataStoreValues();
} }
@ -186,19 +171,26 @@ export class Motion extends BaseModel {
public deserialize(input: any): void { public deserialize(input: any): void {
Object.assign(this, input); Object.assign(this, input);
if (input.submitters instanceof Array) {
this.submitters = []; this.submitters = [];
if (input.submitters instanceof Array) {
input.submitters.forEach(SubmitterData => { input.submitters.forEach(SubmitterData => {
this.submitters.push(new MotionSubmitter(SubmitterData)); this.submitters.push(new MotionSubmitter(SubmitterData));
}); });
} }
if (input.log_messages instanceof Array) {
this.log_messages = []; this.log_messages = [];
if (input.log_messages instanceof Array) {
input.log_messages.forEach(logData => { input.log_messages.forEach(logData => {
this.log_messages.push(new MotionLog(logData)); this.log_messages.push(new MotionLog(logData));
}); });
} }
this.comments = [];
if (input.comments instanceof Array) {
input.comments.forEach(commentData => {
this.comments.push(new MotionComment(commentData));
});
}
} }
} }

View File

@ -1,4 +1,4 @@
import { Deserializable } from '../deserializable.model'; import { Deserializer } from '../deserializer.model';
import { Workflow } from './workflow'; import { Workflow } from './workflow';
/** /**
@ -7,7 +7,7 @@ import { Workflow } from './workflow';
* Part of the 'states'-array in motion/workflow * Part of the 'states'-array in motion/workflow
* @ignore * @ignore
*/ */
export class WorkflowState implements Deserializable { export class WorkflowState extends Deserializer {
public id: number; public id: number;
public name: string; public name: string;
public action_word: string; public action_word: string;
@ -17,8 +17,6 @@ export class WorkflowState implements Deserializable {
public allow_support: boolean; public allow_support: boolean;
public allow_create_poll: boolean; public allow_create_poll: boolean;
public allow_submitter_edit: boolean; public allow_submitter_edit: boolean;
public versioning: boolean;
public leave_old_version_active: boolean;
public dont_set_identifier: boolean; public dont_set_identifier: boolean;
public show_state_extension_field: boolean; public show_state_extension_field: boolean;
public show_recommendation_extension_field: boolean; public show_recommendation_extension_field: boolean;
@ -30,9 +28,7 @@ export class WorkflowState implements Deserializable {
* @param input If given, it will be deserialized * @param input If given, it will be deserialized
*/ */
public constructor(input?: any) { public constructor(input?: any) {
if (input) { super(input);
this.deserialize(input);
}
} }
/** /**
@ -49,10 +45,6 @@ export class WorkflowState implements Deserializable {
return nextStates; return nextStates;
} }
public deserialize(input: any): void {
Object.assign(this, input);
}
public toString = (): string => { public toString = (): string => {
return this.name; return this.name;
}; };

View File

@ -6,18 +6,13 @@ import { WorkflowState } from './workflow-state';
* @ignore * @ignore
*/ */
export class Workflow extends BaseModel { export class Workflow extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public name: string; public name: string;
public states: WorkflowState[]; public states: WorkflowState[];
public first_state: number; public first_state: number;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('motions/workflow', input);
this._collectionString = 'motions/workflow';
if (input) {
this.deserialize(input);
}
} }
/** /**

View File

@ -7,7 +7,6 @@ import { Item } from '../agenda/item';
* @ignore * @ignore
*/ */
export class Topic extends BaseModel { export class Topic extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public title: string; public title: string;
public text: string; public text: string;
@ -15,11 +14,7 @@ export class Topic extends BaseModel {
public agenda_item_id: number; public agenda_item_id: number;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('topics/topic', input);
this._collectionString = 'topics/topic';
if (input) {
this.deserialize(input);
}
} }
public getAttachments(): Mediafile[] { public getAttachments(): Mediafile[] {

View File

@ -6,17 +6,12 @@ import { User } from './user';
* @ignore * @ignore
*/ */
export class Group extends BaseModel { export class Group extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public name: string; public name: string;
public permissions: string[]; public permissions: string[];
public constructor(input?: any) { public constructor(input?: any) {
super(); super('users/group', input);
this._collectionString = 'users/group';
if (input) {
this.deserialize(input);
}
} }
public get users(): User[] { public get users(): User[] {

View File

@ -6,17 +6,12 @@ import { User } from './user';
* @ignore * @ignore
*/ */
export class PersonalNote extends BaseModel { export class PersonalNote extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public user_id: number; public user_id: number;
public notes: Object; public notes: Object;
public constructor(input: any) { public constructor(input: any) {
super(); super('users/personal-note', input);
this._collectionString = 'users/personal-note';
if (input) {
this.deserialize(input);
}
} }
public getUser(): User { public getUser(): User {

View File

@ -6,7 +6,6 @@ import { Group } from './group';
* @ignore * @ignore
*/ */
export class User extends BaseModel { export class User extends BaseModel {
protected _collectionString: string;
public id: number; public id: number;
public username: string; public username: string;
public title: string; public title: string;
@ -25,12 +24,7 @@ export class User extends BaseModel {
public default_password: string; public default_password: string;
public constructor(input?: any) { public constructor(input?: any) {
super(); super('users/user', input);
this._collectionString = 'users/user';
if (input) {
this.deserialize(input);
}
} }
public get groups(): Group[] { public get groups(): Group[] {

View File

@ -94,11 +94,11 @@ export class StartComponent extends BaseComponent implements OnInit {
console.log('the user: ', user1fromStore); console.log('the user: ', user1fromStore);
console.log('remove a single user:'); console.log('remove a single user:');
// this.DS.remove(User, 100); this.DS.remove('users/user', 100);
console.log('remove more users'); console.log('remove more users');
// this.DS.remove(User, 200, 201, 202); this.DS.remove('users/user', 200, 201, 202);
console.log('remove an array of users'); console.log('remove an array of users');
// this.DS.remove(User, ...[321, 363, 399]); this.DS.remove('users/user', ...[321, 363, 399]);
console.log('test filter: '); console.log('test filter: ');
console.log(this.DS.filter<User>(User, user => user.id === 1)); console.log(this.DS.filter<User>(User, user => user.id === 1));