You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
52 lines
1.5 KiB
import type { IActor } from "./actor.model";
|
|
import { Actor } from "./actor.model";
|
|
import type { Paginate } from "../paginate";
|
|
import type { IResource } from "../resource";
|
|
import type { IEvent } from "../event.model";
|
|
import type { IDiscussion } from "../discussions";
|
|
import type { IPost } from "../post.model";
|
|
import type { IAddress } from "../address.model";
|
|
import { Address } from "../address.model";
|
|
import { ActorType, Openness } from "../enums";
|
|
import type { IMember } from "./member.model";
|
|
import type { ITodoList } from "../todolist";
|
|
|
|
export interface IGroup extends IActor {
|
|
members: Paginate<IMember>;
|
|
resources: Paginate<IResource>;
|
|
todoLists: Paginate<ITodoList>;
|
|
discussions: Paginate<IDiscussion>;
|
|
organizedEvents: Paginate<IEvent>;
|
|
physicalAddress: IAddress;
|
|
openness: Openness;
|
|
}
|
|
|
|
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 };
|
|
|
|
discussions: Paginate<IDiscussion> = { elements: [], total: 0 };
|
|
|
|
organizedEvents: Paginate<IEvent> = { elements: [], total: 0 };
|
|
|
|
posts: Paginate<IPost> = { elements: [], total: 0 };
|
|
|
|
constructor(hash: IGroup | Record<string, unknown> = {}) {
|
|
super(hash);
|
|
this.type = ActorType.GROUP;
|
|
|
|
this.patch(hash);
|
|
}
|
|
|
|
openness: Openness = Openness.INVITE_ONLY;
|
|
|
|
physicalAddress: IAddress = new Address();
|
|
|
|
patch(hash: IGroup | Record<string, unknown>): void {
|
|
Object.assign(this, hash);
|
|
}
|
|
}
|