Files
zitadel/backend/v3/api/session/v2/convert/object.go
T
Marco A.andGitHub 14acc60edd feat: ListSessions to relational (#11987)
# Which Problems Are Solved

This PR introduces the possibility of using the relational DB when
calling the ListSession gRPC endpoint.

# How the Problems Are Solved

  - Implement the Querier interface for ListSession:
- Create a `domain` model for the Session object to be able to map the
gRPC session into it.
- Match the permission filters on ES side to be sure the same sessions
are returned
- Implement converter methods to go from `gRPC` to `domain` models (both
ways)
- Fix the session sql relational migration: rework the trigger to update
the `expiration` field to perform the update only when the input
`lifetime` has a non-zero value.
  - Link the Querier implementation with the gRPC endpoint
- Run the same integration tests against the relational DB, making sure
the outcome is the same. ⚠️ Due to missing permission checks, some
divergence is expected. Hence, specific code to circumvent the
differences has been put in place

# Additional Context

- Closes #11039
2026-04-16 10:58:17 +02:00

15 lines
765 B
Go

package convert
import (
"github.com/zitadel/zitadel/backend/v3/storage/database"
objpb "github.com/zitadel/zitadel/pkg/grpc/object"
)
var grpcTimestampOpToDomain = map[objpb.TimestampQueryMethod]database.NumberOperation{
objpb.TimestampQueryMethod_TIMESTAMP_QUERY_METHOD_EQUALS: database.NumberOperationEqual,
objpb.TimestampQueryMethod_TIMESTAMP_QUERY_METHOD_GREATER: database.NumberOperationGreaterThan,
objpb.TimestampQueryMethod_TIMESTAMP_QUERY_METHOD_GREATER_OR_EQUALS: database.NumberOperationGreaterThanOrEqual,
objpb.TimestampQueryMethod_TIMESTAMP_QUERY_METHOD_LESS: database.NumberOperationLessThan,
objpb.TimestampQueryMethod_TIMESTAMP_QUERY_METHOD_LESS_OR_EQUALS: database.NumberOperationLessThanOrEqual,
}