backend/lib/seed/engine/EngineSchema.ts
2025-05-14 21:45:16 +02:00

59 lines
1.3 KiB
TypeScript

import { EnginePathComponent } from '@seed/interfaces/components';
import { AccountTypeEnum } from '@src/accounts/account.components';
import { Field, ID, ObjectType, Authorized, InterfaceType } from 'type-graphql';
@ObjectType()
export class MetaBy {
@Field(() => ID, { nullable: true })
createdBy?: string;
@Field(() => ID, { nullable: true })
updatedBy?: string;
@Field(() => ID, { nullable: true })
deletedBy?: string;
}
@ObjectType()
export class MetaPermissions {
@Field(() => [String])
r: string[];
@Authorized(AccountTypeEnum.admin)
@Field(() => [String])
w: string[];
@Authorized(AccountTypeEnum.admin)
@Field(() => [String])
d: string[];
}
@InterfaceType()
export abstract class IEngineSchema {
@Field(() => ID)
_id: string;
@Field(() => ID, { nullable: true })
organisationId?: string;
@Field(() => [EnginePathComponent], { nullable: true })
paths?: EnginePathComponent[];
searchT?: string;
@Field(() => MetaBy, { nullable: true })
by?: MetaBy;
@Field(() => MetaPermissions, { nullable: true })
permissions: MetaPermissions;
@Field()
createdAt: Date;
@Field()
updatedAt: Date;
@Field(() => [String], { nullable: true })
tagsIds?: string[];
}