gdsc-kaist / board-of-audit-and-inspection-system

KAIST board of audit and inspection system backend
https://dev-bai.gdsckaist.com/api-docs
0 stars 2 forks source link

validateAuditPeriod should lookup proper AuditPeriod even if year and half are not given #34

Open Byunk opened 8 months ago

Byunk commented 8 months ago

Currently, validateAuditPeriod throws an error if request does not contain year and half values. The reason why those unnecessaries is needed is querying AuditPeriod is based on given year and half.

According to requirement, however, it is enough to figure out the latest AuditPeriod to validate whether the request is overdue or not.

// validateAuditPeriod
1. filter audit period if its `start` date is lower than timestamp
2. filter audit period if its `end` date is bigger than timestamp
3. return true if audit period exists, else throw an ValidationError