API: Retrieve label events by project
At the moment, our REST API retrieves label events by issue
Issue for the GraphQL API
Implementation Guide
- We have a module
LabelEventablewhich only applies to Noteables (issues, merge requests, epics). Since this will be an aggregate of things that are eventable - a project isn't an eventable thing as we've defined it, we'll need to define an endpoint for it. - If we built an endpoint
resource_label_eventsin a project, I could imagine they'd want to filter out merge request events. So we'd need to add the ability to filter by type -
resource_label_eventstable might be one of our biggest tables (not sure) so there may be some possibly tricky SQL to make sure it's performant. -
lib/api/resource_label_events.rbwould be a decent place to start
An example of how to get started (including diff) is in #357773 (comment 900388558)
We also probably want a finder of some sort rather than the direct ResourceLabelEvent.joins(eventable).where.not("#{eventable}_id" => nil).where("#{eventable}.project_id = ?", id) line demonstrated in the diff. But that would be added once it is working in this form
We'd also have to be wary of N+1s
Edited by 🤖 GitLab Bot 🤖