@@ -56,7 +56,7 @@ func (r *Project) Filtered(f repo.WorkspaceFilter) repo.Project {
5656func (r * Project ) FindByID (ctx context.Context , id id.ProjectID ) (* project.Project , error ) {
5757 prj , err := r .findOne (ctx , bson.M {
5858 "id" : id .String (),
59- }, true )
59+ }, false )
6060
6161 if err != nil {
6262 if err == mongo .ErrNoDocuments {
@@ -72,9 +72,19 @@ func (r *Project) FindByScene(ctx context.Context, id id.SceneID) (*project.Proj
7272 if ! r .s .CanRead (id ) {
7373 return nil , nil
7474 }
75- return r .findOne (ctx , bson.M {
75+
76+ prj , err := r .findOne (ctx , bson.M {
7677 "scene" : id .String (),
77- }, true )
78+ }, false )
79+
80+ if err != nil {
81+ if err == mongo .ErrNoDocuments {
82+ return nil , repo .ErrResourceNotFound
83+ }
84+ return nil , err
85+ }
86+
87+ return prj , nil
7888}
7989
8090func (r * Project ) FindByIDs (ctx context.Context , ids id.ProjectIDList ) ([]* project.Project , error ) {
@@ -479,7 +489,7 @@ func (r *Project) FindActiveById(ctx context.Context, id id.ProjectID) (*project
479489 prj , err := r .findOne (ctx , bson.M {
480490 "id" : id .String (),
481491 "deleted" : false ,
482- }, true )
492+ }, false )
483493
484494 if err != nil {
485495 if err == mongo .ErrNoDocuments {
@@ -495,7 +505,7 @@ func (r *Project) FindActiveByAlias(ctx context.Context, alias string) (*project
495505 prj , err := r .findOne (ctx , bson.M {
496506 "alias" : alias ,
497507 "deleted" : false ,
498- }, true )
508+ }, false )
499509
500510 if err != nil {
501511 if err == mongo .ErrNoDocuments {
@@ -508,9 +518,10 @@ func (r *Project) FindActiveByAlias(ctx context.Context, alias string) (*project
508518}
509519
510520func (r * Project ) FindByProjectAlias (ctx context.Context , alias string ) (* project.Project , error ) {
521+
511522 prj , err := r .findOne (ctx , bson.M {
512523 "projectalias" : alias ,
513- }, true )
524+ }, false )
514525
515526 if err != nil {
516527 if err == mongo .ErrNoDocuments {
0 commit comments