-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Labels
enhancementNew feature or requestNew feature or requestgoPull requests that update go codePull requests that update go codegood first issueGood for newcomersGood for newcomers
Description
A program has a StartDate and EndDate however, there is no validation to ensure the EndDate is after the StartDate.
Add Hook
- add hook to program hooks called
HookProgramValidation - hook should run on the follow Op.Type:
OpCreate,OpUpdateorOpUpdateOne` - if m.EndDate() is set, then check the following in this order:
m.StartDate() // see if date is being set
m.StartDateCleared() // if not set, see if its being cleared
m.OldStartDate(ctx) // if not cleared, get the old start date
- If start date is also being set, ensure end date is after
- if start date is cleared but not set, skip check
- if neither are on the mutation, get the old start date - if that is not empty, ensure the end date is after
Add hook to schema
Once the hook is written, add the hook to the programs schema and run
task generate
Add Tests:
Either:
- write hook tests
and/or: - update and/or add tests to the
internal/graphapi/programs_test.goto ensure the validation is correct
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgoPull requests that update go codePull requests that update go codegood first issueGood for newcomersGood for newcomers