mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-16 21:08:00 +00:00
8bfa1a083c
* feat: get views and failed events * feat: get views and failed events * feat: get views and failed events * Update internal/view/repository/sequence.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * Update internal/view/repository/general_query.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com>
61 lines
2.0 KiB
Go
61 lines
2.0 KiB
Go
package view
|
|
|
|
import (
|
|
proj_model "github.com/caos/zitadel/internal/project/model"
|
|
"github.com/caos/zitadel/internal/project/repository/view"
|
|
"github.com/caos/zitadel/internal/project/repository/view/model"
|
|
"github.com/caos/zitadel/internal/view/repository"
|
|
)
|
|
|
|
const (
|
|
applicationTable = "authz.applications"
|
|
)
|
|
|
|
func (v *View) ApplicationByID(appID string) (*model.ApplicationView, error) {
|
|
return view.ApplicationByID(v.Db, applicationTable, appID)
|
|
}
|
|
|
|
func (v *View) ApplicationByOIDCClientID(clientID string) (*model.ApplicationView, error) {
|
|
return view.ApplicationByOIDCClientID(v.Db, applicationTable, clientID)
|
|
}
|
|
|
|
func (v *View) ApplicationByProjecIDAndAppName(projectID, appName string) (*model.ApplicationView, error) {
|
|
return view.ApplicationByProjectIDAndAppName(v.Db, applicationTable, projectID, appName)
|
|
}
|
|
|
|
func (v *View) SearchApplications(request *proj_model.ApplicationSearchRequest) ([]*model.ApplicationView, int, error) {
|
|
return view.SearchApplications(v.Db, applicationTable, request)
|
|
}
|
|
|
|
func (v *View) PutApplication(project *model.ApplicationView) error {
|
|
err := view.PutApplication(v.Db, applicationTable, project)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return v.ProcessedApplicationSequence(project.Sequence)
|
|
}
|
|
|
|
func (v *View) DeleteApplication(appID string, eventSequence uint64) error {
|
|
err := view.DeleteApplication(v.Db, applicationTable, appID)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
return v.ProcessedApplicationSequence(eventSequence)
|
|
}
|
|
|
|
func (v *View) GetLatestApplicationSequence() (uint64, error) {
|
|
return v.latestSequence(applicationTable)
|
|
}
|
|
|
|
func (v *View) ProcessedApplicationSequence(eventSequence uint64) error {
|
|
return v.saveCurrentSequence(applicationTable, eventSequence)
|
|
}
|
|
|
|
func (v *View) GetLatestApplicationFailedEvent(sequence uint64) (*repository.FailedEvent, error) {
|
|
return v.latestFailedEvent(applicationTable, sequence)
|
|
}
|
|
|
|
func (v *View) ProcessedApplicationFailedEvent(failedEvent *repository.FailedEvent) error {
|
|
return v.saveFailedEvent(failedEvent)
|
|
}
|