aboutsummaryrefslogtreecommitdiff
path: root/internal/route/api/v1/repo/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/route/api/v1/repo/repo.go')
-rw-r--r--internal/route/api/v1/repo/repo.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/route/api/v1/repo/repo.go b/internal/route/api/v1/repo/repo.go
index 81341627..c0e3b612 100644
--- a/internal/route/api/v1/repo/repo.go
+++ b/internal/route/api/v1/repo/repo.go
@@ -32,7 +32,7 @@ func Search(c *context.APIContext) {
if c.User.ID == opts.OwnerID {
opts.Private = true
} else {
- u, err := db.GetUserByID(opts.OwnerID)
+ u, err := db.Users.GetByID(c.Req.Context(), opts.OwnerID)
if err != nil {
c.JSON(http.StatusInternalServerError, map[string]interface{}{
"ok": false,
@@ -77,7 +77,7 @@ func Search(c *context.APIContext) {
}
func listUserRepositories(c *context.APIContext, username string) {
- user, err := db.GetUserByName(username)
+ user, err := db.Users.GetByUsername(c.Req.Context(), username)
if err != nil {
c.NotFoundOrError(err, "get user by name")
return
@@ -209,7 +209,7 @@ func Migrate(c *context.APIContext, f form.MigrateRepo) {
// Not equal means context user is an organization,
// or is another user/organization if current user is admin.
if f.Uid != ctxUser.ID {
- org, err := db.GetUserByID(f.Uid)
+ org, err := db.Users.GetByID(c.Req.Context(), f.Uid)
if err != nil {
if db.IsErrUserNotExist(err) {
c.ErrorStatus(http.StatusUnprocessableEntity, err)
@@ -287,7 +287,7 @@ func Migrate(c *context.APIContext, f form.MigrateRepo) {
// FIXME: inject in the handler chain
func parseOwnerAndRepo(c *context.APIContext) (*db.User, *db.Repository) {
- owner, err := db.GetUserByName(c.Params(":username"))
+ owner, err := db.Users.GetByUsername(c.Req.Context(), c.Params(":username"))
if err != nil {
if db.IsErrUserNotExist(err) {
c.ErrorStatus(http.StatusUnprocessableEntity, err)
@@ -453,7 +453,7 @@ func Releases(c *context.APIContext) {
}
apiReleases := make([]*api.Release, 0, len(releases))
for _, r := range releases {
- publisher, err := db.GetUserByID(r.PublisherID)
+ publisher, err := db.Users.GetByID(c.Req.Context(), r.PublisherID)
if err != nil {
c.Error(err, "get release publisher")
return