0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-25 06:56:40 +02:00

update API routes as well

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

View File

@ -1163,7 +1163,7 @@ func Routes() *web.Router {
// (repo scope)
m.Group("/starred", func() {
m.Get("", user.GetMyStarredRepos)
m.Group("/{username}/{reponame}", func() {
m.Group("/{username}/{group_id}?/{reponame}", func() {
m.Get("", user.IsStarring)
m.Put("", user.Star)
m.Delete("", user.Unstar)
@ -1215,7 +1215,7 @@ func Routes() *web.Router {
// (repo scope)
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.Combo("").Get(reqAnyRepoReader(), repo.Get).
@ -1513,11 +1513,11 @@ func Routes() *web.Router {
// 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
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)
m.Group("/repos", func() {
m.Group("/{username}/{reponame}", func() {
m.Group("/{username}/{group_id}?/{reponame}", func() {
m.Combo("/notifications", reqToken()).
Get(notify.ListRepoNotifications).
Put(notify.ReadRepoNotifications)
@ -1528,7 +1528,7 @@ func Routes() *web.Router {
m.Group("/repos", func() {
m.Get("/issues/search", repo.SearchIssues)
m.Group("/{username}/{reponame}", func() {
m.Group("/{username}/{group_id}?/{reponame}", func() {
m.Group("/issues", func() {
m.Combo("").Get(repo.ListIssues).
Post(reqToken(), mustNotBeArchived, bind(api.CreateIssueOption{}), reqRepoReader(unit.TypeIssues), repo.CreateIssue)

View File

@ -399,7 +399,7 @@ func TestCantMergeUnrelated(t *testing.T) {
OwnerID: user1.ID,
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())
assert.NoError(t, err)

View File

@ -542,7 +542,7 @@ func TestGenerateRepository(t *testing.T) {
require.NoError(t, err)
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.True(t, exist)
@ -565,7 +565,7 @@ func TestGenerateRepository(t *testing.T) {
// a failed creating because some mock data
// 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{
Name: "generated-from-template-44",
@ -577,7 +577,7 @@ func TestGenerateRepository(t *testing.T) {
// assert the cleanup is successful
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.False(t, exist)
}