...
Invoke Media Content Storage to check documents exist
Check doctor's limit
Get employee.id from declaration request
get party for employee_id
Find all employees in status= 'APPROVED' for the party. Count all declarations in status='active' & declaration_requests in status='
...
NEW' for these employees.
- If amount of declarations+declaration_requests for party >= parties.declaration_limit and declaration.overlimit is not true
- return error 422 - This doctor reaches his limit and could not sign more declarations
Change declaration request status
...