Skip to content

Commit 3304aa0

Browse files
authored
Merge pull request #240 from boostcampwm-2024/feature-5-be
[Feature-be-fix] get Connection 403 ์—๋Ÿฌ ๋กœ๊ทธ ์ถ”๊ฐ€, ๊ฒŒ์ŠคํŠธ ๋งˆ์ธ๋“œ๋งต ์ƒ์„ฑ ๊ธฐ๋ณธ๊ฐ’ ์ถ”๊ฐ€
2 parents f923361 + 16ca8d8 commit 3304aa0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

โ€ŽBE/apps/api-server/src/modules/connection/connection.controller.tsโ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export class ConnectionController {
2626
@UseGuards(AuthGuard('jwt'))
2727
async getConnection(@Query() queryDto: ConnectionQueryDto, @User() user: UserDto) {
2828
const { type, id } = queryDto;
29-
29+
console.log('type:', type);
30+
console.log('id:', id);
3031
switch (type) {
3132
case 'connection':
3233
return await this.connectionService.getConnection(id as string, user.id);

โ€ŽBE/apps/api-server/src/modules/connection/connection.service.tsโ€Ž

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ export class ConnectionService {
2525

2626
async createGuestConnection() {
2727
const connectionId = uuidv4();
28-
await this.GeneralRedis.hset(connectionId, { type: 'guest' });
28+
await Promise.all([
29+
this.GeneralRedis.hset(connectionId, { type: 'guest', aiCount: 0, title: '์ œ๋ชฉ์—†์Œ' }),
30+
this.GeneralRedis.set(`mindmapState:${connectionId}`, JSON.stringify({})),
31+
this.GeneralRedis.set(`content:${connectionId}`, ''),
32+
]);
2933
return { connectionId, role: 'owner' };
3034
}
3135

@@ -39,7 +43,8 @@ export class ConnectionService {
3943

4044
async setConnection(mindmapId: number, userId: number) {
4145
const role = await this.userService.getRole(userId, mindmapId);
42-
if (!role) {
46+
this.logger.log(`role: ${role}`);
47+
if (role === undefined) {
4348
throw new ForbiddenException('๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค.');
4449
}
4550

0 commit comments

Comments
ย (0)