mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-15 00:57:36 +00:00
fix: todos (#1346)
* fix: pub sub in new eventstore * fix: todos * fix: todos * fix: todos * fix: todos * fix: todos
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"time"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
"github.com/caos/zitadel/internal/model"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -77,7 +77,7 @@ const (
|
||||
|
||||
type AuthNKeySearchQuery struct {
|
||||
Key AuthNKeySearchKey
|
||||
Method model.SearchMethod
|
||||
Method domain.SearchMethod
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"time"
|
||||
|
||||
"github.com/caos/zitadel/internal/crypto"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/model"
|
||||
)
|
||||
|
||||
type KeyView struct {
|
||||
@@ -52,7 +52,7 @@ const (
|
||||
|
||||
type KeySearchQuery struct {
|
||||
Key KeySearchKey
|
||||
Method model.SearchMethod
|
||||
Method domain.SearchMethod
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
key_model "github.com/caos/zitadel/internal/key/model"
|
||||
"github.com/caos/zitadel/internal/key/repository/view/model"
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
func AuthNKeyByIDs(db *gorm.DB, table, objectID, keyID string) (*model.AuthNKeyView, error) {
|
||||
key := new(model.AuthNKeyView)
|
||||
query := repository.PrepareGetByQuery(table,
|
||||
model.AuthNKeySearchQuery{Key: key_model.AuthNKeyObjectID, Method: global_model.SearchMethodEquals, Value: objectID},
|
||||
model.AuthNKeySearchQuery{Key: key_model.AuthNKeyKeyID, Method: global_model.SearchMethodEquals, Value: keyID},
|
||||
model.AuthNKeySearchQuery{Key: key_model.AuthNKeyObjectID, Method: domain.SearchMethodEquals, Value: objectID},
|
||||
model.AuthNKeySearchQuery{Key: key_model.AuthNKeyKeyID, Method: domain.SearchMethodEquals, Value: keyID},
|
||||
)
|
||||
err := query(db, key)
|
||||
if caos_errs.IsNotFound(err) {
|
||||
@@ -38,7 +38,7 @@ func AuthNKeysByObjectID(db *gorm.DB, table string, objectID string) ([]*model.A
|
||||
{
|
||||
Key: key_model.AuthNKeyObjectID,
|
||||
Value: objectID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
},
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, model.AuthNKeySearchRequest{Queries: queries})
|
||||
@@ -52,7 +52,7 @@ func AuthNKeysByObjectID(db *gorm.DB, table string, objectID string) ([]*model.A
|
||||
func AuthNKeyByID(db *gorm.DB, table string, keyID string) (*model.AuthNKeyView, error) {
|
||||
key := new(model.AuthNKeyView)
|
||||
query := repository.PrepareGetByQuery(table,
|
||||
model.AuthNKeySearchQuery{Key: key_model.AuthNKeyKeyID, Method: global_model.SearchMethodEquals, Value: keyID},
|
||||
model.AuthNKeySearchQuery{Key: key_model.AuthNKeyKeyID, Method: domain.SearchMethodEquals, Value: keyID},
|
||||
)
|
||||
err := query(db, key)
|
||||
if caos_errs.IsNotFound(err) {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"time"
|
||||
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
@@ -10,14 +11,13 @@ import (
|
||||
|
||||
key_model "github.com/caos/zitadel/internal/key/model"
|
||||
"github.com/caos/zitadel/internal/key/repository/view/model"
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
)
|
||||
|
||||
func KeyByIDAndType(db *gorm.DB, table, keyID string, private bool) (*model.KeyView, error) {
|
||||
key := new(model.KeyView)
|
||||
query := repository.PrepareGetByQuery(table,
|
||||
model.KeySearchQuery{Key: key_model.KeySearchKeyID, Method: global_model.SearchMethodEquals, Value: keyID},
|
||||
model.KeySearchQuery{Key: key_model.KeySearchKeyPrivate, Method: global_model.SearchMethodEquals, Value: private},
|
||||
model.KeySearchQuery{Key: key_model.KeySearchKeyID, Method: domain.SearchMethodEquals, Value: keyID},
|
||||
model.KeySearchQuery{Key: key_model.KeySearchKeyPrivate, Method: domain.SearchMethodEquals, Value: private},
|
||||
)
|
||||
err := query(db, key)
|
||||
return key, err
|
||||
@@ -31,9 +31,9 @@ func GetSigningKey(db *gorm.DB, table string, expiry time.Time) (*model.KeyView,
|
||||
query := repository.PrepareSearchQuery(table,
|
||||
model.KeySearchRequest{
|
||||
Queries: []*key_model.KeySearchQuery{
|
||||
{Key: key_model.KeySearchKeyPrivate, Method: global_model.SearchMethodEquals, Value: true},
|
||||
{Key: key_model.KeySearchKeyUsage, Method: global_model.SearchMethodEquals, Value: key_model.KeyUsageSigning},
|
||||
{Key: key_model.KeySearchKeyExpiry, Method: global_model.SearchMethodGreaterThan, Value: time.Now().UTC()},
|
||||
{Key: key_model.KeySearchKeyPrivate, Method: domain.SearchMethodEquals, Value: true},
|
||||
{Key: key_model.KeySearchKeyUsage, Method: domain.SearchMethodEquals, Value: key_model.KeyUsageSigning},
|
||||
{Key: key_model.KeySearchKeyExpiry, Method: domain.SearchMethodGreaterThan, Value: time.Now().UTC()},
|
||||
},
|
||||
SortingColumn: key_model.KeySearchKeyExpiry,
|
||||
Limit: 1,
|
||||
@@ -54,9 +54,9 @@ func GetActivePublicKeys(db *gorm.DB, table string) ([]*model.KeyView, error) {
|
||||
query := repository.PrepareSearchQuery(table,
|
||||
model.KeySearchRequest{
|
||||
Queries: []*key_model.KeySearchQuery{
|
||||
{Key: key_model.KeySearchKeyPrivate, Method: global_model.SearchMethodEquals, Value: false},
|
||||
{Key: key_model.KeySearchKeyUsage, Method: global_model.SearchMethodEquals, Value: key_model.KeyUsageSigning},
|
||||
{Key: key_model.KeySearchKeyExpiry, Method: global_model.SearchMethodGreaterThan, Value: time.Now().UTC()},
|
||||
{Key: key_model.KeySearchKeyPrivate, Method: domain.SearchMethodEquals, Value: false},
|
||||
{Key: key_model.KeySearchKeyUsage, Method: domain.SearchMethodEquals, Value: key_model.KeyUsageSigning},
|
||||
{Key: key_model.KeySearchKeyExpiry, Method: domain.SearchMethodGreaterThan, Value: time.Now().UTC()},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
key_model "github.com/caos/zitadel/internal/key/model"
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
)
|
||||
|
||||
@@ -41,7 +41,7 @@ func (req AuthNKeySearchQuery) GetKey() repository.ColumnKey {
|
||||
return AuthNKeySearchKey(req.Key)
|
||||
}
|
||||
|
||||
func (req AuthNKeySearchQuery) GetMethod() global_model.SearchMethod {
|
||||
func (req AuthNKeySearchQuery) GetMethod() domain.SearchMethod {
|
||||
return req.Method
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
key_model "github.com/caos/zitadel/internal/key/model"
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
)
|
||||
|
||||
@@ -41,7 +41,7 @@ func (req KeySearchQuery) GetKey() repository.ColumnKey {
|
||||
return KeySearchKey(req.Key)
|
||||
}
|
||||
|
||||
func (req KeySearchQuery) GetMethod() global_model.SearchMethod {
|
||||
func (req KeySearchQuery) GetMethod() domain.SearchMethod {
|
||||
return req.Method
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user