mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 03:57:32 +00:00
fix: commandside queries (#1313)
* fix: move user by id to query side * fix: move get passwordless to query side # Conflicts: # internal/user/repository/eventsourcing/eventstore.go * fix: move get passwordless to query side * remove user eventstore * remove unused models * org changes * org changes * fix: move org queries to query side * fix: remove org eventstore * fix: remove org eventstore * fix: remove org eventstore * remove project from es v1 * project cleanup * project cleanup * fix: remove org eventstore * fix: remove iam eventstore Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
@@ -5,12 +5,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/caos/logging"
|
||||
"github.com/caos/zitadel/internal/crypto"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/models"
|
||||
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||
key_model "github.com/caos/zitadel/internal/key/model"
|
||||
"github.com/caos/zitadel/internal/user/model"
|
||||
)
|
||||
|
||||
type Machine struct {
|
||||
@@ -46,28 +43,6 @@ func (sa *Machine) setData(event *models.Event) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sa *Machine) Changes(updatedAccount *Machine) map[string]interface{} {
|
||||
changes := make(map[string]interface{})
|
||||
if updatedAccount.Description != "" && updatedAccount.Description != sa.Description {
|
||||
changes["description"] = updatedAccount.Description
|
||||
}
|
||||
return changes
|
||||
}
|
||||
|
||||
func MachineFromModel(machine *model.Machine) *Machine {
|
||||
return &Machine{
|
||||
Description: machine.Description,
|
||||
Name: machine.Name,
|
||||
}
|
||||
}
|
||||
|
||||
func MachineToModel(machine *Machine) *model.Machine {
|
||||
return &model.Machine{
|
||||
Description: machine.Description,
|
||||
Name: machine.Name,
|
||||
}
|
||||
}
|
||||
|
||||
type MachineKey struct {
|
||||
es_models.ObjectRoot `json:"-"`
|
||||
KeyID string `json:"keyId,omitempty"`
|
||||
@@ -100,35 +75,3 @@ func (key *MachineKey) AppendEvent(event *es_models.Event) (err error) {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func MachineKeyFromModel(machine *model.MachineKey) *MachineKey {
|
||||
return &MachineKey{
|
||||
ObjectRoot: machine.ObjectRoot,
|
||||
ExpirationDate: machine.ExpirationDate,
|
||||
KeyID: machine.KeyID,
|
||||
Type: int32(machine.Type),
|
||||
}
|
||||
}
|
||||
|
||||
func MachineKeyToModel(machine *MachineKey) *model.MachineKey {
|
||||
return &model.MachineKey{
|
||||
ObjectRoot: machine.ObjectRoot,
|
||||
ExpirationDate: machine.ExpirationDate,
|
||||
KeyID: machine.KeyID,
|
||||
PrivateKey: machine.privateKey,
|
||||
Type: key_model.AuthNKeyType(machine.Type),
|
||||
}
|
||||
}
|
||||
|
||||
func (key *MachineKey) GenerateMachineKeyPair(keySize int, alg crypto.EncryptionAlgorithm) error {
|
||||
privateKey, publicKey, err := crypto.GenerateKeyPair(keySize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
key.PublicKey, err = crypto.PublicKeyToBytes(publicKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
key.privateKey = crypto.PrivateKeyToBytes(privateKey)
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user