0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-12 15:33:39 +02:00

update API routes as well

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2025-08-17 19:56:16 -04:00
parent e602134b3e
commit bd233af6bd
No known key found for this signature in database
GPG Key ID: 924A5F6AF051E87C
3 changed files with 9 additions and 9 deletions

View File

@ -1162,7 +1162,7 @@ func Routes() *web.Router {
// (repo scope) // (repo scope)
m.Group("/starred", func() { m.Group("/starred", func() {
m.Get("", user.GetMyStarredRepos) m.Get("", user.GetMyStarredRepos)
m.Group("/{username}/{reponame}", func() { m.Group("/{username}/{group_id}?/{reponame}", func() {
m.Get("", user.IsStarring) m.Get("", user.IsStarring)
m.Put("", user.Star) m.Put("", user.Star)
m.Delete("", user.Unstar) m.Delete("", user.Unstar)
@ -1214,7 +1214,7 @@ func Routes() *web.Router {
// (repo scope) // (repo scope)
m.Post("/migrate", reqToken(), bind(api.MigrateRepoOptions{}), repo.Migrate) m.Post("/migrate", reqToken(), bind(api.MigrateRepoOptions{}), repo.Migrate)
m.Group("/{username}/{reponame}", func() { m.Group("/{username}/{group_id}?/{reponame}", func() {
m.Get("/compare/*", reqRepoReader(unit.TypeCode), repo.CompareDiff) m.Get("/compare/*", reqRepoReader(unit.TypeCode), repo.CompareDiff)
m.Combo("").Get(reqAnyRepoReader(), repo.Get). m.Combo("").Get(reqAnyRepoReader(), repo.Get).
@ -1517,11 +1517,11 @@ func Routes() *web.Router {
// Artifacts direct download endpoint authenticates via signed url // Artifacts direct download endpoint authenticates via signed url
// it is protected by the "sig" parameter (to help to access private repo), so no need to use other middlewares // it is protected by the "sig" parameter (to help to access private repo), so no need to use other middlewares
m.Get("/repos/{username}/{reponame}/actions/artifacts/{artifact_id}/zip/raw", repo.DownloadArtifactRaw) m.Get("/repos/{username}/{group_id}?/{reponame}/actions/artifacts/{artifact_id}/zip/raw", repo.DownloadArtifactRaw)
// Notifications (requires notifications scope) // Notifications (requires notifications scope)
m.Group("/repos", func() { m.Group("/repos", func() {
m.Group("/{username}/{reponame}", func() { m.Group("/{username}/{group_id}?/{reponame}", func() {
m.Combo("/notifications", reqToken()). m.Combo("/notifications", reqToken()).
Get(notify.ListRepoNotifications). Get(notify.ListRepoNotifications).
Put(notify.ReadRepoNotifications) Put(notify.ReadRepoNotifications)
@ -1532,7 +1532,7 @@ func Routes() *web.Router {
m.Group("/repos", func() { m.Group("/repos", func() {
m.Get("/issues/search", repo.SearchIssues) m.Get("/issues/search", repo.SearchIssues)
m.Group("/{username}/{reponame}", func() { m.Group("/{username}/{group_id}?/{reponame}", func() {
m.Group("/issues", func() { m.Group("/issues", func() {
m.Combo("").Get(repo.ListIssues). m.Combo("").Get(repo.ListIssues).
Post(reqToken(), mustNotBeArchived, bind(api.CreateIssueOption{}), reqRepoReader(unit.TypeIssues), repo.CreateIssue) Post(reqToken(), mustNotBeArchived, bind(api.CreateIssueOption{}), reqRepoReader(unit.TypeIssues), repo.CreateIssue)

View File

@ -384,7 +384,7 @@ func TestCantMergeUnrelated(t *testing.T) {
OwnerID: user1.ID, OwnerID: user1.ID,
Name: "repo1", Name: "repo1",
}) })
path := repo_model.RepoPath(user1.Name, repo1.Name) path := repo_model.RepoPath(user1.Name, repo1.Name, repo1.GroupID)
err := gitcmd.NewCommand("read-tree", "--empty").WithDir(path).Run(t.Context()) err := gitcmd.NewCommand("read-tree", "--empty").WithDir(path).Run(t.Context())
assert.NoError(t, err) assert.NoError(t, err)

View File

@ -542,7 +542,7 @@ func TestGenerateRepository(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, generatedRepo) require.NotNil(t, generatedRepo)
exist, err := util.IsExist(repo_model.RepoPath(user2.Name, generatedRepo.Name)) exist, err := util.IsExist(repo_model.RepoPath(user2.Name, generatedRepo.Name, generatedRepo.GroupID))
require.NoError(t, err) require.NoError(t, err)
require.True(t, exist) require.True(t, exist)
@ -565,7 +565,7 @@ func TestGenerateRepository(t *testing.T) {
// a failed creating because some mock data // a failed creating because some mock data
// create the repository directory so that the creation will fail after database record created. // create the repository directory so that the creation will fail after database record created.
assert.NoError(t, os.MkdirAll(repo_model.RepoPath(user2.Name, "generated-from-template-44"), os.ModePerm)) assert.NoError(t, os.MkdirAll(repo_model.RepoPath(user2.Name, "generated-from-template-44", generatedRepo.GroupID), os.ModePerm))
generatedRepo2, err := repo_service.GenerateRepository(t.Context(), user2, user2, repo44, repo_service.GenerateRepoOptions{ generatedRepo2, err := repo_service.GenerateRepository(t.Context(), user2, user2, repo44, repo_service.GenerateRepoOptions{
Name: "generated-from-template-44", Name: "generated-from-template-44",
@ -577,7 +577,7 @@ func TestGenerateRepository(t *testing.T) {
// assert the cleanup is successful // assert the cleanup is successful
unittest.AssertNotExistsBean(t, &repo_model.Repository{OwnerName: user2.Name, Name: generatedRepo.Name}) unittest.AssertNotExistsBean(t, &repo_model.Repository{OwnerName: user2.Name, Name: generatedRepo.Name})
exist, err = util.IsExist(repo_model.RepoPath(user2.Name, generatedRepo.Name)) exist, err = util.IsExist(repo_model.RepoPath(user2.Name, generatedRepo.Name, generatedRepo.GroupID))
assert.NoError(t, err) assert.NoError(t, err)
assert.False(t, exist) assert.False(t, exist)
} }