mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
fix: return emtpy project if no project in view (#379)
* fix: return emtpy project if no project in view * fix: new project if nil * fix: easier to read
This commit is contained in:
parent
837d7cc770
commit
5081ff21b0
@ -40,6 +40,9 @@ func (repo *ProjectRepo) ProjectByID(ctx context.Context, id string) (*proj_mode
|
|||||||
if err != nil && !caos_errs.IsNotFound(err) {
|
if err != nil && !caos_errs.IsNotFound(err) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if caos_errs.IsNotFound(err) {
|
||||||
|
project = new(model.ProjectView)
|
||||||
|
}
|
||||||
|
|
||||||
events, err := repo.ProjectEvents.ProjectEventsByID(ctx, id, project.Sequence)
|
events, err := repo.ProjectEvents.ProjectEventsByID(ctx, id, project.Sequence)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -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) {
|
func ProjectsByResourceOwner(db *gorm.DB, table, orgID string) ([]*model.ProjectView, error) {
|
||||||
projects := make([]*model.ProjectView, 0)
|
projects := make([]*model.ProjectView, 0)
|
||||||
queries := []*proj_model.ProjectViewSearchQuery{
|
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})
|
query := repository.PrepareSearchQuery(table, model.ProjectSearchRequest{Queries: queries})
|
||||||
_, err := query(db, &projects)
|
_, err := query(db, &projects)
|
||||||
|
Loading…
Reference in New Issue
Block a user