mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-14 01:27:34 +00:00
fixup! feat(db): adding org table to relational model
This commit is contained in:
@@ -277,6 +277,24 @@ func (i *Instance) DeactivateOrganization(ctx context.Context, orgID string) *mg
|
||||
return resp
|
||||
}
|
||||
|
||||
func (i *Instance) ReactivateOrganization(ctx context.Context, orgID string) *mgmt.ReactivateOrgResponse {
|
||||
resp, err := i.Client.Mgmt.ReactivateOrg(
|
||||
SetOrgID(ctx, orgID),
|
||||
&mgmt.ReactivateOrgRequest{},
|
||||
)
|
||||
logging.OnError(err).Fatal("reactivate org")
|
||||
return resp
|
||||
}
|
||||
|
||||
func (i *Instance) RemoveOrganization(ctx context.Context, orgID string) *mgmt.RemoveOrgResponse {
|
||||
resp, err := i.Client.Mgmt.RemoveOrg(
|
||||
SetOrgID(ctx, orgID),
|
||||
&mgmt.RemoveOrgRequest{},
|
||||
)
|
||||
logging.OnError(err).Fatal("reactivate org")
|
||||
return resp
|
||||
}
|
||||
|
||||
func SetOrgID(ctx context.Context, orgID string) context.Context {
|
||||
md, ok := metadata.FromOutgoingContext(ctx)
|
||||
if !ok {
|
||||
|
@@ -138,10 +138,13 @@ func (p *orgRelationalProjection) reduceOrgRelationalDeactivated(event eventstor
|
||||
if !ok {
|
||||
return nil, zerrors.ThrowInvalidArgumentf(nil, "HANDL-BApK5", "reduce.wrong.event.type %s", org.OrgDeactivatedEventType)
|
||||
}
|
||||
|
||||
// need to convert old state (int) to new state (enum)
|
||||
state := repoDomain.State[domain.OrgStateInactive-1]
|
||||
return handler.NewUpdateStatement(
|
||||
e,
|
||||
[]handler.Column{
|
||||
handler.NewCol(State, domain.OrgStateInactive),
|
||||
handler.NewCol(State, state),
|
||||
handler.NewCol(UpdatedAt, e.CreationDate()),
|
||||
},
|
||||
[]handler.Condition{
|
||||
@@ -197,6 +200,7 @@ func (p *orgRelationalProjection) reduceOrgRelationalRemoved(event eventstore.Ev
|
||||
return handler.NewUpdateStatement(
|
||||
e,
|
||||
[]handler.Column{
|
||||
handler.NewCol(UpdatedAt, e.CreationDate()),
|
||||
handler.NewCol(DeletedAt, e.CreationDate()),
|
||||
},
|
||||
[]handler.Condition{
|
||||
|
Reference in New Issue
Block a user