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:
Fabi
2021-02-22 14:08:47 +01:00
committed by GitHub
parent 2ba56595b1
commit 428ef4acdb
106 changed files with 2301 additions and 2799 deletions

View File

@@ -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
}