diff --git a/internal/management/repository/eventsourcing/eventstore/project.go b/internal/management/repository/eventsourcing/eventstore/project.go index 6575aa5394..0bd334beee 100644 --- a/internal/management/repository/eventsourcing/eventstore/project.go +++ b/internal/management/repository/eventsourcing/eventstore/project.go @@ -40,6 +40,9 @@ func (repo *ProjectRepo) ProjectByID(ctx context.Context, id string) (*proj_mode if err != nil && !caos_errs.IsNotFound(err) { return nil, err } + if caos_errs.IsNotFound(err) { + project = new(model.ProjectView) + } events, err := repo.ProjectEvents.ProjectEventsByID(ctx, id, project.Sequence) if err != nil { diff --git a/internal/project/repository/view/project_view.go b/internal/project/repository/view/project_view.go index 146ae14fd0..6ae7cf2cb7 100644 --- a/internal/project/repository/view/project_view.go +++ b/internal/project/repository/view/project_view.go @@ -24,7 +24,7 @@ func ProjectByID(db *gorm.DB, table, projectID string) (*model.ProjectView, erro func ProjectsByResourceOwner(db *gorm.DB, table, orgID string) ([]*model.ProjectView, error) { projects := make([]*model.ProjectView, 0) queries := []*proj_model.ProjectViewSearchQuery{ - &proj_model.ProjectViewSearchQuery{Key: proj_model.ProjectViewSearchKeyResourceOwner, Value: orgID, Method: global_model.SearchMethodEquals}, + {Key: proj_model.ProjectViewSearchKeyResourceOwner, Value: orgID, Method: global_model.SearchMethodEquals}, } query := repository.PrepareSearchQuery(table, model.ProjectSearchRequest{Queries: queries}) _, err := query(db, &projects)