2020-02-18 08:57:00 +01:00
|
|
|
import { Actor, ActorType, IActor } from "./actor.model";
|
|
|
|
import { Paginate } from "../paginate";
|
|
|
|
import { IResource } from "../resource";
|
|
|
|
import { ITodoList } from "../todos";
|
|
|
|
import { IEvent } from "../event.model";
|
|
|
|
import { IConversation } from "../conversations";
|
|
|
|
import { IPerson } from "./person.model";
|
2019-04-26 15:22:16 +02:00
|
|
|
|
|
|
|
export enum MemberRole {
|
2020-02-18 08:57:00 +01:00
|
|
|
NOT_APPROVED = "NOT_APPROVED",
|
|
|
|
INVITED = "INVITED",
|
|
|
|
MEMBER = "MEMBER",
|
|
|
|
MODERATOR = "MODERATOR",
|
|
|
|
ADMINISTRATOR = "ADMINISTRATOR",
|
|
|
|
CREATOR = "CREATOR",
|
|
|
|
REJECTED = "REJECTED",
|
2019-04-26 15:22:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IGroup extends IActor {
|
2020-02-18 08:57:00 +01:00
|
|
|
members: Paginate<IMember>;
|
|
|
|
resources: Paginate<IResource>;
|
|
|
|
todoLists: Paginate<ITodoList>;
|
|
|
|
conversations: Paginate<IConversation>;
|
|
|
|
organizedEvents: Paginate<IEvent>;
|
2019-04-26 15:22:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IMember {
|
2020-02-18 08:57:00 +01:00
|
|
|
id?: string;
|
2019-04-26 15:22:16 +02:00
|
|
|
role: MemberRole;
|
|
|
|
parent: IGroup;
|
|
|
|
actor: IActor;
|
2020-02-18 08:57:00 +01:00
|
|
|
invitedBy?: IPerson;
|
2019-04-26 15:22:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export class Group extends Actor implements IGroup {
|
2020-02-18 08:57:00 +01:00
|
|
|
members: Paginate<IMember> = { elements: [], total: 0 };
|
|
|
|
|
|
|
|
resources: Paginate<IResource> = { elements: [], total: 0 };
|
|
|
|
|
|
|
|
todoLists: Paginate<ITodoList> = { elements: [], total: 0 };
|
|
|
|
|
|
|
|
conversations: Paginate<IConversation> = { elements: [], total: 0 };
|
|
|
|
|
|
|
|
organizedEvents!: Paginate<IEvent>;
|
2019-09-02 10:50:00 +02:00
|
|
|
|
|
|
|
constructor(hash: IGroup | {} = {}) {
|
|
|
|
super(hash);
|
2020-02-18 08:57:00 +01:00
|
|
|
this.type = ActorType.GROUP;
|
2019-09-02 10:50:00 +02:00
|
|
|
|
|
|
|
this.patch(hash);
|
|
|
|
}
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
patch(hash: any) {
|
2019-09-02 10:50:00 +02:00
|
|
|
Object.assign(this, hash);
|
|
|
|
}
|
2019-04-26 15:22:16 +02:00
|
|
|
}
|