Skip to content

Commit 316e35e

Browse files
committed
Merge branch 'development'
2 parents eba2482 + 54018d1 commit 316e35e

File tree

12 files changed

+30
-14
lines changed

12 files changed

+30
-14
lines changed

infrastructure/Pulumi.production.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
config:
22
aws:region: ap-northeast-2
33
velog:DOCKER_ENV: production
4-
velog:target: server,web
4+
velog:target: cron

infrastructure/Pulumi.stage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
config:
22
aws:region: ap-northeast-2
33
velog:DOCKER_ENV: stage
4-
velog:target: web
4+
velog:target: server

infrastructure/src/lib/ecsOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const serverProdEcsOption: EcsBaseOption = {
2929
cpu: 1, // unit 1024
3030
memory: 2, // unit 1024
3131
maxCapacity: 12,
32-
minCapacity: 1,
32+
minCapacity: 2,
3333
}
3434

3535
const serverStageEcsOption: EcsBaseOption = {

packages/velog-cron/src/services/StatsService/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ export class StatsService implements Service {
3636

3737
await this.discord.sendMessage(
3838
'stats',
39-
`[Daily]\n기간: ${format(
39+
`[Daily]\n${format(
4040
start,
4141
'yyyy-MM-dd',
42-
)}\n${usersCount}명의 사용자가 가입했습니다.\n${postCount}개의 공개 포스트가 작성되었습니다.`,
42+
)} 동안\n${usersCount}명의 사용자가 가입했습니다.\n${postCount}개의 공개 포스트가 작성되었습니다.`,
4343
)
4444
}
4545
public async weekly() {
@@ -53,10 +53,10 @@ export class StatsService implements Service {
5353
const timeFormat = 'yyyy-MM-dd HH:mm:ss'
5454
await this.discord.sendMessage(
5555
'stats',
56-
`[Daily]\n기간: ${format(start, timeFormat)}-${format(
56+
`[Weekly]\n${format(start, timeFormat)}-${format(
5757
end,
58-
'HH:mm:ss',
59-
)}\n${usersCount}명의 사용자가 가입했습니다.\n${postCount}개의 공개 포스트가 작성되었습니다.`,
58+
timeFormat,
59+
)} 동안\n${usersCount}명의 사용자가 가입했습니다.\n${postCount}개의 공개 포스트가 작성되었습니다.`,
6060
)
6161
}
6262
public async monthly() {

packages/velog-scripts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"type": "module",
99
"scripts": {
10-
"private:posts": "pnpm env:copy -e development && ts-node ./scripts/privatePostsOfSpamAccount.mts",
10+
"private:posts": "pnpm env:copy -e development && node --loader ts-node/esm ./scripts/privatePostsOfSpamAccount.mts",
1111
"check:gql": "pnpm prisma:copy && pnpm env:copy -e development && ts-node ./scripts/checkGql.mts",
1212
"restore:posts": "pnpm env:copy -e development && pnpm prisma:copy && ts-node ./scripts/restorePosts.mts",
1313
"add:bannedKeyword": "pnpm env:copy -e development && pnpm prisma:copy && ts-node ./scripts/addBannedKeywords.mts",

packages/velog-scripts/scripts/privatePostsOfSpamAccount.mts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import inquirer from 'inquirer'
66
import { ENV } from '../env/env.mjs'
77
import { DiscordService } from '../lib/discord/DiscordService.mjs'
88
import { BlockListService } from '../lib/blockList/BlockListService.mjs'
9-
9+
import { format } from 'date-fns'
1010
interface IRunner {}
1111

1212
@injectable()
@@ -42,6 +42,7 @@ class Runner implements IRunner {
4242
user.id,
4343
username,
4444
user.profile?.display_name || null,
45+
user.created_at,
4546
)
4647

4748
if (!askResult.is_set_private) continue
@@ -136,6 +137,7 @@ class Runner implements IRunner {
136137
userId: string,
137138
username: string,
138139
displayName: string | null,
140+
createdAt: Date,
139141
): Promise<AskDeletePostsResult> {
140142
const blockedList = await this.blockList.readBlockList()
141143
if (blockedList.includes(username)) {
@@ -149,6 +151,7 @@ class Runner implements IRunner {
149151
id: userId,
150152
username: username,
151153
displayName: displayName ?? '',
154+
'가입 날짜': format(createdAt, 'yyyy-MM-dd'),
152155
'업데이트 될 글 개수': posts.length,
153156
'최근 작성된 글': posts.slice(0, 5).map((post) => ({
154157
title: post.title,

packages/velog-scripts/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"include": ["./scripts", ".eslintrc.cjs", "./lib", "./env", "./data"],
1818
"exclude": [],
1919
"ts-node": {
20-
"transpileOnly": true,
21-
"esm": true
20+
"transpileOnly": true
2221
}
2322
}

packages/velog-server/src/common/plugins/global/authPlugin.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const authPlugin: FastifyPluginAsync = async (fastify) => {
1313

1414
const userService = container.resolve(UserService)
1515
const jwt = container.resolve(JwtService)
16+
const cookie = container.resolve(CookieService)
1617

1718
let accessToken: string | undefined = request.cookies['access_token']
1819
const refreshToken: string | undefined = request.cookies['refresh_token']
@@ -34,6 +35,14 @@ const authPlugin: FastifyPluginAsync = async (fastify) => {
3435
await userService.restoreToken({ request, reply })
3536
}
3637

38+
// const user = await userService.findById(accessTokenData.user_id)
39+
40+
// if (!user) {
41+
// cookie.clearCookie(reply, 'access_token')
42+
// cookie.clearCookie(reply, 'refresh_token')
43+
// throw new Error('User not found')
44+
// }
45+
3746
request.user = { id: accessTokenData.user_id }
3847
return
3948
}
@@ -62,7 +71,6 @@ const authPlugin: FastifyPluginAsync = async (fastify) => {
6271
}
6372
} catch (error) {
6473
console.log('refresh token error', error)
65-
const cookie = container.resolve(CookieService)
6674
cookie.clearCookie(reply, 'access_token')
6775
cookie.clearCookie(reply, 'refresh_token')
6876
}

packages/velog-server/src/common/plugins/global/errorHandlerPlugin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const errorHandlerPlugin: FastifyPluginCallback = (fastify, _, done) => {
2323
query: request?.query || 'none',
2424
error,
2525
user: request?.user,
26+
ip: request?.ip,
2627
}),
2728
)
2829
.catch(console.error)
@@ -56,6 +57,7 @@ const errorHandlerPlugin: FastifyPluginCallback = (fastify, _, done) => {
5657
requestbody: request?.body,
5758
error,
5859
user: request?.user,
60+
ip: request?.ip,
5961
}),
6062
)
6163
.catch(console.error)

packages/velog-server/src/common/plugins/global/mercuriusPlugin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const mercuriusPlugin: FastifyPluginAsync = async (fastify) => {
4545
requestbody: request?.body,
4646
result,
4747
user: request?.user,
48+
ip: request?.ip,
4849
}),
4950
)
5051
.catch(console.error)
@@ -65,6 +66,7 @@ const mercuriusPlugin: FastifyPluginAsync = async (fastify) => {
6566
requestbody: (ctx as any).request?.body,
6667
execution,
6768
user: (ctx as any).request?.user,
69+
ip: (ctx as any).request?.ip,
6870
}),
6971
)
7072
.catch(console.error)

0 commit comments

Comments
 (0)