Skip to content

feat(api): add assignee filter to project daily events search#634

Open
Dobrunia wants to merge 2 commits intomasterfrom
feat/events-assignee-filter
Open

feat(api): add assignee filter to project daily events search#634
Dobrunia wants to merge 2 commits intomasterfrom
feat/events-assignee-filter

Conversation

@Dobrunia
Copy link
Member

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

  • Extended GraphQL schema:
    • EventsFiltersInput now supports assignee: ID
    • project.dailyEventsPortion now accepts assignee: ID
  • Updated resolver pipeline:
    • Project.dailyEventsPortion forwards assignee to EventsFactory.findDailyEventsPortion(...)
  • Updated Mongo aggregation in EventsFactory.findDailyEventsPortion(...):
    • Added assignee match: event.assignee === <selectedUserId>
    • Kept mark filters (resolved, starred, ignored) isolated from non-mark fields
  • Added resolver tests:
    • verifies assignee is passed through to the factory
    • verifies old call path still works when assignee is not provided

Why

This enables server-side filtering by assigned user without loading all events client-side, preserving pagination and query performance.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: ID filter for project daily events.
  • Updated Project.dailyEventsPortion resolver to forward assignee into EventsFactory.findDailyEventsPortion(...).
  • Updated the Mongo aggregation in findDailyEventsPortion to apply an event.assignee match, 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.

Comment on lines +126 to +129
"""
Includes only events assigned to passed user id
"""
assignee: ID
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
"""
Includes only events assigned to passed user id
"""
assignee: ID

Copilot uses AI. Check for mistakes.
* @return {Promise<RecentEventSchema[]>}
*/
async dailyEventsPortion(project, { limit, nextCursor, sort, filters, search, release }, context) {
async dailyEventsPortion(project, { limit, nextCursor, sort, filters, search, release, assignee }, context) {
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 213 to 217
async findDailyEventsPortion(
limit = 10,
paginationCursor = null,
sort = 'BY_DATE',
filters = {},
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +338 to 342
const markFilters = ['resolved', 'starred', 'ignored'];
const matchFilter = filters
? Object.fromEntries(
Object
.entries(filters)
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +58 to +62
it('should keep old call shape when assignee is not provided', async () => {
const findDailyEventsPortion = jest.fn().mockResolvedValue({
nextCursor: null,
dailyEvents: [],
});
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants