Skip to content

Commit 5a2025d

Browse files
committed
fix: redis 오류 수정
1 parent f619216 commit 5a2025d

File tree

8 files changed

+166
-153
lines changed

8 files changed

+166
-153
lines changed

apps/backend/src/app.module.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ import { TasksService } from './tasks/tasks.service';
3939
imports: [ConfigModule],
4040
inject: [ConfigService],
4141
useFactory: (configService: ConfigService) => ({
42-
type: 'postgres',
43-
host: configService.get('DB_HOST'),
44-
port: configService.get('DB_PORT'),
45-
username: configService.get('DB_USER'),
46-
password: configService.get('DB_PASSWORD'),
47-
database: configService.get('DB_NAME'),
42+
type: 'sqlite',
43+
database: 'db.sqlite',
44+
// type: 'postgres',
45+
// host: configService.get('DB_HOST'),
46+
// port: configService.get('DB_PORT'),
47+
// username: configService.get('DB_USER'),
48+
// password: configService.get('DB_PASSWORD'),
49+
// database: configService.get('DB_NAME'),
4850
entities: [Node, Page, Edge, User, Workspace, Role],
4951
logging: true,
5052
synchronize: true,

apps/backend/src/page/page.entity.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
CreateDateColumn,
99
UpdateDateColumn,
1010
VersionColumn,
11+
IsNull,
1112
} from 'typeorm';
1213
import { Node } from '../node/node.entity';
1314
import { Workspace } from '../workspace/workspace.entity';
@@ -17,10 +18,10 @@ export class Page {
1718
@PrimaryGeneratedColumn('increment')
1819
id: number;
1920

20-
@Column()
21+
@Column({ nullable: true })
2122
title: string;
2223

23-
@Column('json') //TODO: Postgres에서는 jsonb로 변경
24+
@Column('json', { nullable: true }) //TODO: Postgres에서는 jsonb로 변경
2425
content: JSON;
2526

2627
@CreateDateColumn()

apps/backend/src/redis/redis.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ export class RedisService {
99
private readonly redisClient: Redis;
1010

1111
constructor() {
12+
console.log('====================');
13+
console.log(process.env.REDIS_HOST);
14+
console.log(process.env.REDIS_PORT);
1215
this.redisClient = new Redis({
1316
host: process.env.REDIS_HOST,
1417
port: parseInt(process.env.REDIS_PORT),

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,21 @@ export class TasksService {
1616
console.log(await this.redisService.getAllKeys());
1717
const keys = await this.redisService.getAllKeys();
1818
const pages = [];
19-
19+
this.logger.log('스케줄러 시작');
2020
for await (const key of keys) {
2121
const { title, content } = await this.redisService.get(key);
22-
console.log('title,', title);
23-
console.log('content,', content);
2422
const jsonContent = JSON.parse(content);
2523
pages.push({
2624
id: key,
2725
title,
2826
content: jsonContent,
2927
version: 1,
3028
});
31-
// this.pageService.updatePage(parseInt(key), {
32-
// title,
33-
// content: jsonContent,
34-
// });
29+
this.pageService.updatePage(parseInt(key), {
30+
title,
31+
content: jsonContent,
32+
});
33+
this.logger.log('데이터베이스 갱신');
3534
}
3635
this.pageService.updateBulkPage(pages);
3736
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export class WorkspaceService {
3434
private readonly roleRepository: RoleRepository,
3535
private readonly tokenService: TokenService,
3636
) {
37-
console.log('환경 : ', process.env.NODE_ENV);
3837
if (process.env.NODE_ENV !== 'test') {
3938
this.initializeMainWorkspace();
4039
}

apps/backend/src/yjs/yjs.service.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ export class YjsService
7070
// 노드를 클릭해 페이지를 열었을 때만 해당 페이지 값을 가져와서 초기 데이터로 세팅해줍니다.
7171
if (customDoc.name?.startsWith('document-')) {
7272
const workspaceId = doc.guid;
73-
console.log('workspaceid', workspaceId);
7473
const pageId = parseInt(customDoc.name.split('-')[1]);
7574
const findPage = await this.pageService.findPageById(pageId);
7675

@@ -101,9 +100,9 @@ export class YjsService
101100
'content',
102101
JSON.stringify(yXmlFragmentToProsemirrorJSON(editorDoc)),
103102
);
104-
this.redisService.get(pageId.toString()).then((data) => {
105-
console.log(data);
106-
});
103+
// this.redisService.get(pageId.toString()).then((data) => {
104+
// console.log(data);
105+
// });
107106
});
108107
return;
109108
}
@@ -116,7 +115,10 @@ export class YjsService
116115
if (!customDoc.name?.startsWith('flow-room-')) {
117116
return;
118117
}
119-
const workspaceId = customDoc.name.split('-')[2];
118+
119+
// const workspaceId = customDoc.name.split('-')[2];
120+
// console.log('======', workspaceId);
121+
const workspaceId = 'main';
120122
const nodes = await this.nodeService.findNodesByWorkspace(workspaceId);
121123
const edges = await this.edgeService.findEdgesByWorkspace(workspaceId);
122124
const nodesMap = doc.getMap('nodes');
@@ -155,8 +157,6 @@ export class YjsService
155157
});
156158
// node의 변경 사항을 감지한다.
157159
nodesMap.observe(async (event) => {
158-
console.log('nodesmap', nodesMap.toJSON());
159-
console.log('노드 개수', event.changes.keys);
160160
for (const [key, change] of event.changes.keys) {
161161
if (change.action === 'update') {
162162
const node: any = nodesMap.get(key);

apps/frontend/src/routeTree.gen.ts

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -10,104 +10,104 @@
1010

1111
// Import Routes
1212

13-
import { Route as rootRoute } from "./routes/__root";
14-
import { Route as IndexImport } from "./routes/index";
15-
import { Route as JoinIndexImport } from "./routes/join/index";
16-
import { Route as WorkspaceWorkspaceIdImport } from "./routes/joinworkspace/$workspaceId";
13+
import { Route as rootRoute } from './routes/__root'
14+
import { Route as IndexImport } from './routes/index'
15+
import { Route as JoinIndexImport } from './routes/join/index'
16+
import { Route as WorkspaceWorkspaceIdImport } from './routes/workspace/$workspaceId'
1717

1818
// Create/Update Routes
1919

2020
const IndexRoute = IndexImport.update({
21-
id: "/",
22-
path: "/",
21+
id: '/',
22+
path: '/',
2323
getParentRoute: () => rootRoute,
24-
} as any);
24+
} as any)
2525

2626
const JoinIndexRoute = JoinIndexImport.update({
27-
id: "/join/",
28-
path: "/join/",
27+
id: '/join/',
28+
path: '/join/',
2929
getParentRoute: () => rootRoute,
30-
} as any);
30+
} as any)
3131

3232
const WorkspaceWorkspaceIdRoute = WorkspaceWorkspaceIdImport.update({
33-
id: "/workspace/$workspaceId",
34-
path: "/workspace/$workspaceId",
33+
id: '/workspace/$workspaceId',
34+
path: '/workspace/$workspaceId',
3535
getParentRoute: () => rootRoute,
36-
} as any);
36+
} as any)
3737

3838
// Populate the FileRoutesByPath interface
3939

40-
declare module "@tanstack/react-router" {
40+
declare module '@tanstack/react-router' {
4141
interface FileRoutesByPath {
42-
"/": {
43-
id: "/";
44-
path: "/";
45-
fullPath: "/";
46-
preLoaderRoute: typeof IndexImport;
47-
parentRoute: typeof rootRoute;
48-
};
49-
"/workspace/$workspaceId": {
50-
id: "/workspace/$workspaceId";
51-
path: "/workspace/$workspaceId";
52-
fullPath: "/workspace/$workspaceId";
53-
preLoaderRoute: typeof WorkspaceWorkspaceIdImport;
54-
parentRoute: typeof rootRoute;
55-
};
56-
"/join/": {
57-
id: "/join/";
58-
path: "/join";
59-
fullPath: "/join";
60-
preLoaderRoute: typeof JoinIndexImport;
61-
parentRoute: typeof rootRoute;
62-
};
42+
'/': {
43+
id: '/'
44+
path: '/'
45+
fullPath: '/'
46+
preLoaderRoute: typeof IndexImport
47+
parentRoute: typeof rootRoute
48+
}
49+
'/workspace/$workspaceId': {
50+
id: '/workspace/$workspaceId'
51+
path: '/workspace/$workspaceId'
52+
fullPath: '/workspace/$workspaceId'
53+
preLoaderRoute: typeof WorkspaceWorkspaceIdImport
54+
parentRoute: typeof rootRoute
55+
}
56+
'/join/': {
57+
id: '/join/'
58+
path: '/join'
59+
fullPath: '/join'
60+
preLoaderRoute: typeof JoinIndexImport
61+
parentRoute: typeof rootRoute
62+
}
6363
}
6464
}
6565

6666
// Create and export the route tree
6767

6868
export interface FileRoutesByFullPath {
69-
"/": typeof IndexRoute;
70-
"/workspace/$workspaceId": typeof WorkspaceWorkspaceIdRoute;
71-
"/join": typeof JoinIndexRoute;
69+
'/': typeof IndexRoute
70+
'/workspace/$workspaceId': typeof WorkspaceWorkspaceIdRoute
71+
'/join': typeof JoinIndexRoute
7272
}
7373

7474
export interface FileRoutesByTo {
75-
"/": typeof IndexRoute;
76-
"/workspace/$workspaceId": typeof WorkspaceWorkspaceIdRoute;
77-
"/join": typeof JoinIndexRoute;
75+
'/': typeof IndexRoute
76+
'/workspace/$workspaceId': typeof WorkspaceWorkspaceIdRoute
77+
'/join': typeof JoinIndexRoute
7878
}
7979

8080
export interface FileRoutesById {
81-
__root__: typeof rootRoute;
82-
"/": typeof IndexRoute;
83-
"/workspace/$workspaceId": typeof WorkspaceWorkspaceIdRoute;
84-
"/join/": typeof JoinIndexRoute;
81+
__root__: typeof rootRoute
82+
'/': typeof IndexRoute
83+
'/workspace/$workspaceId': typeof WorkspaceWorkspaceIdRoute
84+
'/join/': typeof JoinIndexRoute
8585
}
8686

8787
export interface FileRouteTypes {
88-
fileRoutesByFullPath: FileRoutesByFullPath;
89-
fullPaths: "/" | "/workspace/$workspaceId" | "/join";
90-
fileRoutesByTo: FileRoutesByTo;
91-
to: "/" | "/workspace/$workspaceId" | "/join";
92-
id: "__root__" | "/" | "/workspace/$workspaceId" | "/join/";
93-
fileRoutesById: FileRoutesById;
88+
fileRoutesByFullPath: FileRoutesByFullPath
89+
fullPaths: '/' | '/workspace/$workspaceId' | '/join'
90+
fileRoutesByTo: FileRoutesByTo
91+
to: '/' | '/workspace/$workspaceId' | '/join'
92+
id: '__root__' | '/' | '/workspace/$workspaceId' | '/join/'
93+
fileRoutesById: FileRoutesById
9494
}
9595

9696
export interface RootRouteChildren {
97-
IndexRoute: typeof IndexRoute;
98-
WorkspaceWorkspaceIdRoute: typeof WorkspaceWorkspaceIdRoute;
99-
JoinIndexRoute: typeof JoinIndexRoute;
97+
IndexRoute: typeof IndexRoute
98+
WorkspaceWorkspaceIdRoute: typeof WorkspaceWorkspaceIdRoute
99+
JoinIndexRoute: typeof JoinIndexRoute
100100
}
101101

102102
const rootRouteChildren: RootRouteChildren = {
103103
IndexRoute: IndexRoute,
104104
WorkspaceWorkspaceIdRoute: WorkspaceWorkspaceIdRoute,
105105
JoinIndexRoute: JoinIndexRoute,
106-
};
106+
}
107107

108108
export const routeTree = rootRoute
109109
._addFileChildren(rootRouteChildren)
110-
._addFileTypes<FileRouteTypes>();
110+
._addFileTypes<FileRouteTypes>()
111111

112112
/* ROUTE_MANIFEST_START
113113
{

0 commit comments

Comments
 (0)