Files
studio-admin-be/src/gitea/gitea.controller.ts
T
chyoo 0951283c8b
ci/woodpecker/push/woodpecker Pipeline was successful
support paged launcher history queries
2026-07-07 09:20:18 +09:00

77 lines
2.0 KiB
TypeScript

import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import {
CreateGiteaRepoDto,
ListGiteaCommitsQuery,
ListGiteaReposQuery,
ListGiteaTreeQuery,
} from './dto';
import { GiteaService } from './gitea.service';
@Controller('gitea')
export class GiteaController {
constructor(private readonly giteaService: GiteaService) {}
@Get('version')
getVersion() {
return this.giteaService.getVersion();
}
@Get('repos')
listRepos(@Query() query: ListGiteaReposQuery) {
return this.giteaService.listRepos(query);
}
@Post('repos')
createUserRepo(@Body() body: CreateGiteaRepoDto) {
return this.giteaService.createUserRepo(body);
}
@Post('orgs/:org/repos')
createOrgRepo(@Param('org') org: string, @Body() body: CreateGiteaRepoDto) {
return this.giteaService.createOrgRepo(org, body);
}
@Get('repos/:owner/:repo')
getRepo(@Param('owner') owner: string, @Param('repo') repo: string) {
return this.giteaService.getRepo(owner, repo);
}
@Get('repos/:owner/:repo/branches')
listBranches(@Param('owner') owner: string, @Param('repo') repo: string) {
return this.giteaService.listBranches(owner, repo);
}
@Get('repos/:owner/:repo/commits')
listCommits(
@Param('owner') owner: string,
@Param('repo') repo: string,
@Query() query: ListGiteaCommitsQuery,
) {
return this.giteaService.listCommits(owner, repo, query);
}
@Get('repos/:owner/:repo/commits/:sha/diff')
getCommitDiff(
@Param('owner') owner: string,
@Param('repo') repo: string,
@Param('sha') sha: string,
) {
return this.giteaService.getCommitDiff(owner, repo, sha);
}
@Get('repos/:owner/:repo/releases')
listReleases(@Param('owner') owner: string, @Param('repo') repo: string) {
return this.giteaService.listReleases(owner, repo);
}
@Get('repos/:owner/:repo/tree')
listTree(
@Param('owner') owner: string,
@Param('repo') repo: string,
@Query() query: ListGiteaTreeQuery,
) {
return this.giteaService.listTree(owner, repo, query);
}
}