3
0

Fix automation session search throwing pgql column type errors

This commit is contained in:
Tomaž Jerman 2024-03-18 09:56:50 +01:00
parent ae536800fe
commit 74031ca69e
2 changed files with 9 additions and 9 deletions

View File

@ -86,11 +86,11 @@ session: {
filter: {
struct: {
session_id: { goType: "[]uint64", storeIdent: "id", ident: "sessionID" }
session_id: { goType: "[]string", storeIdent: "id", ident: "sessionID" }
completed: { schema.SortableTimestampNilField, storeIdent: "completed_at" }
created_by: { goType: "[]uint64" }
created_by: { goType: "[]string" }
status: { goType: "[]uint" }
workflow_id: { goType: "[]uint64", storeIdent: "rel_workflow", ident: "workflowID" }
workflow_id: { goType: "[]string", storeIdent: "rel_workflow", ident: "workflowID" }
event_type: { goType: "string" }
resource_type: { goType: "string" }
}

View File

@ -390,12 +390,12 @@ func AutomationSessionFilter(d drivers.Dialect, f automationType.SessionFilter)
// @todo codegen warning: filtering by Status ([]uint) not supported,
// see rdbms.go.tpl and add an exception
if len(f.SessionID) > 0 {
ee = append(ee, goqu.C("id").In(f.SessionID))
if ss := trimStringSlice(f.SessionID); len(ss) > 0 {
ee = append(ee, goqu.C("id").In(ss))
}
if len(f.WorkflowID) > 0 {
ee = append(ee, goqu.C("rel_workflow").In(f.WorkflowID))
if ss := trimStringSlice(f.WorkflowID); len(ss) > 0 {
ee = append(ee, goqu.C("rel_workflow").In(ss))
}
if val := strings.TrimSpace(f.EventType); len(val) > 0 {
@ -406,8 +406,8 @@ func AutomationSessionFilter(d drivers.Dialect, f automationType.SessionFilter)
ee = append(ee, goqu.C("resource_type").Eq(f.ResourceType))
}
if len(f.CreatedBy) > 0 {
ee = append(ee, goqu.C("created_by").In(f.CreatedBy))
if ss := trimStringSlice(f.CreatedBy); len(ss) > 0 {
ee = append(ee, goqu.C("created_by").In(ss))
}
return ee, f, err