rework on model constructors, adapt newest changes to motion models
This commit is contained in:
parent
44b287248c
commit
4717529ed0
@ -12,7 +12,6 @@ interface ContentObject {
|
||||
* @ignore
|
||||
*/
|
||||
export class Item extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public item_number: string;
|
||||
public title: string;
|
||||
@ -29,11 +28,7 @@ export class Item extends BaseModel {
|
||||
public parent_id: number;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'agenda/item';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('agenda/item', input);
|
||||
}
|
||||
|
||||
public getSpeakers(): User[] {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Deserializable } from '../deserializable.model';
|
||||
import { Deserializer } from '../deserializer.model';
|
||||
|
||||
/**
|
||||
* Representation of a speaker in an agenda item
|
||||
@ -6,7 +6,7 @@ import { Deserializable } from '../deserializable.model';
|
||||
* Part of the 'speakers' list.
|
||||
* @ignore
|
||||
*/
|
||||
export class Speaker implements Deserializable {
|
||||
export class Speaker extends Deserializer {
|
||||
public id: number;
|
||||
public user_id: number;
|
||||
public begin_time: string; // TODO this is a time object
|
||||
@ -20,12 +20,6 @@ export class Speaker implements Deserializable {
|
||||
* @param input
|
||||
*/
|
||||
public constructor(input?: any) {
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
}
|
||||
|
||||
public deserialize(input: any): void {
|
||||
Object.assign(this, input);
|
||||
super(input);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { Deserializable } from '../deserializable.model';
|
||||
import { Deserializer } from '../deserializer.model';
|
||||
|
||||
/**
|
||||
* Content of the 'assignment_related_users' property
|
||||
* @ignore
|
||||
*/
|
||||
export class AssignmentUser implements Deserializable {
|
||||
export class AssignmentUser extends Deserializer {
|
||||
public id: number;
|
||||
public user_id: number;
|
||||
public elected: boolean;
|
||||
@ -16,12 +16,6 @@ export class AssignmentUser implements Deserializable {
|
||||
* @param input
|
||||
*/
|
||||
public constructor(input?: any) {
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
}
|
||||
|
||||
public deserialize(input: any): void {
|
||||
Object.assign(this, input);
|
||||
super(input);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import { User } from '../users/user';
|
||||
* @ignore
|
||||
*/
|
||||
export class Assignment extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public title: string;
|
||||
public description: string;
|
||||
@ -22,14 +21,7 @@ export class Assignment extends BaseModel {
|
||||
public tags_id: number[];
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'assignments/assignment';
|
||||
this.assignment_related_users = []; // TODO Array
|
||||
this.polls = Array(); // TODO Array
|
||||
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('assignments/assignment', input);
|
||||
}
|
||||
|
||||
public getAssignmentReleatedUsers(): BaseModel | BaseModel[] {
|
||||
@ -47,15 +39,15 @@ export class Assignment extends BaseModel {
|
||||
public deserialize(input: any): void {
|
||||
Object.assign(this, input);
|
||||
|
||||
if (input.assignment_related_users instanceof Array) {
|
||||
this.assignment_related_users = [];
|
||||
if (input.assignment_related_users instanceof Array) {
|
||||
input.assignment_related_users.forEach(assignmentUserData => {
|
||||
this.assignment_related_users.push(new AssignmentUser(assignmentUserData));
|
||||
});
|
||||
}
|
||||
|
||||
if (input.polls instanceof Array) {
|
||||
this.polls = [];
|
||||
if (input.polls instanceof Array) {
|
||||
input.polls.forEach(pollData => {
|
||||
this.polls.push(new Poll(pollData));
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Deserializable } from '../deserializable.model';
|
||||
import { Deserializer } from '../deserializer.model';
|
||||
|
||||
/**
|
||||
* Representation of a poll option
|
||||
@ -6,7 +6,7 @@ import { Deserializable } from '../deserializable.model';
|
||||
* part of the 'polls-options'-array in poll
|
||||
* @ignore
|
||||
*/
|
||||
export class PollOption implements Deserializable {
|
||||
export class PollOption extends Deserializer {
|
||||
public id: number;
|
||||
public candidate_id: number;
|
||||
public is_elected: boolean;
|
||||
@ -19,12 +19,6 @@ export class PollOption implements Deserializable {
|
||||
* @param input
|
||||
*/
|
||||
public constructor(input?: any) {
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
}
|
||||
|
||||
public deserialize(input: any): void {
|
||||
Object.assign(this, input);
|
||||
super(input);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { PollOption } from './poll-option';
|
||||
import { Deserializable } from '../deserializable.model';
|
||||
import { Deserializer } from '../deserializer.model';
|
||||
|
||||
/**
|
||||
* Content of the 'polls' property of assignments
|
||||
* @ignore
|
||||
*/
|
||||
export class Poll implements Deserializable {
|
||||
export class Poll extends Deserializer {
|
||||
public id: number;
|
||||
public pollmethod: string;
|
||||
public description: string;
|
||||
@ -22,17 +22,14 @@ export class Poll implements Deserializable {
|
||||
* @param input
|
||||
*/
|
||||
public constructor(input?: any) {
|
||||
this.options = [new PollOption()];
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super(input);
|
||||
}
|
||||
|
||||
public deserialize(input: any): void {
|
||||
Object.assign(this, input);
|
||||
|
||||
if (input.options instanceof Array) {
|
||||
this.options = [];
|
||||
if (input.options instanceof Array) {
|
||||
input.options.forEach(pollOptionData => {
|
||||
this.options.push(new PollOption(pollOptionData));
|
||||
});
|
||||
|
@ -24,7 +24,7 @@ export abstract class BaseModel extends OpenSlidesComponent implements Deseriali
|
||||
*
|
||||
* Has a getter but no setter.
|
||||
*/
|
||||
protected abstract _collectionString: string;
|
||||
protected _collectionString: string;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
protected constructor() {
|
||||
protected constructor(collectionString: string, input?: any) {
|
||||
super();
|
||||
this._collectionString = collectionString;
|
||||
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,18 +6,13 @@ import { User } from '../users/user';
|
||||
* @ignore
|
||||
*/
|
||||
export class ChatMessage extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public message: string;
|
||||
public timestamp: string; // TODO: Type for timestamp
|
||||
public user_id: number;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'core/chat-message';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('core/chat-message', input);
|
||||
}
|
||||
|
||||
public getUser(): User {
|
||||
|
@ -5,17 +5,12 @@ import { BaseModel } from '../base.model';
|
||||
* @ignore
|
||||
*/
|
||||
export class Config extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public key: string;
|
||||
public value: Object;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'core/config';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('core/config', input);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ import { BaseModel } from '../base.model';
|
||||
* @ignore
|
||||
*/
|
||||
export class Countdown extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public description: string;
|
||||
public default_time: number;
|
||||
@ -13,11 +12,7 @@ export class Countdown extends BaseModel {
|
||||
public running: boolean;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'core/countdown';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('core/countdown');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,16 +5,11 @@ import { BaseModel } from '../base.model';
|
||||
* @ignore
|
||||
*/
|
||||
export class ProjectorMessage extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public message: string;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'core/projector-message';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('core/projector-message', input);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ import { BaseModel } from '../base.model';
|
||||
* @ignore
|
||||
*/
|
||||
export class Projector extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public elements: Object;
|
||||
public scale: number;
|
||||
@ -17,11 +16,7 @@ export class Projector extends BaseModel {
|
||||
public projectiondefaults: Object[];
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'core/projector';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('core/projector', input);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,16 +5,11 @@ import { BaseModel } from '../base.model';
|
||||
* @ignore
|
||||
*/
|
||||
export class Tag extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public name: string;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'core/tag';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('core/tag', input);
|
||||
}
|
||||
}
|
||||
|
||||
|
25
client/src/app/shared/models/deserializer.model.ts
Normal file
25
client/src/app/shared/models/deserializer.model.ts
Normal 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);
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
import { Deserializable } from '../deserializable.model';
|
||||
import { Deserializer } from '../deserializer.model';
|
||||
|
||||
/**
|
||||
* The name and the type of a mediaFile.
|
||||
* @ignore
|
||||
*/
|
||||
export class File implements Deserializable {
|
||||
export class File extends Deserializer {
|
||||
public name: string;
|
||||
public type: string;
|
||||
|
||||
@ -14,12 +14,6 @@ export class File implements Deserializable {
|
||||
* @param type The tape (jpg, png, pdf)
|
||||
*/
|
||||
public constructor(input?: any) {
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
}
|
||||
|
||||
public deserialize(input: any): void {
|
||||
Object.assign(this, input);
|
||||
super(input);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import { User } from '../users/user';
|
||||
* @ignore
|
||||
*/
|
||||
export class Mediafile extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public title: string;
|
||||
public mediafile: File;
|
||||
@ -18,11 +17,7 @@ export class Mediafile extends BaseModel {
|
||||
public timestamp: string;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'mediafiles/mediafile';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('mediafiles/mediafile', input);
|
||||
}
|
||||
|
||||
public deserialize(input: any): void {
|
||||
|
@ -5,17 +5,12 @@ import { BaseModel } from '../base.model';
|
||||
* @ignore
|
||||
*/
|
||||
export class Category extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public name: string;
|
||||
public prefix: string;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'motions/category';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('motions/category', input);
|
||||
}
|
||||
|
||||
public toString = (): string => {
|
||||
|
@ -6,17 +6,12 @@ import { Item } from '../agenda/item';
|
||||
* @ignore
|
||||
*/
|
||||
export class MotionBlock extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public title: string;
|
||||
public agenda_item_id: number;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'motions/motion-block';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('motions/motion-block', input);
|
||||
}
|
||||
|
||||
public getAgenda(): BaseModel | BaseModel[] {
|
||||
|
@ -5,7 +5,6 @@ import { BaseModel } from '../base.model';
|
||||
* @ignore
|
||||
*/
|
||||
export class MotionChangeReco extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public motion_version_id: number;
|
||||
public rejected: boolean;
|
||||
@ -17,11 +16,7 @@ export class MotionChangeReco extends BaseModel {
|
||||
public creation_time: string;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'motions/motion-change-recommendation';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('motions/motion-change-recommendation', input);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
15
client/src/app/shared/models/motions/motion-comment.ts
Normal file
15
client/src/app/shared/models/motions/motion-comment.ts
Normal 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);
|
||||
}
|
||||
}
|
@ -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
|
||||
*/
|
||||
export class MotionLog implements Deserializable {
|
||||
export class MotionLog extends Deserializer {
|
||||
public message_list: string[];
|
||||
public person_id: number;
|
||||
public time: string;
|
||||
public message: string;
|
||||
|
||||
public constructor(input?: any) {
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
}
|
||||
|
||||
public deserialize(input: any): void {
|
||||
Object.assign(this, input);
|
||||
super(input);
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,17 @@
|
||||
import { Deserializable } from '../deserializable.model';
|
||||
import { Deserializer } from '../deserializer.model';
|
||||
|
||||
/**
|
||||
* Representation of a Motion Submitter.
|
||||
*
|
||||
* @ignore
|
||||
*/
|
||||
export class MotionSubmitter implements Deserializable {
|
||||
export class MotionSubmitter extends Deserializer {
|
||||
public id: number;
|
||||
public user_id: number;
|
||||
public motion_id: number;
|
||||
public weight: number;
|
||||
|
||||
public constructor(input?: any) {
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
}
|
||||
|
||||
public deserialize(input: any): void {
|
||||
Object.assign(this, input);
|
||||
super(input);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import { Workflow } from './workflow';
|
||||
import { User } from '../users/user';
|
||||
import { Category } from './category';
|
||||
import { WorkflowState } from './workflow-state';
|
||||
import { MotionComment } from './motion-comment';
|
||||
|
||||
/**
|
||||
* Representation of Motion.
|
||||
@ -15,7 +16,6 @@ import { WorkflowState } from './workflow-state';
|
||||
* @ignore
|
||||
*/
|
||||
export class Motion extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public identifier: string;
|
||||
public title: string;
|
||||
@ -29,7 +29,7 @@ export class Motion extends BaseModel {
|
||||
public origin: string;
|
||||
public submitters: MotionSubmitter[];
|
||||
public supporters_id: number[];
|
||||
public comments: Object[];
|
||||
public comments: MotionComment[];
|
||||
public state_id: number;
|
||||
public state_extension: string;
|
||||
public state_required_permission_to_see: string;
|
||||
@ -45,22 +45,7 @@ export class Motion extends BaseModel {
|
||||
public workflow: Workflow;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
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);
|
||||
}
|
||||
super('motions/motion', input);
|
||||
this.initDataStoreValues();
|
||||
}
|
||||
|
||||
@ -186,19 +171,26 @@ export class Motion extends BaseModel {
|
||||
public deserialize(input: any): void {
|
||||
Object.assign(this, input);
|
||||
|
||||
if (input.submitters instanceof Array) {
|
||||
this.submitters = [];
|
||||
if (input.submitters instanceof Array) {
|
||||
input.submitters.forEach(SubmitterData => {
|
||||
this.submitters.push(new MotionSubmitter(SubmitterData));
|
||||
});
|
||||
}
|
||||
|
||||
if (input.log_messages instanceof Array) {
|
||||
this.log_messages = [];
|
||||
if (input.log_messages instanceof Array) {
|
||||
input.log_messages.forEach(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));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Deserializable } from '../deserializable.model';
|
||||
import { Deserializer } from '../deserializer.model';
|
||||
import { Workflow } from './workflow';
|
||||
|
||||
/**
|
||||
@ -7,7 +7,7 @@ import { Workflow } from './workflow';
|
||||
* Part of the 'states'-array in motion/workflow
|
||||
* @ignore
|
||||
*/
|
||||
export class WorkflowState implements Deserializable {
|
||||
export class WorkflowState extends Deserializer {
|
||||
public id: number;
|
||||
public name: string;
|
||||
public action_word: string;
|
||||
@ -17,8 +17,6 @@ export class WorkflowState implements Deserializable {
|
||||
public allow_support: boolean;
|
||||
public allow_create_poll: boolean;
|
||||
public allow_submitter_edit: boolean;
|
||||
public versioning: boolean;
|
||||
public leave_old_version_active: boolean;
|
||||
public dont_set_identifier: boolean;
|
||||
public show_state_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
|
||||
*/
|
||||
public constructor(input?: any) {
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super(input);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,10 +45,6 @@ export class WorkflowState implements Deserializable {
|
||||
return nextStates;
|
||||
}
|
||||
|
||||
public deserialize(input: any): void {
|
||||
Object.assign(this, input);
|
||||
}
|
||||
|
||||
public toString = (): string => {
|
||||
return this.name;
|
||||
};
|
||||
|
@ -6,18 +6,13 @@ import { WorkflowState } from './workflow-state';
|
||||
* @ignore
|
||||
*/
|
||||
export class Workflow extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public name: string;
|
||||
public states: WorkflowState[];
|
||||
public first_state: number;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'motions/workflow';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('motions/workflow', input);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,6 @@ import { Item } from '../agenda/item';
|
||||
* @ignore
|
||||
*/
|
||||
export class Topic extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public title: string;
|
||||
public text: string;
|
||||
@ -15,11 +14,7 @@ export class Topic extends BaseModel {
|
||||
public agenda_item_id: number;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'topics/topic';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('topics/topic', input);
|
||||
}
|
||||
|
||||
public getAttachments(): Mediafile[] {
|
||||
|
@ -6,17 +6,12 @@ import { User } from './user';
|
||||
* @ignore
|
||||
*/
|
||||
export class Group extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public name: string;
|
||||
public permissions: string[];
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'users/group';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('users/group', input);
|
||||
}
|
||||
|
||||
public get users(): User[] {
|
||||
|
@ -6,17 +6,12 @@ import { User } from './user';
|
||||
* @ignore
|
||||
*/
|
||||
export class PersonalNote extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public user_id: number;
|
||||
public notes: Object;
|
||||
|
||||
public constructor(input: any) {
|
||||
super();
|
||||
this._collectionString = 'users/personal-note';
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('users/personal-note', input);
|
||||
}
|
||||
|
||||
public getUser(): User {
|
||||
|
@ -6,7 +6,6 @@ import { Group } from './group';
|
||||
* @ignore
|
||||
*/
|
||||
export class User extends BaseModel {
|
||||
protected _collectionString: string;
|
||||
public id: number;
|
||||
public username: string;
|
||||
public title: string;
|
||||
@ -25,12 +24,7 @@ export class User extends BaseModel {
|
||||
public default_password: string;
|
||||
|
||||
public constructor(input?: any) {
|
||||
super();
|
||||
this._collectionString = 'users/user';
|
||||
|
||||
if (input) {
|
||||
this.deserialize(input);
|
||||
}
|
||||
super('users/user', input);
|
||||
}
|
||||
|
||||
public get groups(): Group[] {
|
||||
|
@ -94,11 +94,11 @@ export class StartComponent extends BaseComponent implements OnInit {
|
||||
console.log('the user: ', user1fromStore);
|
||||
|
||||
console.log('remove a single user:');
|
||||
// this.DS.remove(User, 100);
|
||||
this.DS.remove('users/user', 100);
|
||||
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');
|
||||
// this.DS.remove(User, ...[321, 363, 399]);
|
||||
this.DS.remove('users/user', ...[321, 363, 399]);
|
||||
|
||||
console.log('test filter: ');
|
||||
console.log(this.DS.filter<User>(User, user => user.id === 1));
|
||||
|
Loading…
Reference in New Issue
Block a user