11import type { AtLeast } from "../types/mod.ts" ;
2- import { Base , type IBase } from "./Base.ts" ;
3-
4- /**
5- * Flags used in the {@link IOrganization} interface.
6- */
7- interface OrganizationFlags {
8- /** Whether or not the organization is active */
9- isActive : boolean ;
10- /** Whether or not the organization is soft deleted */
11- isDeleted : boolean ;
12- /** Whether or not the organization is a demo organization */
13- isDemo : boolean ;
14- }
2+ import { Base , type BaseParameters } from "./Base.ts" ;
153
164/**
175 * Parameters for building an {@link Organization} entity.
186 */
19- export interface IOrganization extends IBase < "Organization" > {
7+ export interface OrganizationParameters extends BaseParameters < "Organization" > {
208 /** A list of domains (and ports) linked to the Organziation */
219 domains : string [ ] ;
2210 /** Flags options for the organization */
23- flags : OrganizationFlags ;
11+ flags : {
12+ /** Whether or not the organization is active */
13+ isActive : boolean ;
14+ /** Whether or not the organization is soft deleted */
15+ isDeleted : boolean ;
16+ /** Whether or not the organization is a demo organization */
17+ isDemo : boolean ;
18+ } ;
2419 /** Name of the organization */
2520 name : string ;
2621 /** Slug for generating subdomains for the organization */
@@ -31,14 +26,14 @@ export interface IOrganization extends IBase<"Organization"> {
3126 * A class the represents an organization.
3227 */
3328export class Organization extends Base < "Organization" > {
34- readonly domains : string [ ] ;
35- readonly flags : OrganizationFlags ;
36- readonly name : string ;
37- readonly slug : string ;
29+ readonly domains : OrganizationParameters [ "domains" ] ;
30+ readonly flags : OrganizationParameters [ "flags" ] ;
31+ readonly name : OrganizationParameters [ "name" ] ;
32+ readonly slug : OrganizationParameters [ "slug" ] ;
3833
3934 /**
4035 * Create an Organization entity.
41- * @param params An object of required and optional parameters referenced from the {@link IOrganization } interface.
36+ * @param params An object of required and optional parameters referenced from the {@link OrganizationParameters } interface.
4237 */
4338 constructor ( {
4439 flags = {
@@ -55,7 +50,10 @@ export class Organization extends Base<"Organization"> {
5550 name,
5651 slug,
5752 domains,
58- } : AtLeast < IOrganization , "createdBy" | "domains" | "name" | "slug" > ) {
53+ } : AtLeast <
54+ OrganizationParameters ,
55+ "createdBy" | "domains" | "name" | "slug"
56+ > ) {
5957 super ( {
6058 _id,
6159 _version,
@@ -74,7 +72,7 @@ export class Organization extends Base<"Organization"> {
7472 * Transforms the organization class object to a json object. Useful for saving the entity to the database.
7573 * @returns a json representation of the organization.
7674 */
77- toJSON ( ) : Omit < IOrganization , "kind" > {
75+ toJSON ( ) : Omit < OrganizationParameters , "kind" > {
7876 const json = super . toJSON ( ) ;
7977 return {
8078 ...json ,
0 commit comments