test(09-05): add failing tests for scoped record lifecycle

- Record routes must enforce permission before ids or bodies and return D-10 envelopes
- Create, update, and delete run Before and After hooks once inside the transaction
- Out-of-scope and missing records are indistinguishable, and hook failure rolls back
This commit is contained in:
Jakub Zych
2026-09-24 19:38:23 +02:00
parent 578bdc8d5d
commit 94814d980b
5 changed files with 604 additions and 4 deletions

View File

@@ -126,6 +126,11 @@ func (s CRUDService) Update(ctx context.Context, cc *CompiledController, id any,
return s.save(ctx, cc, id, in, true)
}
// Delete removes one scoped record. The lifecycle is added with the record routes.
func (s CRUDService) Delete(ctx context.Context, cc *CompiledController, id any) (BulkResult, error) {
return BulkResult{}, errors.New("cabana: delete is not implemented")
}
func (s CRUDService) save(ctx context.Context, cc *CompiledController, id any, in RecordInput, update bool) (map[string]any, error) {
if s.DB == nil {
return nil, errors.New("cabana: database is not configured")