Skip to content

Commit

Permalink
feat(query-graphql): allow descriptions to be defined
Browse files Browse the repository at this point in the history
  • Loading branch information
TriPSs committed Oct 28, 2021
1 parent 3ef8346 commit 568f228
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/query-graphql/src/resolvers/create.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const Creatable =
class CreateResolverBase extends BaseClass {
@ResolverMutation(
() => DTOClass,
{ name: createOneMutationName },
{ name: createOneMutationName, description: opts?.one?.description },
commonResolverOpts,
{
interceptors: [
Expand Down Expand Up @@ -156,7 +156,7 @@ export const Creatable =

@ResolverMutation(
() => [DTOClass],
{ name: createManyMutationName },
{ name: createManyMutationName, description: opts?.many?.description },
{ ...commonResolverOpts },
{
interceptors: [
Expand Down
4 changes: 2 additions & 2 deletions packages/query-graphql/src/resolvers/delete.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const Deletable =
class DeleteResolverBase extends BaseClass {
@ResolverMutation(
() => DeleteOneResponse,
{ name: deleteOneMutationName },
{ name: deleteOneMutationName, description: opts?.one?.description },
commonResolverOpts,
{ interceptors: [HookInterceptor(HookTypes.BEFORE_DELETE_ONE, DTOClass), AuthorizerInterceptor(DTOClass)] },
opts.one ?? {},
Expand All @@ -133,7 +133,7 @@ export const Deletable =

@ResolverMutation(
() => DMR,
{ name: deleteManyMutationName },
{ name: deleteManyMutationName, description: opts?.many?.description },
commonResolverOpts,
{ interceptors: [HookInterceptor(HookTypes.BEFORE_DELETE_MANY, DTOClass), AuthorizerInterceptor(DTOClass)] },
opts.many ?? {},
Expand Down
4 changes: 2 additions & 2 deletions packages/query-graphql/src/resolvers/read.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const Readable =
class ReadResolverBase extends BaseClass {
@ResolverQuery(
() => DTOClass,
{ nullable: true, name: readOneQueryName },
{ name: readOneQueryName, description: opts?.one?.description },
commonResolverOpts,
{ interceptors: [HookInterceptor(HookTypes.BEFORE_FIND_ONE, DTOClass), AuthorizerInterceptor(DTOClass)] },
opts.one ?? {},
Expand All @@ -89,7 +89,7 @@ export const Readable =

@ResolverQuery(
() => QueryArgs.ConnectionType.resolveType,
{ name: readManyQueryName },
{ name: readManyQueryName, description: opts?.many?.description },
commonResolverOpts,
{ interceptors: [HookInterceptor(HookTypes.BEFORE_QUERY_MANY, DTOClass), AuthorizerInterceptor(DTOClass)] },
opts.many ?? {},
Expand Down
2 changes: 2 additions & 0 deletions packages/query-graphql/src/resolvers/resolver.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { PagingStrategies, QueryArgsTypeOpts } from '../types';
type NamedEndpoint = {
/** Specify to override the name of the graphql query or mutation * */
name?: string;
/** Specify a description for the graphql query or mutation* */
description?: string;
};

export interface ResolverOpts extends ResolverMethodOpts, DTONamesOpts {
Expand Down
4 changes: 2 additions & 2 deletions packages/query-graphql/src/resolvers/update.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const Updateable =
class UpdateResolverBase extends BaseClass {
@ResolverMutation(
() => DTOClass,
{ name: updateOneMutationName },
{ name: updateOneMutationName, description: opts?.one?.description },
{
interceptors: [
HookInterceptor(HookTypes.BEFORE_UPDATE_ONE, UpdateDTOClass, DTOClass),
Expand Down Expand Up @@ -164,7 +164,7 @@ export const Updateable =

@ResolverMutation(
() => UMR,
{ name: updateManyMutationName },
{ name: updateManyMutationName, description: opts?.many?.description },
{
interceptors: [
HookInterceptor(HookTypes.BEFORE_UPDATE_MANY, UpdateDTOClass, DTOClass),
Expand Down

0 comments on commit 568f228

Please sign in to comment.