48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { Actor, ActorType, IActor } from '@/types/actor/actor.model';
|
|
import { Paginate } from '@/types/paginate';
|
|
import { IResource } from '@/types/resource';
|
|
import { ITodoList } from '@/types/todos';
|
|
import { IEvent } from '@/types/event.model';
|
|
import { IConversation } from '@/types/conversations';
|
|
|
|
export enum MemberRole {
|
|
PENDING,
|
|
MEMBER,
|
|
MODERATOR,
|
|
ADMIN,
|
|
}
|
|
|
|
export interface IGroup extends IActor {
|
|
members: Paginate<IMember>;
|
|
resources: Paginate<IResource>;
|
|
todoLists: Paginate<ITodoList>;
|
|
conversations: Paginate<IConversation>;
|
|
organizedEvents: Paginate<IEvent>;
|
|
}
|
|
|
|
export interface IMember {
|
|
id?: string;
|
|
role: MemberRole;
|
|
parent: IGroup;
|
|
actor: IActor;
|
|
}
|
|
|
|
export class Group extends Actor implements IGroup {
|
|
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>;
|
|
|
|
constructor(hash: IGroup | {} = {}) {
|
|
super(hash);
|
|
this.type = ActorType.GROUP;
|
|
|
|
this.patch(hash);
|
|
}
|
|
|
|
patch (hash: any) {
|
|
Object.assign(this, hash);
|
|
}
|
|
}
|