33 lines
2.5 KiB
TypeScript
33 lines
2.5 KiB
TypeScript
import { Resolver, Query, FieldResolver, Root, Arg, Mutation, Ctx, Args, Authorized, ResolverInterface } from 'type-graphql';
|
|
|
|
import { getOneGeneric } from '@seed/graphql/BaseService';
|
|
import PromoModel from '@services/module-payments/functions/promos/promo.model';
|
|
import { ApolloContext } from '@seed/interfaces/context';
|
|
|
|
@Resolver(PromoModel)
|
|
export default class PromoResolver {
|
|
/*
|
|
██████╗ ██╗ ██╗███████╗██████╗ ██╗ ██╗
|
|
██╔═══██╗██║ ██║██╔════╝██╔══██╗╚██╗ ██╔╝
|
|
██║ ██║██║ ██║█████╗ ██████╔╝ ╚████╔╝
|
|
██║▄▄ ██║██║ ██║██╔══╝ ██╔══██╗ ╚██╔╝
|
|
╚██████╔╝╚██████╔╝███████╗██║ ██║ ██║
|
|
╚══▀▀═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝
|
|
*/
|
|
|
|
@Query(() => PromoModel)
|
|
async promosGetOneByCode(@Arg('code') code: string, @Ctx() ctx: ApolloContext): Promise<PromoModel> {
|
|
const model = new PromoModel();
|
|
return await model.getOne({ code }, ctx);
|
|
}
|
|
|
|
/*
|
|
███╗ ███╗██╗ ██╗████████╗ █████╗ ████████╗ ██████╗ ██████╗ ███████╗
|
|
████╗ ████║██║ ██║╚══██╔══╝██╔══██╗╚══██╔══╝██╔═══██╗██╔══██╗██╔════╝
|
|
██╔████╔██║██║ ██║ ██║ ███████║ ██║ ██║ ██║██████╔╝███████╗
|
|
██║╚██╔╝██║██║ ██║ ██║ ██╔══██║ ██║ ██║ ██║██╔══██╗╚════██║
|
|
██║ ╚═╝ ██║╚██████╔╝ ██║ ██║ ██║ ██║ ╚██████╔╝██║ ██║███████║
|
|
╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
|
|
*/
|
|
}
|