Skip to content

Commit f30c02c

Browse files
Merge pull request #407 from boostcampwm-2024/bug-be-#398
각종 이슈 해결
2 parents 4804ab2 + dd1b1e4 commit f30c02c

File tree

9 files changed

+34
-101
lines changed

9 files changed

+34
-101
lines changed

apps/backend/src/app.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class AppController {
1414
healthCheck() {
1515
return {
1616
status: 'ok',
17-
timestamp: new Date().toISOString()
17+
timestamp: new Date().toISOString(),
1818
};
1919
}
2020
}

apps/backend/src/page/page.service.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,10 @@ export class PageService {
3535
*/
3636
async createPage(dto: CreatePageDto): Promise<Page> {
3737
const { title, content, workspaceId, x, y, emoji } = dto;
38-
3938
// 워크스페이스 DB에서 해당 워크스페이스의 내부 id를 찾는다
4039
const workspace = await this.workspaceRepository.findOneBy({
4140
snowflakeId: workspaceId,
4241
});
43-
4442
if (!workspace) {
4543
throw new WorkspaceNotFoundException();
4644
}

apps/backend/src/tasks/tasks.service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,19 @@ export class TasksService {
179179

180180
const fromNode = await nodeRepository.findOne({
181181
where: { id: redisData.fromNode },
182+
relations: ['workspace'],
182183
});
183184

184185
const toNode = await nodeRepository.findOne({
185186
where: { id: redisData.toNode },
186187
});
187188

188189
if (redisData.type === 'add') {
189-
await edgeRepository.save({ fromNode, toNode });
190+
await edgeRepository.save({
191+
fromNode,
192+
toNode,
193+
workspace: fromNode.workspace,
194+
});
190195
}
191196

192197
if (redisData.type === 'delete') {

apps/backend/src/workspace/workspace.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { RoleModule } from '../role/role.module';
99
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
1010
import { TokenModule } from '../auth/token/token.module';
1111
import { TokenService } from '../auth/token/token.service';
12-
import { ConfigModule } from '@nestjs/config';
12+
import { ConfigModule } from '@nestjs/config';
1313

1414
@Module({
1515
imports: [

apps/backend/src/workspace/workspace.service.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export class WorkspaceService {
216216
// 권한이 없으면 예외 발생
217217
throw new ForbiddenAccessException();
218218
}
219-
219+
220220
return {
221221
workspaceId: workspace.snowflakeId,
222222
title: workspace.title,
@@ -227,7 +227,6 @@ export class WorkspaceService {
227227
};
228228
}
229229

230-
231230
/**
232231
* 가장 처음에 모두가 접속할 수 있는 main workspace를 생성한다.
233232
*/
@@ -284,9 +283,9 @@ export class WorkspaceService {
284283
workspace: findWorkspace,
285284
user: findOwner,
286285
role: 'owner',
287-
});}
286+
});
288287
}
289-
288+
}
290289

291290
async updateVisibility(
292291
userId: number,

apps/websocket/src/app.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class AppController {
99
healthCheck() {
1010
return {
1111
status: 'ok',
12-
timestamp: new Date().toISOString()
12+
timestamp: new Date().toISOString(),
1313
};
1414
}
1515
}

apps/websocket/src/yjs/yjs.service.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ export class YjsService
130130
const edgeResponse = await axios.get(
131131
`http://backend:3000/api/edge/workspace/${workspaceId}`,
132132
);
133+
134+
if (nodeResponse.status === 404 || edgeResponse.status === 404) {
135+
this.logger.error('워크 스페이스가 존재하지 않습니다.');
136+
return;
137+
}
133138
const edges = edgeResponse.data.edges;
134139

135140
const nodesMap = doc.getMap('nodes');
@@ -258,6 +263,19 @@ export class YjsService
258263
) {
259264
for (const [key, change] of event.changes.keys) {
260265
// TODO: change.action이 'add', 'delete'일 때 처리를 추가하여 REST API 사용 제거
266+
// if (change.action === 'add') {
267+
// const node = nodesMap.get(key);
268+
// const { title, id, emoji } = node.data;
269+
// const { x, y } = node.position;
270+
// axios.post('http://backend:3000/api/page', {
271+
// title,
272+
// content,
273+
// workspaceId,
274+
// x,
275+
// y,
276+
// emoji,
277+
// });
278+
// }
261279
if (change.action !== 'update') continue;
262280

263281
const node: any = nodesMap.get(key);
@@ -272,6 +290,10 @@ export class YjsService
272290
const pageResponse = await axios.get(
273291
`http://backend:3000/api/page/${id}`,
274292
);
293+
if (pageResponse.status === 404) {
294+
this.logger.error('페이지가 존재하지 않습니다.');
295+
return;
296+
}
275297
const findPage = pageResponse.data.page;
276298

277299
await this.redisService.setField(`node:${findPage.node.id}`, 'x', x);

services/nginx/conf.d/prod_nginx.conf

Lines changed: 0 additions & 77 deletions
This file was deleted.

services/nginx/conf.d/prod_nginx_init.conf

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)