feat(relational): define session repository (#11054)

# Which Problems Are Solved

As part moving sessions to the relational table, the repository to be
able to manage session needs to be defined. This allows the business
logic / service-layer to implement the necessary commands and the
storage-layer to implement the underlying repository.

# How the Problems Are Solved

This PR defines the `SessionRepository` with all underlying object like
the user agent, metadata, factors (including. challenges).

# Additional Changes

None

# Additional Context

- relates to #10212

---------

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Livio Spring
2025-11-11 10:57:33 +00:00
committed by GitHub
co-authored by Copilot
parent e074668c6b
commit 2953366b4c
4 changed files with 433 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package domain
import "github.com/zitadel/zitadel/backend/v3/storage/database"
type SessionMetadata struct {
Metadata
SessionID string `json:"sessionId,omitempty" db:"session_id"`
}
type sessionMetadataColumns interface {
MetadataColumns
// SessionIDColumn returns the column for the session id field.
SessionIDColumn() database.Column
}
type sessionMetadataConditions interface {
MetadataConditions
// PrimaryKeyCondition returns a filter on the primary key fields.
PrimaryKeyCondition(instanceID, sessionID, key string) database.Condition
// SessionIDCondition returns an equal filter on the session id field.
SessionIDCondition(sessionID string) database.Condition
}