Skip to content

Commit 75cebc5

Browse files
committed
feat(shares): implement controller
1 parent 162eee4 commit 75cebc5

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"build": "nest build",
7-
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
7+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
88
"start": "nest start",
99
"start:dev": "nest start --watch",
1010
"start:debug": "nest start --debug --watch",

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { SnakeNamingStrategy } from 'typeorm-naming-strategies';
3535
import { NullUserEmail1752814358259 } from 'omniboxd/migrations/1752814358259-null-user-email';
3636
import { AttachmentsModule } from 'omniboxd/attachments/attachments.module';
3737
import { Shares1753866547335 } from 'omniboxd/migrations/1753866547335-shares';
38+
import { SharesModule } from 'omniboxd/shares/shares.module';
3839

3940
@Module({})
4041
export class AppModule implements NestModule {
@@ -73,6 +74,7 @@ export class AppModule implements NestModule {
7374
SearchModule,
7475
InvitationsModule,
7576
AttachmentsModule,
77+
SharesModule,
7678
// CacheModule.registerAsync({
7779
// imports: [ConfigModule],
7880
// inject: [ConfigService],

src/shares/shares.controller.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1-
import { Controller, Get, Param, Patch, Req } from '@nestjs/common';
1+
import { Body, Controller, Get, Param, Patch, Req } from '@nestjs/common';
2+
import { SharesService } from './shares.service';
3+
import { UpdateShareInfoReqDto } from './dto/update-share-info-req.dto';
24

35
@Controller('api/v1/namespaces/:namespaceId/resources/:resourceId/share')
46
export class SharesController {
5-
constructor() {}
7+
constructor(private readonly sharesService: SharesService) {}
68

79
@Get()
810
async getShareInfo(
911
@Req() req,
1012
@Param('namespaceId') namespaceId: string,
1113
@Param('resourceId') resourceId: string,
1214
) {
13-
// todo
15+
return await this.sharesService.getShareInfo(namespaceId, resourceId);
1416
}
1517

1618
@Patch()
1719
async updateShareInfo(
1820
@Req() req,
1921
@Param('namespaceId') namespaceId: string,
2022
@Param('resourceId') resourceId: string,
23+
@Body() updateReq: UpdateShareInfoReqDto,
2124
) {
22-
// todo
25+
return await this.sharesService.updateShareInfo(
26+
namespaceId,
27+
resourceId,
28+
updateReq,
29+
);
2330
}
2431
}

0 commit comments

Comments
 (0)