Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a15ed6b

Browse files
authored
Merge pull request #241 from boostcampwm-2024/dev
[6주차 배포-fix]
2 parents 5849997 + e79599b commit a15ed6b

File tree

10 files changed

+27
-9
lines changed

10 files changed

+27
-9
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

‎BE/apps/api-server/src/modules/user/user.controller.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Controller, Get, UseGuards } from '@nestjs/common';
1+
import { Controller, Get, UnauthorizedException,UseGuards } from '@nestjs/common';
22
import { UserService } from './user.service';
33
import { AuthGuard } from '@nestjs/passport';
44
import { User } from '../../decorators';
@@ -10,6 +10,10 @@ export class UserController {
1010
@Get('info')
1111
@UseGuards(AuthGuard('jwt'))
1212
async getUserInfo(@User() user) {
13-
return await this.userService.getUserInfo(user.id);
13+
try {
14+
return await this.userService.getUserInfo(user.id);
15+
} catch {
16+
throw new UnauthorizedException();
17+
}
1418
}
1519
}

‎client/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html lang="en">
2+
<html lang="ko">
33
<head>
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/logo.png" />

‎client/src/api/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ instance.interceptors.response.use(
5858
originalRequest.headers["Authorization"] = `Bearer ${newAccessToken.accessToken}`;
5959
return instance(originalRequest);
6060
} catch (error) {
61+
await signOut();
62+
useConnectionStore.getState().logout();
6163
return Promise.reject(error);
6264
}
6365
}

‎client/src/konva_mindmap/utils/nodeAttrs.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const TEXT_WIDTH = (depth: number) => NODE_DEFAULT_SIZE * 2 - depth * 18;
1010

1111
//CONNECTED_LINE
1212
export const CONNECTED_LINE_FROM = (depth: number) => NODE_DEFAULT_SIZE - depth * 7 + 10;
13-
export const CONNECTED_LINE_TO = (depth: number) => NODE_DEFAULT_SIZE - depth * 7 + 5;
13+
export const CONNECTED_LINE_TO = (depth: number) => NODE_DEFAULT_SIZE - depth * 7 + 3;
1414

1515
//TEXT
1616
export const TEXT_FONT_SIZE = 16;

‎client/src/store/createAuthSlice.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const createAuthSlice: StateCreator<ConnectionStore, [], [], AuthSlice> =
2222
logout: () => {
2323
set({ email: null, name: null, token: "" });
2424
get().resetOwnedMindMap();
25+
location.href = "/";
2526
},
2627

2728
setUser: (email: string, name: string, id: number) => {

‎client/src/store/createSharedSlice.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const createSharedSlice: StateCreator<ConnectionStore, [], [], SharedSlic
2020
get().token
2121
? get().addOwnedMindMap(newMindMapConnectionId)
2222
: get().addOwnedMindMapForGuest(newMindMapConnectionId);
23+
get().connectSocket(newMindMapConnectionId);
2324
navigate(`/mindmap/${newMindMapConnectionId}?mode=${targetMode}`);
2425
} catch (error) {
2526
throw error;

‎client/src/store/createSocketSlice.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export const createSocketSlice: StateCreator<ConnectionStore, [], [], SocketSlic
103103
if (socket) socket.disconnect();
104104
const response = await createMindmap();
105105
const connectionId = response.data.connectionId;
106-
get().connectSocket(connectionId);
107106
return connectionId;
108107
} catch (error) {
109108
throw error;

‎client/src/utils/formData.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
export function audioFormData(file: File, mindmapId: string, connectionId: string) {
22
const formData = new FormData();
3-
formData.append("aiAudio", file);
3+
4+
const encodedFileName = encodeURIComponent(file.name);
5+
const encodedFile = new File([file], encodedFileName, { type: file.type });
6+
7+
formData.append("aiAudio", encodedFile);
48
formData.append("mindmapId", mindmapId);
59
formData.append("connectionId", connectionId);
10+
611
return formData;
712
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /