diff --git a/schema.graphql b/schema.graphql index a61adae5d6..535c8368cb 100644 --- a/schema.graphql +++ b/schema.graphql @@ -140,6 +140,10 @@ type AgendaItem { users: [User] } +input AgendaItemCategoryWhereInput { + name_contains: String +} + type AgendaSection { _id: ID! createdAt: Date! @@ -1556,7 +1560,7 @@ type Query { agendaCategory(id: ID!): AgendaCategory! agendaItemByEvent(relatedEventId: ID!): [AgendaItem] agendaItemByOrganization(organizationId: ID!): [AgendaItem] - agendaItemCategoriesByOrganization(organizationId: ID!): [AgendaCategory] + agendaItemCategoriesByOrganization(organizationId: ID!, where: AgendaItemCategoryWhereInput): [AgendaCategory] chatById(id: ID!): Chat! chatsByUserId(id: ID!, where: ChatWhereInput): [Chat] checkAuth: User! diff --git a/src/resolvers/Query/agendaItemCategoriesByOrganization.ts b/src/resolvers/Query/agendaItemCategoriesByOrganization.ts index 8b1523011e..0e16a8c3bf 100644 --- a/src/resolvers/Query/agendaItemCategoriesByOrganization.ts +++ b/src/resolvers/Query/agendaItemCategoriesByOrganization.ts @@ -1,5 +1,6 @@ import type { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { AgendaCategoryModel } from "../../models"; +import { getWhere } from "./helperFunctions/getWhere"; /** * This query will fetch all categories for the organization from database. * @param _parent- @@ -8,7 +9,9 @@ import { AgendaCategoryModel } from "../../models"; */ export const agendaItemCategoriesByOrganization: QueryResolvers["agendaItemCategoriesByOrganization"] = async (_parent, args) => { + const where = getWhere(args.where); return await AgendaCategoryModel.find({ organizationId: args.organizationId, + ...where, }).lean(); }; diff --git a/src/resolvers/Query/helperFunctions/getWhere.ts b/src/resolvers/Query/helperFunctions/getWhere.ts index 95edcce5e8..a74e77c3a8 100644 --- a/src/resolvers/Query/helperFunctions/getWhere.ts +++ b/src/resolvers/Query/helperFunctions/getWhere.ts @@ -15,6 +15,7 @@ import type { ActionItemCategoryWhereInput, ChatWhereInput, EventVolunteerWhereInput, + AgendaItemCategoryWhereInput, } from "../../../types/generatedGraphQLTypes"; /** @@ -42,6 +43,7 @@ export const getWhere = ( DonationWhereInput & ActionItemWhereInput & ActionItemCategoryWhereInput & + AgendaItemCategoryWhereInput & CampaignWhereInput & FundWhereInput & PledgeWhereInput & diff --git a/src/typeDefs/inputs.ts b/src/typeDefs/inputs.ts index 43ffbba727..3314d476c4 100644 --- a/src/typeDefs/inputs.ts +++ b/src/typeDefs/inputs.ts @@ -95,6 +95,10 @@ export const inputs = gql` is_disabled: Boolean } + input AgendaItemCategoryWhereInput { + name_contains: String + } + input CreateAgendaCategoryInput { name: String! description: String diff --git a/src/typeDefs/queries.ts b/src/typeDefs/queries.ts index d3fd321505..469de1f003 100644 --- a/src/typeDefs/queries.ts +++ b/src/typeDefs/queries.ts @@ -32,7 +32,10 @@ export const queries = gql` agendaItemByOrganization(organizationId: ID!): [AgendaItem] - agendaItemCategoriesByOrganization(organizationId: ID!): [AgendaCategory] + agendaItemCategoriesByOrganization( + organizationId: ID! + where: AgendaItemCategoryWhereInput + ): [AgendaCategory] getAgendaItem(id: ID!): AgendaItem diff --git a/src/types/generatedGraphQLTypes.ts b/src/types/generatedGraphQLTypes.ts index 363dfb4e35..7256f27fc5 100644 --- a/src/types/generatedGraphQLTypes.ts +++ b/src/types/generatedGraphQLTypes.ts @@ -210,6 +210,10 @@ export type AgendaItem = { users?: Maybe>>; }; +export type AgendaItemCategoryWhereInput = { + name_contains?: InputMaybe; +}; + export type AgendaSection = { __typename?: 'AgendaSection'; _id: Scalars['ID']['output']; @@ -2463,6 +2467,7 @@ export type QueryAgendaItemByOrganizationArgs = { export type QueryAgendaItemCategoriesByOrganizationArgs = { organizationId: Scalars['ID']['input']; + where?: InputMaybe; }; @@ -3510,6 +3515,7 @@ export type ResolversTypes = { AdvertisementsConnection: ResolverTypeWrapper & { edges?: Maybe>> }>; AgendaCategory: ResolverTypeWrapper; AgendaItem: ResolverTypeWrapper; + AgendaItemCategoryWhereInput: AgendaItemCategoryWhereInput; AgendaSection: ResolverTypeWrapper; AggregatePost: ResolverTypeWrapper; AggregateUser: ResolverTypeWrapper; @@ -3745,6 +3751,7 @@ export type ResolversParentTypes = { AdvertisementsConnection: Omit & { edges?: Maybe>> }; AgendaCategory: InterfaceAgendaCategoryModel; AgendaItem: InterfaceAgendaItemModel; + AgendaItemCategoryWhereInput: AgendaItemCategoryWhereInput; AgendaSection: InterfaceAgendaSectionModel; AggregatePost: AggregatePost; AggregateUser: AggregateUser;