@@ -18,33 +18,10 @@ type (
1818 PermStore
1919 DeploymentStore
2020 DeploymentStatusStore
21-
22- FindDeploymentStatisticsOfRepoByEnv (ctx context.Context , r * ent.Repo , env string ) (* ent.DeploymentStatistics , error )
23- CreateDeploymentStatistics (ctx context.Context , s * ent.DeploymentStatistics ) (* ent.DeploymentStatistics , error )
24- UpdateDeploymentStatistics (ctx context.Context , s * ent.DeploymentStatistics ) (* ent.DeploymentStatistics , error )
25-
26- ListAllDeploymentStatistics (ctx context.Context ) ([]* ent.DeploymentStatistics , error )
27- ListDeploymentStatisticsGreaterThanTime (ctx context.Context , updated time.Time ) ([]* ent.DeploymentStatistics , error )
28-
29- SearchReviews (ctx context.Context , u * ent.User ) ([]* ent.Review , error )
30- ListReviews (ctx context.Context , d * ent.Deployment ) ([]* ent.Review , error )
31- FindReviewOfUser (ctx context.Context , u * ent.User , d * ent.Deployment ) (* ent.Review , error )
32- FindReviewByID (ctx context.Context , id int ) (* ent.Review , error )
33- CreateReview (ctx context.Context , rv * ent.Review ) (* ent.Review , error )
34- UpdateReview (ctx context.Context , rv * ent.Review ) (* ent.Review , error )
35-
36- ListExpiredLocksLessThanTime (ctx context.Context , t time.Time ) ([]* ent.Lock , error )
37- ListLocksOfRepo (ctx context.Context , r * ent.Repo ) ([]* ent.Lock , error )
38- FindLockOfRepoByEnv (ctx context.Context , r * ent.Repo , env string ) (* ent.Lock , error )
39- HasLockOfRepoForEnv (ctx context.Context , r * ent.Repo , env string ) (bool , error )
40- FindLockByID (ctx context.Context , id int ) (* ent.Lock , error )
41- CreateLock (ctx context.Context , l * ent.Lock ) (* ent.Lock , error )
42- UpdateLock (ctx context.Context , l * ent.Lock ) (* ent.Lock , error )
43- DeleteLock (ctx context.Context , l * ent.Lock ) error
44-
45- ListEventsGreaterThanTime (ctx context.Context , t time.Time ) ([]* ent.Event , error )
46- CreateEvent (ctx context.Context , e * ent.Event ) (* ent.Event , error )
47- CheckNotificationRecordOfEvent (ctx context.Context , e * ent.Event ) bool
21+ DeploymentStatisticsStore
22+ LockStore
23+ ReviewStore
24+ EventStore
4825 }
4926
5027 // PermStore defines operations for working with perms.
@@ -70,24 +47,48 @@ type (
7047 SyncDeploymentStatus (ctx context.Context , ds * ent.DeploymentStatus ) (* ent.DeploymentStatus , error )
7148 }
7249
50+ // ReviewStore defines operations for working with reviews.
51+ ReviewStore interface {
52+ SearchReviews (ctx context.Context , u * ent.User ) ([]* ent.Review , error )
53+ ListReviews (ctx context.Context , d * ent.Deployment ) ([]* ent.Review , error )
54+ FindReviewOfUser (ctx context.Context , u * ent.User , d * ent.Deployment ) (* ent.Review , error )
55+ FindReviewByID (ctx context.Context , id int ) (* ent.Review , error )
56+ CreateReview (ctx context.Context , rv * ent.Review ) (* ent.Review , error )
57+ UpdateReview (ctx context.Context , rv * ent.Review ) (* ent.Review , error )
58+ }
59+
7360 SCM interface {
7461 UserSCM
7562 RepoSCM
7663 DeploymentSCM
64+ DeploymentStatusSCM
65+ CommitSCM
66+ BranchSCM
67+ TagSCM
7768
69+ GetRateLimit (ctx context.Context , u * ent.User ) (* extent.RateLimit , error )
70+ }
71+
72+ // DeploymentStatusSCM defines operations for working with remote deployment status.
73+ DeploymentStatusSCM interface {
7874 CreateRemoteDeploymentStatus (ctx context.Context , u * ent.User , r * ent.Repo , d * ent.Deployment , ds * extent.RemoteDeploymentStatus ) (* extent.RemoteDeploymentStatus , error )
75+ }
7976
80- ListCommits (ctx context.Context , u * ent.User , r * ent.Repo , branch string , page , perPage int ) ([]* extent.Commit , error )
81- CompareCommits (ctx context.Context , u * ent.User , r * ent.Repo , base , head string , page , perPage int ) ([]* extent.Commit , []* extent.CommitFile , error )
77+ // CommitSCM defines operations for working with commit.
78+ CommitSCM interface {
79+ ListCommits (ctx context.Context , u * ent.User , r * ent.Repo , branch string , opt * ListOptions ) ([]* extent.Commit , error )
80+ CompareCommits (ctx context.Context , u * ent.User , r * ent.Repo , base , head string , opt * ListOptions ) ([]* extent.Commit , []* extent.CommitFile , error )
8281 GetCommit (ctx context.Context , u * ent.User , r * ent.Repo , sha string ) (* extent.Commit , error )
8382 ListCommitStatuses (ctx context.Context , u * ent.User , r * ent.Repo , sha string ) ([]* extent.Status , error )
83+ }
8484
85- ListBranches (ctx context.Context , u * ent.User , r * ent.Repo , page , perPage int ) ([]* extent.Branch , error )
85+ BranchSCM interface {
86+ ListBranches (ctx context.Context , u * ent.User , r * ent.Repo , opt * ListOptions ) ([]* extent.Branch , error )
8687 GetBranch (ctx context.Context , u * ent.User , r * ent.Repo , branch string ) (* extent.Branch , error )
88+ }
8789
88- ListTags (ctx context.Context , u * ent.User , r * ent.Repo , page , perPage int ) ([]* extent.Tag , error )
90+ TagSCM interface {
91+ ListTags (ctx context.Context , u * ent.User , r * ent.Repo , opt * ListOptions ) ([]* extent.Tag , error )
8992 GetTag (ctx context.Context , u * ent.User , r * ent.Repo , tag string ) (* extent.Tag , error )
90-
91- GetRateLimit (ctx context.Context , u * ent.User ) (* extent.RateLimit , error )
9293 }
9394)
0 commit comments