mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-21 22:21:47 +00:00
push 6 in 6 milestones
This commit is contained in:
parent
ad13a65d1d
commit
3a338cdb44
@ -290,7 +290,17 @@ func NewIsNullCond(column string) handler.Condition {
|
|||||||
return handler.Condition{
|
return handler.Condition{
|
||||||
Name: column,
|
Name: column,
|
||||||
ParameterOpt: func(string) string {
|
ParameterOpt: func(string) string {
|
||||||
return fmt.Sprintf("%s IS NULL", column)
|
return " IS NULL"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNotEqualCond(column, value string) handler.Condition {
|
||||||
|
return handler.Condition{
|
||||||
|
Name: column,
|
||||||
|
Value: value,
|
||||||
|
ParameterOpt: func(param string) string {
|
||||||
|
return fmt.Sprintf(" != %s", param)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,13 +100,13 @@ func NewProjectionHandler(
|
|||||||
reduceScheduledPseudoEvent: reduceScheduledPseudoEvent,
|
reduceScheduledPseudoEvent: reduceScheduledPseudoEvent,
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func(subscribe bool) {
|
||||||
<-initialized
|
<-initialized
|
||||||
if !h.reduceScheduledPseudoEvent {
|
if subscribe {
|
||||||
go h.subscribe(ctx)
|
go h.subscribe(ctx)
|
||||||
}
|
}
|
||||||
go h.schedule(ctx)
|
go h.schedule(ctx)
|
||||||
}()
|
}(!h.reduceScheduledPseudoEvent)
|
||||||
|
|
||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/repository/milestone"
|
"github.com/zitadel/zitadel/internal/repository/milestone"
|
||||||
|
|
||||||
@ -127,14 +128,22 @@ func (p *milestoneProjection) reducePushed(event eventstore.Event) (*handler.Sta
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.ThrowInvalidArgumentf(nil, "HANDL-XJGXK", "reduce.wrong.event.type %s", milestone.PushedEventType)
|
return nil, errors.ThrowInvalidArgumentf(nil, "HANDL-XJGXK", "reduce.wrong.event.type %s", milestone.PushedEventType)
|
||||||
}
|
}
|
||||||
return crdb.NewUpdateStatement(
|
if e.MilestoneType != milestone.InstanceDeleted {
|
||||||
|
return crdb.NewUpdateStatement(
|
||||||
|
event,
|
||||||
|
[]handler.Column{
|
||||||
|
handler.NewCol(MilestoneColumnPushedDate, event.CreationDate()),
|
||||||
|
},
|
||||||
|
[]handler.Condition{
|
||||||
|
handler.NewCond(MilestoneColumnInstanceID, event.Aggregate().InstanceID),
|
||||||
|
handler.NewCond(MilestoneColumnType, e.MilestoneType),
|
||||||
|
},
|
||||||
|
), nil
|
||||||
|
}
|
||||||
|
return crdb.NewDeleteStatement(
|
||||||
event,
|
event,
|
||||||
[]handler.Column{
|
|
||||||
handler.NewCol(MilestoneColumnPushedDate, event.CreationDate()),
|
|
||||||
},
|
|
||||||
[]handler.Condition{
|
[]handler.Condition{
|
||||||
handler.NewCond(MilestoneColumnInstanceID, event.Aggregate().InstanceID),
|
handler.NewCond(MilestoneColumnInstanceID, event.Aggregate().InstanceID),
|
||||||
handler.NewCond(MilestoneColumnType, e.MilestoneType),
|
|
||||||
},
|
},
|
||||||
), nil
|
), nil
|
||||||
}
|
}
|
||||||
@ -194,7 +203,6 @@ func (p *milestoneProjection) reduceProjectAdded(event eventstore.Event) (*handl
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *milestoneProjection) reduceUserTokenAdded(event eventstore.Event) (*handler.Statement, error) {
|
func (p *milestoneProjection) reduceUserTokenAdded(event eventstore.Event) (*handler.Statement, error) {
|
||||||
printEvent(event)
|
|
||||||
e, ok := event.(*user.UserTokenAddedEvent)
|
e, ok := event.(*user.UserTokenAddedEvent)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.ThrowInvalidArgumentf(nil, "HANDL-3xhJ7", "reduce.wrong.event.type %s", user.UserTokenAddedType)
|
return nil, errors.ThrowInvalidArgumentf(nil, "HANDL-3xhJ7", "reduce.wrong.event.type %s", user.UserTokenAddedType)
|
||||||
@ -211,19 +219,17 @@ func (p *milestoneProjection) reduceUserTokenAdded(event eventstore.Event) (*han
|
|||||||
crdb.NewIsNullCond(MilestoneColumnReachedDate),
|
crdb.NewIsNullCond(MilestoneColumnReachedDate),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
/* crdb.AddUpdateStatement(
|
crdb.AddUpdateStatement(
|
||||||
[]handler.Column{
|
[]handler.Column{
|
||||||
handler.NewCol(MilestoneColumnReachedDate, event.CreationDate()),
|
handler.NewCol(MilestoneColumnReachedDate, event.CreationDate()),
|
||||||
},
|
},
|
||||||
[]handler.Condition{
|
[]handler.Condition{
|
||||||
handler.NewCond(MilestoneColumnInstanceID, event.Aggregate().InstanceID),
|
handler.NewCond(MilestoneColumnInstanceID, event.Aggregate().InstanceID),
|
||||||
handler.NewCond(MilestoneColumnType, milestone.AuthenticationSucceededOnApplication),
|
handler.NewCond(MilestoneColumnType, milestone.AuthenticationSucceededOnApplication),
|
||||||
crdb.NewExpressionCond(func(param string) (clause string, needsParam bool) {
|
crdb.NewNotEqualCond(MilestoneColumnIgnoredProject, strings.Split(e.ApplicationID, "@")[0]),
|
||||||
return fmt.Sprintf("%s")
|
crdb.NewIsNullCond(MilestoneColumnReachedDate),
|
||||||
}),
|
},
|
||||||
crdb.NewIsNullCond(MilestoneColumnReachedDate),
|
),
|
||||||
},
|
|
||||||
),*/
|
|
||||||
), nil
|
), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user