feat(api): add assignee filter to project daily events search#634
feat(api): add assignee filter to project daily events search#634
Conversation
There was a problem hiding this comment.
Pull request overview
Adds server-side support for filtering a project’s dailyEventsPortion results by assignee, so project overview event search can be constrained to events assigned to a specific user while preserving pagination.
Changes:
- Extended GraphQL schema to accept an
assignee: IDfilter for project daily events. - Updated
Project.dailyEventsPortionresolver to forwardassigneeintoEventsFactory.findDailyEventsPortion(...). - Updated the Mongo aggregation in
findDailyEventsPortionto apply anevent.assigneematch, and added resolver-level tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test/resolvers/project-daily-events-portion.test.ts | Adds resolver tests asserting assignee passthrough to the factory. |
| src/typeDefs/project.ts | Adds assignee to schema inputs/args for filtering daily events. |
| src/resolvers/project.js | Forwards assignee from GraphQL args to EventsFactory.findDailyEventsPortion. |
| src/models/eventsFactory.js | Adds assignee param + Mongo $match for event.assignee; refines mark-filter handling. |
| package.json | Bumps package version to 1.4.10. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| """ | ||
| Includes only events assigned to passed user id | ||
| """ | ||
| assignee: ID |
There was a problem hiding this comment.
EventsFiltersInput now exposes assignee, but the implementation does not consume filters.assignee (the resolver forwards assignee as a separate argument, and findDailyEventsPortion filters filters down to mark keys only). This makes the schema misleading for clients. Either remove assignee from EventsFiltersInput, or change the resolver/factory to read assignee from filters (and avoid having two different ways to pass the same filter).
| """ | |
| Includes only events assigned to passed user id | |
| """ | |
| assignee: ID |
| * @return {Promise<RecentEventSchema[]>} | ||
| */ | ||
| async dailyEventsPortion(project, { limit, nextCursor, sort, filters, search, release }, context) { | ||
| async dailyEventsPortion(project, { limit, nextCursor, sort, filters, search, release, assignee }, context) { |
There was a problem hiding this comment.
The JSDoc for dailyEventsPortion wasn’t updated for the new assignee argument. Please add @param {String} assignee (and adjust the param list order if needed) so the docs match the function signature.
| async findDailyEventsPortion( | ||
| limit = 10, | ||
| paginationCursor = null, | ||
| sort = 'BY_DATE', | ||
| filters = {}, |
There was a problem hiding this comment.
The JSDoc for findDailyEventsPortion doesn’t document the newly added assignee parameter. Please update the comment block to include it so the signature and docs stay in sync.
| const markFilters = ['resolved', 'starred', 'ignored']; | ||
| const matchFilter = filters | ||
| ? Object.fromEntries( | ||
| Object | ||
| .entries(filters) |
There was a problem hiding this comment.
EventsFiltersInput now includes assignee, but this code explicitly keeps only mark keys from filters. As a result, filters: { assignee: ... } will be silently ignored. Consider either plumbing assignee through via filters.assignee (and dropping the separate assignee argument), or removing assignee from EventsFiltersInput to avoid a misleading API.
| it('should keep old call shape when assignee is not provided', async () => { | ||
| const findDailyEventsPortion = jest.fn().mockResolvedValue({ | ||
| nextCursor: null, | ||
| dailyEvents: [], | ||
| }); |
There was a problem hiding this comment.
The test name says it "keeps old call shape" when assignee is not provided, but it still asserts a 7th argument (undefined). Consider renaming the test to reflect the new signature, or asserting the previous 6-argument shape if that’s the intended compatibility guarantee.
Problem
Event search/filter in project overview did not support filtering by assignee.
Users could filter by marks (resolved/starred/ignored), but not by assigned user.
What was changed
EventsFiltersInputnow supportsassignee: IDproject.dailyEventsPortionnow acceptsassignee: IDProject.dailyEventsPortionforwardsassigneetoEventsFactory.findDailyEventsPortion(...)EventsFactory.findDailyEventsPortion(...):event.assignee === <selectedUserId>resolved,starred,ignored) isolated from non-mark fieldsassigneeis passed through to the factoryassigneeis not providedWhy
This enables server-side filtering by assigned user without loading all events client-side, preserving pagination and query performance.