Refactor bracket validation logic to support draft state
This commit updates the bracket validation process by introducing a new `ValidateDraft` method, allowing for incomplete edits in the draft state. The existing `Validate` method has been modified to enforce complete validation only upon confirmation. Additionally, new tests have been added to ensure that incomplete drafts are accepted until confirmation, while still rejecting invalid references. Documentation has been updated to reflect these changes in the API and architecture.
This commit is contained in:
@@ -485,7 +485,7 @@ func (s *Service) UpdateBracket(ctx context.Context, actor domain.Account, event
|
||||
return draft, err
|
||||
}
|
||||
draft.Matches, draft.Confirmed, draft.Version = matches, false, draft.Version+1
|
||||
if err = draft.Validate(); err != nil {
|
||||
if err = draft.ValidateDraft(); err != nil {
|
||||
return draft, err
|
||||
}
|
||||
out, err := s.Store.SaveBracketDraft(ctx, draft, expectedVersion)
|
||||
|
||||
Reference in New Issue
Block a user