import { ObjectType, Field, ID, ArgsType, InputType, Int } from 'type-graphql'; import { BaseGraphModel } from '@seed/graphql/BaseGraphModel'; import ImageComponent, { SEOSimpleField } from '@seed/interfaces/components'; import { GetArgs, GetManyArgs } from '@seed/graphql/Request'; import { Permission } from '@seed/interfaces/permission'; import { AccountTypeEnum } from '@src/accounts/account.components'; const permissions: Permission = { c: [AccountTypeEnum.admin], r: [AccountTypeEnum.public], w: [AccountTypeEnum.admin], d: [AccountTypeEnum.admin], }; @ObjectType() export default class BaseSEOSimpleModel extends BaseGraphModel { public constructor(collectionName?: string, perm?: Permission) { const cName = collectionName ? collectionName : 'articles'; const permission = perm ? perm : permissions; super({ // ...init, collectionName: cName, permissions: permission, }); } @Field({ nullable: true }) title?: string; @Field({ nullable: true }) teaser?: string; @Field(() => ImageComponent, { nullable: true }) cover?: ImageComponent; @Field(() => ImageComponent, { nullable: true }) thumbnail?: ImageComponent; @Field(() => [ImageComponent], { nullable: true }) extraImages?: ImageComponent[]; @Field({ nullable: true }) content?: string; @Field(() => SEOSimpleField, { nullable: true }) seo?: SEOSimpleField; @Field({ nullable: true }) urls?: string; searchOptions(): string[] { return []; } filterOptions(): string[] { return []; } } @ArgsType() export class BaseSEOArgs extends GetManyArgs {} @InputType() export class NewBaseSEOSimpleInput implements Partial { @Field({ nullable: true }) title?: string; @Field({ nullable: true }) teaser?: string; @Field(() => ImageComponent, { nullable: true }) cover?: ImageComponent; @Field(() => ImageComponent, { nullable: true }) thumbnail?: ImageComponent; @Field(() => [ImageComponent], { nullable: true }) extraImages?: ImageComponent[]; @Field({ nullable: true }) content?: string; @Field(() => SEOSimpleField, { nullable: true }) seo?: SEOSimpleField; @Field({ nullable: true }) urls?: string; } @InputType() export class EditBaseSEOSimpleInput implements Partial { @Field({ nullable: true }) title?: string; @Field({ nullable: true }) teaser?: string; @Field(() => ImageComponent, { nullable: true }) cover?: ImageComponent; @Field(() => ImageComponent, { nullable: true }) thumbnail?: ImageComponent; @Field(() => [ImageComponent], { nullable: true }) extraImages?: ImageComponent[]; @Field({ nullable: true }) content?: string; @Field(() => SEOSimpleField, { nullable: true }) seo?: SEOSimpleField; @Field({ nullable: true }) urls?: string; }