Create a new endpoint that receives edit data and sends messages to a queue for background processing.
The API should:
- Accept PUT requests with revisionId, wikiId and eventId
- Validate that the user has the specified event as an ongoing event
- Process the association via the JobQueue and not synchronously
- Return success response indicating the request was queued for processing
- Handle validation errors and return appropriate error messages
- Be documented
BDD
Feature: Associate edit to event via queue processing
Scenario: Successfully queue edit association
Given a user has an ongoing event
And the user has made an edit
When the API is called with valid edit data
Then a message is sent to the queue
And a success response is returned
And the response indicates processing is queued
Scenario: User does not have ongoing event
Given a user does not have the specified event as ongoing
When the API is called with the event data
Then an error response is returned
And no message is sent to the queue
And the error indicates invalid event participation
Scenario: Event is no longer ongoing
Given an event has ended
And the user was a participant
When the API is called with the event data
Then an error response is returned
And no message is sent to the queue
And the error indicates event is not ongoing
Scenario: Invalid timestamp (too old)
Given the edit timestamp is outside the allowed time window
When the API is called with the edit data
Then an error response is returned
And no message is sent to the queue
And the error indicates timestamp is invalid
Scenario: API validates using cache -> TBD see https://phabricator.wikimedia.org/T401211 for more details
Given the cache contains user event data
When the API is called with event data
Then validation is performed using cache data
And no database queries are performed for validation