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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user