import { Arg, Args, Ctx, Query, Resolver } from 'type-graphql'; import OrderModel from '@services/module-payments/functions/orders/order.model'; import { ApolloContext } from '@lib/seed/interfaces/context'; import { AccountTypeEnum } from '@src/accounts/account.components'; import { OrderEngineSchema } from '../../schemas/order.schema'; import { OrderArgs } from '../../schemas/order.schema.input'; import { EngineMiddleware } from '@lib/seed/graphql/MiddlewareV2'; @Resolver(OrderModel) export default class OrderAdminEngineQueryResolver { /* ██████╗ ██╗ ██╗███████╗██████╗ ██╗ ██╗ ██╔═══██╗██║ ██║██╔════╝██╔══██╗╚██╗ ██╔╝ ██║ ██║██║ ██║█████╗ ██████╔╝ ╚████╔╝ ██║▄▄ ██║██║ ██║██╔══╝ ██╔══██╗ ╚██╔╝ ╚██████╔╝╚██████╔╝███████╗██║ ██║ ██║ ╚══▀▀═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ */ @Query(() => OrderEngineSchema) @EngineMiddleware({ authorization: [AccountTypeEnum.admin], }) async adminsOrdersGetOne(@Arg('id') id: string, @Ctx() ctx: ApolloContext): Promise { return new OrderModel().getOneGeneric(id, ctx); } @Query(() => [OrderEngineSchema]) @EngineMiddleware({ authorization: [AccountTypeEnum.admin], }) async adminsOrdersGetMany(@Args() args: OrderArgs, @Ctx() ctx: ApolloContext): Promise { const results = await new OrderModel().getManyGenericWithArgs(args, ctx); return results; } /* ███╗ ███╗██╗ ██╗████████╗ █████╗ ████████╗ ██████╗ ██████╗ ███████╗ ████╗ ████║██║ ██║╚══██╔══╝██╔══██╗╚══██╔══╝██╔═══██╗██╔══██╗██╔════╝ ██╔████╔██║██║ ██║ ██║ ███████║ ██║ ██║ ██║██████╔╝███████╗ ██║╚██╔╝██║██║ ██║ ██║ ██╔══██║ ██║ ██║ ██║██╔══██╗╚════██║ ██║ ╚═╝ ██║╚██████╔╝ ██║ ██║ ██║ ██║ ╚██████╔╝██║ ██║███████║ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ */ }