We're updating the issue view to help you get more done. 

Make periodsForInitiate endpoint self-sufficient to determine available actions

Description

Current situation/problem:
The /periodsForInitiate endpoint only returns info about the available periods. There's no way to figure out whether the periods returned by the endpoint already have assigned requisition or not. Because of that UI has to hit another enpoint - requisitions/search to retrieve ALL the requisition for the chosen facility and program just to determine whether for the chosen period an "initiate" or "view requisition" link should be generated.*

Proposed solution:
"/periodsForInitiate" would additionaly include "requsitionId" and "requisitionStatus" which would indicate whether the requisition exists (and in which state). It would also make this endpoint self-sufficient to determine what is the next correct action for each of those periods (initiate if no requisition, view/submit if initiated requisition etc.)

Since this is an endpoint that lives in the requisition service it doesn't seem like much harm putting requisition-specific info there. The performance of the endpoint also wouldn't be affected much as this endpoint already uses requisition repository to retrieve requisitions for each found period (to determine whether it exists and its status).

Finally, the endpoint could also use a rename, since it doesn't really return periods for initiate only. It also contains periods for requisitions that already are initiated and submitted.

Status

Assignee

Jakub Kondrat

Reporter

Sebastian Brudziński

Story Points

5

Time tracking

24h

Components

Sprint

None

Fix versions

Priority

Major