2025-05-14 21:45:16 +02:00

46 lines
1.1 KiB
TypeScript

import { IEngineSchema, MetaBy, MetaPermissions } from '@seed/engine/EngineSchema';
import { GraphQLJSONObject } from 'graphql-type-json';
import { InputType, ObjectType, Field, Int } from 'type-graphql';
export enum AuthCodeType {
'verification' = 'verification',
'authentication' = 'authentication',
}
export enum AuthCanalType {
'email' = 'email',
'phone' = 'phone',
'authenticator' = 'authenticator',
}
@ObjectType()
export class AuthHistoryBaseSchema {
@Field()
code: string;
@Field(() => AuthCodeType)
type: AuthCodeType;
@Field(() => AuthCanalType)
canal: AuthCanalType;
}
@ObjectType()
export class AuthHistoryIDBSchema extends AuthHistoryBaseSchema {
@Field()
accountId: string;
}
@ObjectType()
export class AuthHistoryDBSchema extends AuthHistoryIDBSchema {}
@ObjectType({ implements: IEngineSchema })
export class AuthHistorySchema extends AuthHistoryDBSchema implements IEngineSchema {
_id: string;
organisationId?: string | undefined;
by?: MetaBy | undefined;
permissions: MetaPermissions;
createdAt: Date;
updatedAt: Date;
}