Skip to content

Commit 049a781

Browse files
committed
fix: create mock script for book
1 parent e553054 commit 049a781

File tree

12 files changed

+168
-38
lines changed

12 files changed

+168
-38
lines changed

apps/book-server/scripts/createMock.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class Seeder {
107107
}
108108

109109
const main = async () => {
110-
const mongo = new MongoService({ datasourceUrl: process.env.MONGO_URL })
110+
const mongo = new MongoService()
111111
const seeder = new Seeder(mongo)
112112

113113
try {
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { injectable, singleton } from 'tsyringe'
22
import { PrismaClient } from '@packages/database/velog-book-mongo'
3+
import { ENV } from '@env'
34

45
@injectable()
56
@singleton()
6-
export class MongoService extends PrismaClient {}
7+
export class MongoService extends PrismaClient {
8+
constructor() {
9+
super({ datasourceUrl: ENV.mongoUrl })
10+
}
11+
}

apps/book-server/test/mock/mockBook.mts

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,27 @@ export const getMockPages = (count: number) =>
88
return {
99
title: 'Introduction',
1010
index: index,
11+
type: 'page',
1112
body: `# Introduction_${index}
1213
- ${faker.lorem.paragraph(2)}
1314
- ${faker.lorem.paragraph(1)}
1415
- [${faker.lorem.words(2)}](${faker.internet.url()})
15-
`,
16-
type: 'page',
16+
\`\`\`js filename="demo.js" {4} copy
17+
import { useState } from 'react'
18+
19+
export const Counter = () => {
20+
const [count, setCount] = useState(0)
21+
return (
22+
<div>
23+
<button onClick={() => setCount(count + 1)} className={styles.counter}>
24+
Clicked {count} times
25+
</button>
26+
</div>
27+
)
28+
}
29+
\`\`\`
30+
![](${faker.image.url()})
31+
`.replaceAll(' ', ''),
1732
}
1833
}
1934

@@ -69,26 +84,7 @@ export const getMockPages = (count: number) =>
6984
- ${faker.lorem.paragraph(1)}
7085
7186
${faker.lorem.paragraphs(2)}
72-
73-
${
74-
index === 0 &&
75-
`
76-
\`\`\`js filename="demo.js" {4} copy
77-
import { useState } from 'react'
78-
79-
export const Counter = () => {
80-
const [count, setCount] = useState(0)
81-
return (
82-
<div>
83-
<button onClick={() => setCount(count + 1)} className={styles.counter}>
84-
Clicked {count} times
85-
</button>
86-
</div>
87-
)
88-
}
89-
\`\`\`
90-
`
91-
}
87+
9288
`.replaceAll(' ', ''),
9389
}
9490
})

apps/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"ajv": "^8.12.0",
4747
"axios": "^1.4.0",
4848
"backblaze-b2": "^1.7.0",
49-
"dataloader": "^2.2.2",
49+
"dataloader": "^2.2.2",
5050
"date-fns": "^2.30.0",
5151
"date-fns-tz": "^2.0.0",
5252
"discord.js": "^14.14.1",

apps/web/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"@sentry/browser": "^7.75.0",
3131
"@tanstack/react-query": "^5.29.0",
3232
"axios": "^1.4.0",
33-
"codemirror": "5.51",
33+
"codemirror5": "npm:codemirror@5",
34+
"codemirror": "npm:codemirror@6",
3435
"date-fns": "^2.30.0",
3536
"date-fns-tz": "^2.0.0",
3637
"dotenv": "^16.3.1",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.block {
2+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import MarkdownRender2 from './MarkdownRender2'
2+
import { render } from '@testing-library/react'
3+
4+
describe('MarkdownRender2', () => {
5+
it('renders successfully', () => {
6+
render(<MarkdownRender2 />)
7+
})
8+
})
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use client'
2+
3+
import styles from './MarkdownRender2.module.css'
4+
import { bindClassNames } from '@/lib/styles/bindClassNames'
5+
6+
const cx = bindClassNames(styles)
7+
8+
type Props = {}
9+
10+
function MarkdownRender2({}: Props) {
11+
return <div className={cx('block')}></div>
12+
}
13+
14+
export default MarkdownRender2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './MarkdownRender2'

packages/not-shared/lib/db/DbService.mts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ import { injectable, singleton } from 'tsyringe'
33

44
@injectable()
55
@singleton()
6-
export class DbService extends PrismaClient {}
6+
export class DbService extends PrismaClient {
7+
constructor() {
8+
super({ datasourceUrl: process.env.DATABASE_URL })
9+
}
10+
}

packages/not-shared/scripts/privatePostsOfSpamAccount.mts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,6 @@ class Runner implements IRunner {
147147
displayName: string | null,
148148
createdAt: Date,
149149
): Promise<AskDeletePostsResult> {
150-
const blockedList = await this.blockList.readBlockList()
151-
if (blockedList.includes(username)) {
152-
return {
153-
posts,
154-
is_set_private: true,
155-
}
156-
}
157-
158150
console.log({
159151
id: userId,
160152
username: username,

pnpm-lock.yaml

Lines changed: 110 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)