mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 20:47:32 +00:00
fix(actions): default sorting column to creation date (#9795)
# Which Problems Are Solved
The sorting column of action targets and executions defaults to the ID
column instead of the creation date column.
This is only relevant, if the sorting column is explicitly passed as
unspecified.
If the sorting column is not passed, it correctly defaults to the
creation date.
```bash
# ❌ Sorts by ID
grpcurl -plaintext -H "Authorization: Bearer ${ZITADEL_ACCESS_TOKEN}" -d '{"sortingColumn": "TARGET_FIELD_NAME_UNSPECIFIED"}' localhost:8080 zitadel.action.v2beta.ActionService.ListTargets
# ❌ Sorts by ID
grpcurl -plaintext -H "Authorization: Bearer ${ZITADEL_ACCESS_TOKEN}" -d '{"sortingColumn": 0}' localhost:8080 zitadel.action.v2beta.ActionService.ListTargets
# ✅ Sorts by creation date
grpcurl -plaintext -H "Authorization: Bearer ${ZITADEL_ACCESS_TOKEN}" localhost:8080 zitadel.action.v2beta.ActionService.ListTargets
```
# How the Problems Are Solved
`action.TargetFieldName_TARGET_FIELD_NAME_UNSPECIFIED` maps to the
sorting column `query.TargetColumnCreationDate`.
# Additional Context
As IDs are also generated in ascending, like creation dates, the the bug
probably only causes unexpected behavior for cases, where the ID is
specified during target or execution creation. This is currently not
supported, so this bug probably has no impact at all. It doesn't need to
be backported.
Found during implementation of #9763
Co-authored-by: Livio Spring <livio.a@gmail.com>
(cherry picked from commit 74ace1aec3
)
This commit is contained in:

committed by
Livio Spring

parent
483a2c1122
commit
24cbeb64c8
@@ -164,7 +164,7 @@ func targetFieldNameToSortingColumn(field *action.TargetFieldName) query.Column
|
||||
}
|
||||
switch *field {
|
||||
case action.TargetFieldName_TARGET_FIELD_NAME_UNSPECIFIED:
|
||||
return query.TargetColumnID
|
||||
return query.TargetColumnCreationDate
|
||||
case action.TargetFieldName_TARGET_FIELD_NAME_ID:
|
||||
return query.TargetColumnID
|
||||
case action.TargetFieldName_TARGET_FIELD_NAME_CREATED_DATE:
|
||||
@@ -193,7 +193,7 @@ func executionFieldNameToSortingColumn(field *action.ExecutionFieldName) query.C
|
||||
}
|
||||
switch *field {
|
||||
case action.ExecutionFieldName_EXECUTION_FIELD_NAME_UNSPECIFIED:
|
||||
return query.ExecutionColumnID
|
||||
return query.ExecutionColumnCreationDate
|
||||
case action.ExecutionFieldName_EXECUTION_FIELD_NAME_ID:
|
||||
return query.ExecutionColumnID
|
||||
case action.ExecutionFieldName_EXECUTION_FIELD_NAME_CREATED_DATE:
|
||||
|
Reference in New Issue
Block a user