mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
fix(iam_member): naming, error handling, column name (#355)
This commit is contained in:
parent
9c277e2efb
commit
18669b39c1
@ -1,6 +1,7 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
iam_model "github.com/caos/zitadel/internal/iam/model"
|
||||
"github.com/caos/zitadel/internal/iam/repository/view"
|
||||
"github.com/caos/zitadel/internal/iam/repository/view/model"
|
||||
@ -31,10 +32,10 @@ func (v *View) PutIamMember(org *model.IamMemberView, sequence uint64) error {
|
||||
return v.ProcessedIamMemberSequence(sequence)
|
||||
}
|
||||
|
||||
func (v *View) DeleteIamMember(orgID, userID string, eventSequence uint64) error {
|
||||
err := view.DeleteIamMember(v.Db, iamMemberTable, orgID, userID)
|
||||
if err != nil {
|
||||
return nil
|
||||
func (v *View) DeleteIamMember(iamID, userID string, eventSequence uint64) error {
|
||||
err := view.DeleteIamMember(v.Db, iamMemberTable, iamID, userID)
|
||||
if err != nil && !errors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
return v.ProcessedIamMemberSequence(eventSequence)
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ import (
|
||||
func IamMemberByIDs(db *gorm.DB, table, orgID, userID string) (*model.IamMemberView, error) {
|
||||
member := new(model.IamMemberView)
|
||||
|
||||
orgIDQuery := &model.IamMemberSearchQuery{Key: iam_model.IamMemberSearchKeyIamID, Value: orgID, Method: global_model.SearchMethodEquals}
|
||||
iamIDQuery := &model.IamMemberSearchQuery{Key: iam_model.IamMemberSearchKeyIamID, Value: orgID, Method: global_model.SearchMethodEquals}
|
||||
userIDQuery := &model.IamMemberSearchQuery{Key: iam_model.IamMemberSearchKeyUserID, Value: userID, Method: global_model.SearchMethodEquals}
|
||||
query := repository.PrepareGetByQuery(table, orgIDQuery, userIDQuery)
|
||||
query := repository.PrepareGetByQuery(table, iamIDQuery, userIDQuery)
|
||||
err := query(db, member)
|
||||
if caos_errs.IsNotFound(err) {
|
||||
return nil, caos_errs.ThrowNotFound(nil, "VIEW-Ahq2s", "Errors.Iam.MemberNotExisting")
|
||||
|
@ -2,9 +2,10 @@ package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model"
|
||||
"time"
|
||||
|
||||
es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model"
|
||||
|
||||
"github.com/caos/logging"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/models"
|
||||
@ -14,7 +15,7 @@ import (
|
||||
|
||||
const (
|
||||
IamMemberKeyUserID = "user_id"
|
||||
IamMemberKeyIamID = "org_id"
|
||||
IamMemberKeyIamID = "iam_id"
|
||||
IamMemberKeyUserName = "user_name"
|
||||
IamMemberKeyEmail = "email"
|
||||
IamMemberKeyFirstName = "first_name"
|
||||
|
Loading…
Reference in New Issue
Block a user