import { InputType, Int, Field, ArgsType, ObjectType, Args } from 'type-graphql'; import { Max, IsNotEmpty } from 'class-validator'; import { registerEnumType } from 'type-graphql'; import { AccountTypeEnum } from '@src/accounts/account.components'; import { TranslatableComponent } from '@src/__components/components'; import { ModelCollectionEnum } from '@src/__indexes/__collections'; import { IsRefExist } from '@seed/engine/decorators/db.guard'; /* ███████╗███╗ ██╗██╗ ██╗███╗ ███╗ ██╔════╝████╗ ██║██║ ██║████╗ ████║ █████╗ ██╔██╗ ██║██║ ██║██╔████╔██║ ██╔══╝ ██║╚██╗██║██║ ██║██║╚██╔╝██║ ███████╗██║ ╚████║╚██████╔╝██║ ╚═╝ ██║ ╚══════╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ */ export enum SettingsType { emails = 'emails', ac = 'ac', env = 'env', instagram = 'instagram', errors = 'errors', others = 'others', } registerEnumType(SettingsType, { name: 'SettingsType', }); export enum AccountGenderEnum { m = 'm', f = 'f', other = 'other', } registerEnumType(AccountGenderEnum, { name: 'AccountGenderEnum', }); export enum deviceOs { ios = 'ios', android = 'android', } registerEnumType(deviceOs, { name: 'deviceOs', }); /* * Permissions */ export enum PermissionType { r = 'r', w = 'w', d = 'd', } registerEnumType(PermissionType, { name: 'PermissionType', }); /* * Date stuff */ export enum RangeType { strict = 'strict', // IS << A - B >> IE intersect = 'intersect', // IS << A - IE << B || intersectLarge = 'intersectLarge', included = 'included', // IS << A - B >> IE } registerEnumType(RangeType, { name: 'RangeType', }); export enum DateTabType { today = 'today', tomorrow = 'tomorrow', upcomming = 'upcomming', past = 'past', } registerEnumType(DateTabType, { name: 'DateTabType', }); export enum SizeTypeEnum { cm = 'cm', inch = 'inch', } registerEnumType(SizeTypeEnum, { name: 'SizeTypeEnum', }); export enum WeightTypeEnum { lbs = 'lbs', g = 'g', } registerEnumType(WeightTypeEnum, { name: 'WeightTypeEnum', }); export enum QualityEnum { verygood = 'verygood', good = 'good', neutral = 'neutral', poor = 'poor', verypoor = 'verypoor', } registerEnumType(QualityEnum, { name: 'QualityEnum', }); export enum StatusEnum { draft = 'draft', processing = 'processing', validated = 'validated', cancelled = 'cancelled', expired = 'expired', } registerEnumType(StatusEnum, { name: 'StatusEnum', }); // export enum IntervalEnum { // '15' = '15', // '30' = '30', // '45' = '45', // '60' = '60', // '90' = '90', // '120' = '120', // } // registerEnumType(IntervalEnum, { // name: 'IntervalEnum', // }); /* ██████╗ ██████╗ ███╗ ███╗██████╗ ██████╗ ███╗ ██╗███████╗███╗ ██╗████████╗███████╗ ██╔════╝██╔═══██╗████╗ ████║██╔══██╗██╔═══██╗████╗ ██║██╔════╝████╗ ██║╚══██╔══╝██╔════╝ ██║ ██║ ██║██╔████╔██║██████╔╝██║ ██║██╔██╗ ██║█████╗ ██╔██╗ ██║ ██║ ███████╗ ██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██║██║╚██╗██║██╔══╝ ██║╚██╗██║ ██║ ╚════██║ ╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚██████╔╝██║ ╚████║███████╗██║ ╚████║ ██║ ███████║ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝ */ @ObjectType() export class EnginePathComponent { @Field(() => ModelCollectionEnum) @IsNotEmpty() ressourceModel: ModelCollectionEnum | string; @Field() @IsNotEmpty() // @IsRefExist() ressourceId: string; } /* * AUTH * */ @ObjectType() export class FirebaseTokenResult { @Field() localId: string; @Field({ nullable: true }) email?: string; @Field({ nullable: true }) displayName?: string; @Field() idToken: string; @Field({ nullable: true }) registered?: boolean; @Field() refreshToken: string; @Field() expiresIn: string; } /* * MISC */ @InputType('PositionInInput') export class PositionInInterface { @Field() _id: string; @Field(() => Int) order: number; } []; // @ObjectType() // @InputType('TranslatableInput') // export class TranslatableComponent { // @Field() // en: string; // } /* * RESULTS */ @ObjectType('IdResult') export class IdResult { @Field() _id: string; } @ObjectType() export class SimpleResult { @Field() message: string; } /* * DEVICES */ @ObjectType() @InputType('DeviceInput') export class DeviceComponent { @Field() uid: string; @Field(() => deviceOs) os: deviceOs; @Field() pushToken: string; @Field() deviceName: string; } /* * IMAGES */ @ObjectType() @InputType('ImageInput') export default class ImageComponent { @Field({ nullable: true }) title?: string; @Field({ nullable: true }) fileType?: string; @Field() large: string; @Field({ nullable: true }) medium?: string; @Field({ nullable: true }) small?: string; } @ObjectType() @InputType('NewPermissionInputC') export class NewPermissionInput { @Field(() => PermissionType) permissionType: PermissionType; @Field(() => AccountTypeEnum) permission: AccountTypeEnum; } @ObjectType() @InputType('SEOInput') export class SEOField { @Field(() => TranslatableComponent) title: TranslatableComponent; @Field(() => TranslatableComponent) description: TranslatableComponent; @Field(() => TranslatableComponent, { nullable: true }) keywords?: TranslatableComponent; @Field(() => ImageComponent, { nullable: true }) thumbnail?: ImageComponent; } @ObjectType() @InputType('SEOSimpleInput') export class SEOSimpleField { @Field() title: string; @Field() description: string; @Field({ nullable: true }) keywords?: string; @Field(() => ImageComponent, { nullable: true }) thumbnail?: ImageComponent; } @ObjectType() @InputType('SizeComponentInput') export class SizeComponent { @Field() unit: SizeTypeEnum; @Field() value: number; } @ObjectType() @InputType('WeightComponentInput') export class WeightComponent { @Field() unit: WeightTypeEnum; @Field() value: number; } @ObjectType() @InputType('CustomTagsInput') export class CustomTagsInterface { @Field() key: string; @Field() value: string; }