UNPKG

@aptly-as/types

Version:
100 lines (99 loc) 4.36 kB
import { AptlyModules } from '../core/index.js'; import { AptlyOrganizationRoles, AptlyAppScope, AptlySignageSchema } from '../core/index.js'; import { AptlyOrganizationStatus, AptlyOrganizationType } from '../enums/index.js'; import { AptlyAddress } from './address.js'; import { AptlyDocumentSchema } from './document.js'; import { AptlyInviteSchema } from './invite.js'; import { AptlyModuleItemSchema } from './module.js'; import { AptlyPlanInstalledSchema } from './plan.js'; import { AptlyProjectSchema } from './project.js'; import { AptlyUserSchema } from './user.js'; import { AptlyMediaSrcSchema } from './media.js'; import { AptlyBaseSchema, AptlyHistorySchema } from './extends.js'; import { AptlyDepartmentGeneric } from './department.js'; import { AptlyProducerSchema } from './producer.js'; import { AptlyAppSchema } from './app.js'; import { AptlyAlgorithmSchema } from './algorithm.js'; export type AptlyOrganizationContent = AptlyOrganizationContentSchema<string, string>; export type AptlyOrganizationContentSchema<ID, DATE> = Pick<AptlyOrganizationSchema<ID, DATE>, '_id' | 'name' | 'logoMedia' | 'logo'>; export type AptlyOrganization = AptlyOrganizationSchema<string, string>; export interface AptlyOrganizationSchema<ID, DATE> extends AptlyBaseSchema<ID, DATE>, AptlyHistorySchema<ID, DATE> { slug: string; number?: string; vat?: string; logo?: string | null; logoMedia?: AptlyMediaSrcSchema<ID, DATE> | null; negativeLogoMedia?: AptlyMediaSrcSchema<ID, DATE> | null; projectLogoMedia?: AptlyMediaSrcSchema<ID, DATE> | null; address: { billing: AptlyAddress; visit: AptlyAddress; post: AptlyAddress; }; phone: string; email: string; complaintEmail?: string; invoiceEmail?: string; algorithms: AptlyAlgorithmSchema<ID>[]; members: AptlyOrganizationMemberSchema<ID, DATE>[]; modules: AptlyModules[]; contractSign?: AptlySignageSchema<ID, DATE>; integrations: AptlyOrganizationIntegrationsSchema<ID>[]; invites: AptlyOrganizationInviteSchema<ID, DATE>[]; apps: AptlyOrganizationAppConfigSchema<ID, DATE>[]; storageId?: string; producer?: ID | AptlyProducerSchema<ID, DATE> | null; defaultProject?: ID | null; installedModules: AptlyModuleItemSchema<ID, DATE>[]; status?: AptlyOrganizationStatus; type?: AptlyOrganizationType[]; paymentApp?: ID | AptlyAppSchema<ID, DATE> | null; signApp?: ID | AptlyAppSchema<ID, DATE> | null; signMembers?: (ID | AptlyUserSchema<ID, DATE>)[]; termsDocument?: ID | AptlyDocumentSchema<ID, DATE> | null; offerDocument?: ID | AptlyDocumentSchema<ID, DATE> | null; plan: ID | AptlyPlanInstalledSchema<ID, DATE> | null; tripletexCustomer?: { id: number; name: string; }; created: DATE; fixedVariants?: boolean; } export type AptlyOrganizationIntegrations = AptlyOrganizationIntegrationsSchema<string>; export interface AptlyOrganizationIntegrationsSchema<ID> { _id: ID; integration: string; apiKey: string; organization: string; } export type AptlyOrganizationMember = AptlyOrganizationMemberSchema<string, string>; export interface AptlyOrganizationMemberSchema<ID, DATE> { _id: ID; user: AptlyUserSchema<ID, DATE> | ID; permissions: AptlyOrganizationRoles[]; position?: AptlyOrganizationMemberPosition; projects?: (ID | AptlyProjectSchema<ID, DATE>)[] | null; departments?: (ID | AptlyDepartmentGeneric<ID, DATE>)[] | null; createdAt?: DATE; } export declare enum AptlyOrganizationMemberPosition { Owner = 0, Admin = 1, Accounting = 2, User = 10 } export type AptlyOrganizationInvite = AptlyOrganizationInviteSchema<string, string>; export interface AptlyOrganizationInviteSchema<ID, DATE> extends AptlyInviteSchema<ID, DATE> { permissions?: AptlyOrganizationRoles[]; projects?: ID[] | null; departments?: ID[] | null; position?: AptlyOrganizationMemberPosition; clickCount: number; } export type AptlyOrganizationAppConfig<S extends object = object> = AptlyOrganizationAppConfigSchema<string, string, S>; export interface AptlyOrganizationAppConfigSchema<ID, DATE, S extends object = object> extends Omit<AptlyBaseSchema<ID, DATE>, 'name' | 'archived'> { app: ID | AptlyAppSchema<ID, DATE>; scope: AptlyAppScope[]; settings: S; }