Skip to content

Commit abb1e41

Browse files
authored
Merge pull request #811 from gitroomhq/feat/sets
Sets feature
2 parents 3cf3a4b + 460521c commit abb1e41

File tree

19 files changed

+924
-449
lines changed

19 files changed

+924
-449
lines changed

apps/backend/src/api/api.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { SignatureController } from '@gitroom/backend/api/routes/signature.contr
3333
import { AutopostController } from '@gitroom/backend/api/routes/autopost.controller';
3434
import { McpService } from '@gitroom/nestjs-libraries/mcp/mcp.service';
3535
import { McpController } from '@gitroom/backend/api/routes/mcp.controller';
36+
import { SetsController } from '@gitroom/backend/api/routes/sets.controller';
3637

3738
const authenticatedController = [
3839
UsersController,
@@ -50,6 +51,7 @@ const authenticatedController = [
5051
WebhookController,
5152
SignatureController,
5253
AutopostController,
54+
SetsController,
5355
];
5456
@Module({
5557
imports: [UploadModule],
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import {
2+
Body,
3+
Controller,
4+
Delete,
5+
Get,
6+
Param,
7+
Post,
8+
Put,
9+
} from '@nestjs/common';
10+
import { GetOrgFromRequest } from '@gitroom/nestjs-libraries/user/org.from.request';
11+
import { Organization } from '@prisma/client';
12+
import { ApiTags } from '@nestjs/swagger';
13+
import { SetsService } from '@gitroom/nestjs-libraries/database/prisma/sets/sets.service';
14+
import { CheckPolicies } from '@gitroom/backend/services/auth/permissions/permissions.ability';
15+
import {
16+
AuthorizationActions,
17+
Sections,
18+
} from '@gitroom/backend/services/auth/permissions/permissions.service';
19+
import {
20+
UpdateSetsDto,
21+
SetsDto,
22+
} from '@gitroom/nestjs-libraries/dtos/sets/sets.dto';
23+
24+
@ApiTags('Sets')
25+
@Controller('/sets')
26+
export class SetsController {
27+
constructor(private _setsService: SetsService) {}
28+
29+
@Get('/')
30+
async getSets(@GetOrgFromRequest() org: Organization) {
31+
return this._setsService.getSets(org.id);
32+
}
33+
34+
@Post('/')
35+
async createASet(
36+
@GetOrgFromRequest() org: Organization,
37+
@Body() body: SetsDto
38+
) {
39+
return this._setsService.createSet(org.id, body);
40+
}
41+
42+
@Put('/')
43+
async updateSet(
44+
@GetOrgFromRequest() org: Organization,
45+
@Body() body: UpdateSetsDto
46+
) {
47+
return this._setsService.createSet(org.id, body);
48+
}
49+
50+
@Delete('/:id')
51+
async deleteSet(
52+
@GetOrgFromRequest() org: Organization,
53+
@Param('id') id: string
54+
) {
55+
return this._setsService.deleteSet(org.id, id);
56+
}
57+
}

0 commit comments

Comments
 (0)