More fixes for _request

This commit is contained in:
Hein
2025-11-11 11:16:07 +02:00
parent 682716dd31
commit 7b8216b71c
7 changed files with 63 additions and 40 deletions

View File

@@ -294,7 +294,7 @@ func (h *Handler) handleCreate(ctx context.Context, w common.ResponseWriter, dat
logger.Info("Creating records for %s.%s", schema, entity)
// Check if data contains nested relations or crud_request field
// Check if data contains nested relations or _request field
switch v := data.(type) {
case map[string]interface{}:
// Check if we should use nested processing
@@ -1003,7 +1003,7 @@ func (h *Handler) RegisterModel(schema, name string, model interface{}) error {
}
// shouldUseNestedProcessor determines if we should use nested CUD processing
// It checks if the data contains nested relations or a crud_request field
// It checks if the data contains nested relations or a _request field
func (h *Handler) shouldUseNestedProcessor(data map[string]interface{}, model interface{}) bool {
return common.ShouldUseNestedProcessor(data, model, h)
}

View File

@@ -10,15 +10,15 @@ type GormTableSchemaInterface interface {
}
type GormTableCRUDRequest struct {
CRUDRequest *string `json:"crud_request"`
Request *string `json:"_request"`
}
func (r *GormTableCRUDRequest) SetRequest(request string) {
r.CRUDRequest = &request
r.Request = &request
}
func (r GormTableCRUDRequest) GetRequest() string {
return *r.CRUDRequest
return *r.Request
}
// New interfaces that replace the legacy ones above