feat(domain): define user repositories (#11059)

This pull request introduces a new set of domain models and repositories
for managing users within the new v3 structure. The goal is to establish
a clean, robust, and extensible foundation for user management.

### Summary

This PR accomplishes the following:

- **Polymorphic User Model**: Introduces a `User` model in user.go that
can represent either a `Human` or a `Machine` user. This provides a
unified way to handle different user types while allowing for specific
attributes and logic for each.
- **Repository Pattern**: Implements the repository pattern for
accessing and manipulating user data. This decouples the business logic
from the data storage implementation. The main repository interfaces
(`UserRepository`, `HumanUserRepository`, `MachineUserRepository`) are
now defined in `backend/v3/domain/user_repository.go`.
- **Comprehensive User Models**: The user.go file now also defines the
domain models for associated user data, including `UserMetadata`,
`IdentityProviderLink`, `Passkey`, `PersonalAccessToken`, and
`MachineKey`.
- **Generic Verification and Check System**: Introduces verification.go
and check.go to provide a standardized way of handling various
verification flows (e.g., email verification, OTP checks).
- **Generated Code**: Adds new generated files for enums
(`humangender_enumer.go`, `machinekeytype_enumer.go`,
`passkeytype_enumer.go`, `personalaccesstokentype_enumer.go`,
`userstate_enumer.go`, `usertype_enumer.go`) and mocks for the new
repositories.
- **Session Domain Refactoring**: Updates the session domain
(`backend/v3/domain/session*.go`) to align with the new user model
structure.

This foundational work paves the way for migrating user management logic
to the new `v3` backend, with a more maintainable and testable
architecture.

part of #10224

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Marco A. <[email protected]>
This commit is contained in:
Silvan
2025-11-25 11:54:32 +01:00
committed by GitHub
co-authored by Copilot Marco A.
parent 5beeb5738a
commit f5ce288ea5
25 changed files with 8317 additions and 926 deletions
@@ -94,11 +94,11 @@ func (i NumberOperation) IsANumberOperation() bool {
return false
}
const _TextOperationName = "=<>LIKELIKELIKELIKELIKELIKE"
const _TextOperationName = "=<>LIKELIKELIKELIKELIKELIKE=<>"
var _TextOperationIndex = [...]uint8{0, 1, 3, 7, 11, 15, 19, 23, 27}
var _TextOperationIndex = [...]uint8{0, 1, 3, 7, 11, 15, 19, 23, 27, 28, 30}
const _TextOperationLowerName = "=<>likelikelikelikelikelike"
const _TextOperationLowerName = "=<>likelikelikelikelikelike=<>"
func (i TextOperation) String() string {
i -= 1
@@ -120,9 +120,11 @@ func _TextOperationNoOp() {
_ = x[TextOperationContainsIgnoreCase-(6)]
_ = x[TextOperationEndsWithIgnoreCase-(7)]
_ = x[TextOperationStartsWithIgnoreCase-(8)]
_ = x[TextOperationEqualIgnoreCase-(9)]
_ = x[TextOperationNotEqualIgnoreCase-(10)]
}
var _TextOperationValues = []TextOperation{TextOperationEqual, TextOperationNotEqual, TextOperationStartsWith, TextOperationContains, TextOperationEndsWith, TextOperationContainsIgnoreCase, TextOperationEndsWithIgnoreCase, TextOperationStartsWithIgnoreCase}
var _TextOperationValues = []TextOperation{TextOperationEqual, TextOperationNotEqual, TextOperationStartsWith, TextOperationContains, TextOperationEndsWith, TextOperationContainsIgnoreCase, TextOperationEndsWithIgnoreCase, TextOperationStartsWithIgnoreCase, TextOperationEqualIgnoreCase, TextOperationNotEqualIgnoreCase}
var _TextOperationNameToValueMap = map[string]TextOperation{
_TextOperationName[0:1]: TextOperationEqual,
@@ -141,6 +143,10 @@ var _TextOperationNameToValueMap = map[string]TextOperation{
_TextOperationLowerName[19:23]: TextOperationEndsWithIgnoreCase,
_TextOperationName[23:27]: TextOperationStartsWithIgnoreCase,
_TextOperationLowerName[23:27]: TextOperationStartsWithIgnoreCase,
_TextOperationName[27:28]: TextOperationEqualIgnoreCase,
_TextOperationLowerName[27:28]: TextOperationEqualIgnoreCase,
_TextOperationName[28:30]: TextOperationNotEqualIgnoreCase,
_TextOperationLowerName[28:30]: TextOperationNotEqualIgnoreCase,
}
var _TextOperationNames = []string{
@@ -152,6 +158,8 @@ var _TextOperationNames = []string{
_TextOperationName[15:19],
_TextOperationName[19:23],
_TextOperationName[23:27],
_TextOperationName[27:28],
_TextOperationName[28:30],
}
// TextOperationString retrieves an enum value from the enum constants string name.