2020-05-26 14:46:16 +00:00
|
|
|
package view
|
|
|
|
|
|
|
|
import (
|
|
|
|
org_view "github.com/caos/zitadel/internal/org/repository/view"
|
2020-06-16 09:40:18 +00:00
|
|
|
"github.com/caos/zitadel/internal/org/repository/view/model"
|
2020-05-26 14:46:16 +00:00
|
|
|
"github.com/caos/zitadel/internal/view"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
orgTable = "management.orgs"
|
|
|
|
)
|
|
|
|
|
2020-06-16 09:40:18 +00:00
|
|
|
func (v *View) OrgByID(orgID string) (*model.OrgView, error) {
|
2020-05-26 14:46:16 +00:00
|
|
|
return org_view.OrgByID(v.Db, orgTable, orgID)
|
|
|
|
}
|
|
|
|
|
2020-06-16 09:40:18 +00:00
|
|
|
func (v *View) PutOrg(org *model.OrgView) error {
|
2020-05-26 14:46:16 +00:00
|
|
|
err := org_view.PutOrg(v.Db, orgTable, org)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return v.ProcessedOrgSequence(org.Sequence)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (v *View) GetLatestOrgFailedEvent(sequence uint64) (*view.FailedEvent, error) {
|
|
|
|
return v.latestFailedEvent(orgTable, sequence)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (v *View) ProcessedOrgFailedEvent(failedEvent *view.FailedEvent) error {
|
|
|
|
return v.saveFailedEvent(failedEvent)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (v *View) GetLatestOrgSequence() (uint64, error) {
|
|
|
|
return v.latestSequence(orgTable)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (v *View) ProcessedOrgSequence(eventSequence uint64) error {
|
|
|
|
return v.saveCurrentSequence(orgTable, eventSequence)
|
|
|
|
}
|