aboutsummaryrefslogtreecommitdiff
path: root/internal/route/api/v1/repo
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-06-25 18:07:39 +0800
committerGitHub <noreply@github.com>2022-06-25 18:07:39 +0800
commit083c3ee659c6c5542687f3bafae68cbc24dbc90f (patch)
tree0103bf3b5c5ebfccd368a7cb6a425a521fd669d9 /internal/route/api/v1/repo
parent9df4e3ae3c555a86f691f0d78a43834842e77d8b (diff)
db: refactor "action" table to use GORM (#7054)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/route/api/v1/repo')
-rw-r--r--internal/route/api/v1/repo/repo.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/route/api/v1/repo/repo.go b/internal/route/api/v1/repo/repo.go
index 682d2a3b..e26cc5bd 100644
--- a/internal/route/api/v1/repo/repo.go
+++ b/internal/route/api/v1/repo/repo.go
@@ -66,7 +66,7 @@ func Search(c *context.APIContext) {
results := make([]*api.Repository, len(repos))
for i := range repos {
- results[i] = repos[i].APIFormat(nil)
+ results[i] = repos[i].APIFormatLegacy(nil)
}
c.SetLinkHeader(int(count), opts.PageSize)
@@ -110,7 +110,7 @@ func listUserRepositories(c *context.APIContext, username string) {
if c.User.ID != user.ID {
repos := make([]*api.Repository, len(ownRepos))
for i := range ownRepos {
- repos[i] = ownRepos[i].APIFormat(&api.Permission{Admin: true, Push: true, Pull: true})
+ repos[i] = ownRepos[i].APIFormatLegacy(&api.Permission{Admin: true, Push: true, Pull: true})
}
c.JSONSuccess(&repos)
return
@@ -125,12 +125,12 @@ func listUserRepositories(c *context.APIContext, username string) {
numOwnRepos := len(ownRepos)
repos := make([]*api.Repository, numOwnRepos+len(accessibleRepos))
for i := range ownRepos {
- repos[i] = ownRepos[i].APIFormat(&api.Permission{Admin: true, Push: true, Pull: true})
+ repos[i] = ownRepos[i].APIFormatLegacy(&api.Permission{Admin: true, Push: true, Pull: true})
}
i := numOwnRepos
for repo, access := range accessibleRepos {
- repos[i] = repo.APIFormat(&api.Permission{
+ repos[i] = repo.APIFormatLegacy(&api.Permission{
Admin: access >= db.AccessModeAdmin,
Push: access >= db.AccessModeWrite,
Pull: true,
@@ -154,7 +154,7 @@ func ListOrgRepositories(c *context.APIContext) {
}
func CreateUserRepo(c *context.APIContext, owner *db.User, opt api.CreateRepoOption) {
- repo, err := db.CreateRepository(c.User, owner, db.CreateRepoOptions{
+ repo, err := db.CreateRepository(c.User, owner, db.CreateRepoOptionsLegacy{
Name: opt.Name,
Description: opt.Description,
Gitignores: opt.Gitignores,
@@ -178,7 +178,7 @@ func CreateUserRepo(c *context.APIContext, owner *db.User, opt api.CreateRepoOpt
return
}
- c.JSON(201, repo.APIFormat(&api.Permission{Admin: true, Push: true, Pull: true}))
+ c.JSON(201, repo.APIFormatLegacy(&api.Permission{Admin: true, Push: true, Pull: true}))
}
func Create(c *context.APIContext, opt api.CreateRepoOption) {
@@ -282,7 +282,7 @@ func Migrate(c *context.APIContext, f form.MigrateRepo) {
}
log.Trace("Repository migrated: %s/%s", ctxUser.Name, f.RepoName)
- c.JSON(201, repo.APIFormat(&api.Permission{Admin: true, Push: true, Pull: true}))
+ c.JSON(201, repo.APIFormatLegacy(&api.Permission{Admin: true, Push: true, Pull: true}))
}
// FIXME: inject in the handler chain
@@ -312,7 +312,7 @@ func Get(c *context.APIContext) {
return
}
- c.JSONSuccess(repo.APIFormat(&api.Permission{
+ c.JSONSuccess(repo.APIFormatLegacy(&api.Permission{
Admin: c.Repo.IsAdmin(),
Push: c.Repo.IsWriter(),
Pull: true,
@@ -352,7 +352,7 @@ func ListForks(c *context.APIContext) {
c.Error(err, "get owner")
return
}
- apiForks[i] = forks[i].APIFormat(&api.Permission{
+ apiForks[i] = forks[i].APIFormatLegacy(&api.Permission{
Admin: c.User.IsAdminOfRepo(forks[i]),
Push: c.User.IsWriterOfRepo(forks[i]),
Pull: true,