import { Field, InputType } from 'type-graphql'; import { OrderByDirection } from '@/types'; export const createOrderByType = ( inputName: string, orderableFieldsEnum: { [s: string]: T } ) => { @InputType(`${inputName}OrderByInput`) class OrderBy { @Field(() => orderableFieldsEnum, { nullable: false }) field!: T; @Field(() => OrderByDirection, { nullable: false }) direction!: OrderByDirection; } return OrderBy; };