init studio admin backend
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
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/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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user