Skip to content

Commit

Permalink
feat(query-graphql): allow descriptions to be defined in relations
Browse files Browse the repository at this point in the history
  • Loading branch information
TriPSs committed Oct 28, 2021
1 parent 568f228 commit 0fe9580
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/query-graphql/src/resolvers/relations/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export const flattenRelations = <RT extends ResolverRelation<unknown> | Resolver
export const removeRelationOpts = <Relation>(
opts: ResolverRelation<Relation> | ResolverRelationReference<unknown, Relation>,
): ResolverMethodOpts =>
omit(opts, 'DTO', 'keys', 'nullable', 'dtoName', 'relationName', 'disableRead', 'disableUpdate', 'disableRemove');
omit(opts, 'DTO', 'keys', 'nullable', 'dtoName', 'relationName', 'disableRead', 'disableUpdate', 'disableRemove', 'description');
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ReadOneRelationMixin =
@ResolverField(
baseNameLower,
() => relationDTO,
{ nullable: relation.nullable, complexity: relation.complexity },
{ nullable: relation.nullable, complexity: relation.complexity, description: relation?.description },
commonResolverOpts,
{ interceptors: [AuthorizerInterceptor(DTOClass)] },
)
Expand Down Expand Up @@ -86,7 +86,7 @@ const ReadManyRelationMixin =
@ResolverField(
pluralBaseNameLower,
() => CT.resolveType,
{ nullable: relation.nullable, complexity: relation.complexity },
{ nullable: relation.nullable, complexity: relation.complexity, description: relation?.description },
commonResolverOpts,
{ interceptors: [AuthorizerInterceptor(DTOClass)] },
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ export type ResolverRelation<Relation> = {
*/
allowFiltering?: boolean;

/**
* Description of the relation.
*/
description?: string;

complexity?: Complexity;

auth?: AuthorizerOptions<Relation>;
Expand Down

0 comments on commit 0fe9580

Please sign in to comment.