2020-11-27 18:27:44 +00:00
|
|
|
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";
|
2021-06-15 15:25:33 +00:00
|
|
|
import { ActorType, GroupVisibility, Openness } from "../enums";
|
2020-11-27 18:27:44 +00:00
|
|
|
import type { IMember } from "./member.model";
|
|
|
|
import type { ITodoList } from "../todolist";
|
2021-02-24 18:06:48 +00:00
|
|
|
import { IActivity } from "../activity.model";
|
2019-04-26 13:22:16 +00:00
|
|
|
|
2020-11-06 10:34:32 +00:00
|
|
|
export interface IGroup extends IActor {
|
|
|
|
members: Paginate<IMember>;
|
|
|
|
resources: Paginate<IResource>;
|
|
|
|
todoLists: Paginate<ITodoList>;
|
|
|
|
discussions: Paginate<IDiscussion>;
|
|
|
|
organizedEvents: Paginate<IEvent>;
|
2021-07-21 10:02:14 +00:00
|
|
|
posts: Paginate<IPost>;
|
2020-11-06 10:34:32 +00:00
|
|
|
physicalAddress: IAddress;
|
|
|
|
openness: Openness;
|
2021-06-15 15:25:33 +00:00
|
|
|
visibility: GroupVisibility;
|
2021-01-20 17:16:44 +00:00
|
|
|
manuallyApprovesFollowers: boolean;
|
2021-02-24 18:06:48 +00:00
|
|
|
activity: Paginate<IActivity>;
|
2020-11-06 10:34:32 +00:00
|
|
|
}
|
|
|
|
|
2019-04-26 13:22:16 +00:00
|
|
|
export class Group extends Actor implements IGroup {
|
2020-02-18 07:57:00 +00:00
|
|
|
members: Paginate<IMember> = { elements: [], total: 0 };
|
|
|
|
|
|
|
|
resources: Paginate<IResource> = { elements: [], total: 0 };
|
|
|
|
|
|
|
|
todoLists: Paginate<ITodoList> = { elements: [], total: 0 };
|
|
|
|
|
2020-07-09 15:24:28 +00:00
|
|
|
discussions: Paginate<IDiscussion> = { elements: [], total: 0 };
|
2020-02-18 07:57:00 +00:00
|
|
|
|
2020-07-09 15:24:28 +00:00
|
|
|
organizedEvents: Paginate<IEvent> = { elements: [], total: 0 };
|
|
|
|
|
|
|
|
posts: Paginate<IPost> = { elements: [], total: 0 };
|
2019-09-02 08:50:00 +00:00
|
|
|
|
2020-11-06 10:34:32 +00:00
|
|
|
constructor(hash: IGroup | Record<string, unknown> = {}) {
|
2019-09-02 08:50:00 +00:00
|
|
|
super(hash);
|
2020-02-18 07:57:00 +00:00
|
|
|
this.type = ActorType.GROUP;
|
2019-09-02 08:50:00 +00:00
|
|
|
|
|
|
|
this.patch(hash);
|
|
|
|
}
|
2021-06-15 15:25:33 +00:00
|
|
|
visibility: GroupVisibility = GroupVisibility.PUBLIC;
|
2021-02-24 18:06:48 +00:00
|
|
|
activity: Paginate<IActivity> = { elements: [], total: 0 };
|
2020-08-31 10:40:30 +00:00
|
|
|
|
2020-11-06 10:34:32 +00:00
|
|
|
openness: Openness = Openness.INVITE_ONLY;
|
|
|
|
|
2020-08-05 14:44:08 +00:00
|
|
|
physicalAddress: IAddress = new Address();
|
2019-09-02 08:50:00 +00:00
|
|
|
|
2021-01-20 17:16:44 +00:00
|
|
|
manuallyApprovesFollowers = true;
|
|
|
|
|
2020-11-06 10:34:32 +00:00
|
|
|
patch(hash: IGroup | Record<string, unknown>): void {
|
2019-09-02 08:50:00 +00:00
|
|
|
Object.assign(this, hash);
|
|
|
|
}
|
2019-04-26 13:22:16 +00:00
|
|
|
}
|