51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { AsyncHooksService } from '@lib/__hooks';
|
|
import { IEngineSchema, MetaBy, MetaPermissions } from '@seed/engine/EngineSchema';
|
|
import { StreamOperationType, PostHookStatus } from '@seed/services/change-stream/change-stream.components';
|
|
import { ModelCollectionEnum } from '@src/__indexes/__collections';
|
|
import GraphQLJSON from 'graphql-type-json';
|
|
import { InputType, ObjectType, Field } from 'type-graphql';
|
|
|
|
@ObjectType()
|
|
@InputType()
|
|
export class StreamBaseSchema {
|
|
@Field(() => StreamOperationType)
|
|
operation: StreamOperationType;
|
|
|
|
@Field(() => String)
|
|
collection: ModelCollectionEnum | keyof AsyncHooksService | string;
|
|
|
|
@Field({ nullable: true })
|
|
documentKey?: string;
|
|
|
|
@Field(() => PostHookStatus)
|
|
hookStatus: PostHookStatus;
|
|
|
|
@Field({ nullable: true })
|
|
logMessage?: string;
|
|
|
|
@Field(() => GraphQLJSON, { nullable: true })
|
|
insertedValues?: any;
|
|
@Field(() => GraphQLJSON, { nullable: true })
|
|
updatedValues?: any;
|
|
@Field(() => GraphQLJSON, { nullable: true })
|
|
beforeUpdateValues?: any;
|
|
|
|
logInfo?: any;
|
|
}
|
|
|
|
@ObjectType()
|
|
export class StreamDBInterfaceSchema extends StreamBaseSchema {}
|
|
|
|
@ObjectType()
|
|
export class StreamDBSchema extends StreamDBInterfaceSchema {}
|
|
|
|
@ObjectType({ implements: IEngineSchema })
|
|
export class StreamSchema extends StreamDBSchema implements IEngineSchema {
|
|
_id: string;
|
|
organisationId?: string | undefined;
|
|
by?: MetaBy | undefined;
|
|
permissions: MetaPermissions;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
}
|