diff --git a/pkg/auth/flow.go b/pkg/auth/flow.go index e757a77..69e5abd 100644 --- a/pkg/auth/flow.go +++ b/pkg/auth/flow.go @@ -17,7 +17,7 @@ type AuthFlowManager struct { } type LoginFlow struct { - flow.FlowHandlerBase + flow.FlowHandler ClientID common.ClientID FlowContext @@ -52,9 +52,9 @@ func NewAuthFlowManager() *AuthFlowManager { func (afm *AuthFlowManager) NewLoginFlow(req *LoginFlowRequest, prov provider.AuthProvider) *LoginFlow { lf := &LoginFlow{ - FlowHandlerBase: flow.NewFlowHandlerBase(prov, prov.ProviderType()), - ClientID: req.ClientID, - FlowContext: req.FlowContext(), + FlowHandler: flow.NewFlowHandlerBase(prov, prov.ProviderType()), + ClientID: req.ClientID, + FlowContext: req.FlowContext(), } afm.Register(lf) diff --git a/pkg/flow/flow.go b/pkg/flow/flow.go index a65a920..dd45b98 100644 --- a/pkg/flow/flow.go +++ b/pkg/flow/flow.go @@ -60,7 +60,7 @@ type ( } Handler interface { - Base() FlowHandlerBase + Base() FlowHandler FlowID() FlowID flowCtime() time.Time @@ -91,7 +91,7 @@ func NewFlowManager() *FlowManager { func stepPtr(s Step) *Step { return &s } -type FlowHandlerBase struct { +type FlowHandler struct { ID FlowID // ID is the FlowID Handler HandlerKey // Handler key Context Context // flow Context @@ -103,18 +103,18 @@ type FlowHandlerBase struct { ctime time.Time } -func (f *FlowHandlerBase) Step() Step { return f.curStep } +func (f *FlowHandler) Step() Step { return f.curStep } -func (f *FlowHandlerBase) Base() FlowHandlerBase { return *f } +func (f *FlowHandler) Base() FlowHandler { return *f } -func (f *FlowHandlerBase) FlowID() FlowID { +func (f *FlowHandler) FlowID() FlowID { return f.ID } -func (f *FlowHandlerBase) flowCtime() time.Time { return f.ctime } +func (f *FlowHandler) flowCtime() time.Time { return f.ctime } -func NewFlowHandlerBase(sch Schemer, hand string) FlowHandlerBase { - return FlowHandlerBase{ +func NewFlowHandlerBase(sch Schemer, hand string) FlowHandler { + return FlowHandler{ ID: FlowID(generate.UUID()), Handler: HandlerKey(hand), Schema: sch.FlowSchema(), @@ -128,7 +128,7 @@ func (hk *HandlerKey) String() string { return string(*hk) } -func (fm *FlowHandlerBase) Handlers() []*HandlerKey { +func (fm *FlowHandler) Handlers() []*HandlerKey { return []*HandlerKey{&fm.Handler, nil} } @@ -140,7 +140,7 @@ func resultErrs(e Errors) Errors { return e } -func (fm *FlowHandlerBase) ShowForm(errs Errors) *Result { +func (fm *FlowHandler) ShowForm(errs Errors) *Result { res := &Result{ Type: TypeForm, ID: fm.ID, @@ -168,7 +168,7 @@ const ( TypeMenu ResultType = "menu" ) -func (f *FlowHandlerBase) touch() { +func (f *FlowHandler) touch() { f.ctime = time.Now() }