zitadel/internal/management/repository/eventsourcing/view/granted_project.go
Fabi 9965beee9c
fix: add project id on project grant (#202)
* fix: add project id on project grant

* fix: get granted project grant member
2020-06-10 14:28:15 +02:00

61 lines
2.1 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"
global_view "github.com/caos/zitadel/internal/view"
)
const (
grantedProjectTable = "management.granted_projects"
)
func (v *View) GrantedProjectByIDs(projectID, orgID string) (*model.GrantedProjectView, error) {
return view.GrantedProjectByIDs(v.Db, grantedProjectTable, projectID, orgID)
}
func (v *View) GrantedProjectGrantByIDs(projectID, grantID string) (*model.GrantedProjectView, error) {
return view.GrantedProjectGrantByIDs(v.Db, grantedProjectTable, projectID, grantID)
}
func (v *View) GrantedProjectsByID(projectID string) ([]*model.GrantedProjectView, error) {
return view.GrantedProjectsByID(v.Db, grantedProjectTable, projectID)
}
func (v *View) SearchGrantedProjects(request *proj_model.GrantedProjectSearchRequest) ([]*model.GrantedProjectView, int, error) {
return view.SearchGrantedProjects(v.Db, grantedProjectTable, request)
}
func (v *View) PutGrantedProject(project *model.GrantedProjectView) error {
err := view.PutGrantedProject(v.Db, grantedProjectTable, project)
if err != nil {
return err
}
return v.ProcessedGrantedProjectSequence(project.Sequence)
}
func (v *View) DeleteGrantedProject(projectID, orgID string, eventSequence uint64) error {
err := view.DeleteGrantedProject(v.Db, grantedProjectTable, projectID, orgID)
if err != nil {
return nil
}
return v.ProcessedGrantedProjectSequence(eventSequence)
}
func (v *View) GetLatestGrantedProjectSequence() (uint64, error) {
return v.latestSequence(grantedProjectTable)
}
func (v *View) ProcessedGrantedProjectSequence(eventSequence uint64) error {
return v.saveCurrentSequence(grantedProjectTable, eventSequence)
}
func (v *View) GetLatestGrantedProjectFailedEvent(sequence uint64) (*global_view.FailedEvent, error) {
return v.latestFailedEvent(grantedProjectTable, sequence)
}
func (v *View) ProcessedGrantedProjectFailedEvent(failedEvent *global_view.FailedEvent) error {
return v.saveFailedEvent(failedEvent)
}