Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 7959677

Browse files
author
noah
committed
WIP
1 parent bae83a2 commit 7959677

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

internal/pkg/store/deploymentstatus.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ func (s *Store) ListDeploymentStatuses(ctx context.Context, d *ent.Deployment) (
2121
return dss, nil
2222
}
2323

24+
func (s *Store) FindDeploymentStatusByID(ctx context.Context, id int) (*ent.DeploymentStatus, error) {
25+
ds, err := s.c.DeploymentStatus.Query().
26+
Where(deploymentstatus.IDEQ(id)).
27+
WithDeployment().
28+
WithRepo().
29+
Only(ctx)
30+
if ent.IsNotFound(err) {
31+
return nil, e.NewError(e.ErrorCodeEntityNotFound, err)
32+
}
33+
34+
return ds, nil
35+
}
36+
2437
func (s *Store) CreateEntDeploymentStatus(ctx context.Context, ds *ent.DeploymentStatus) (*ent.DeploymentStatus, error) {
2538
// Build the query creating a deployment status.
2639
qry := s.c.DeploymentStatus.Create().
@@ -50,12 +63,3 @@ func (s *Store) CreateEntDeploymentStatus(ctx context.Context, ds *ent.Deploymen
5063

5164
return ret, nil
5265
}
53-
54-
func (s *Store) FindDeploymentStatusByID(ctx context.Context, id int) (*ent.DeploymentStatus, error) {
55-
ds, err := s.c.DeploymentStatus.Get(ctx, id)
56-
if ent.IsNotFound(err) {
57-
return nil, e.NewError(e.ErrorCodeEntityNotFound, err)
58-
}
59-
60-
return ds, nil
61-
}

0 commit comments

Comments
 (0)