Skip to content

Commit fb9ccac

Browse files
committed
refactor: initialize data for post apis
1 parent aa1689e commit fb9ccac

File tree

5 files changed

+148
-217
lines changed

5 files changed

+148
-217
lines changed

packages/velog-server/src/services/DynamicConfigService/index.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@ import { RedisService } from '@lib/redis/RedisService.js'
22
import { injectable, singleton } from 'tsyringe'
33

44
interface Service {
5-
readBlockUserList(): Promise<string[]>
65
checkBlockedUser(username: string): Promise<boolean>
76
}
87

98
@injectable()
109
@singleton()
1110
export class DynamicConfigService implements Service {
1211
constructor(private readonly redis: RedisService) {}
13-
public async readBlockUserList(): Promise<string[]> {
14-
const keyname = this.redis.setName.blockList
15-
const list = await this.redis.smembers(keyname)
16-
return list
17-
}
1812
public async checkBlockedUser(username: string = ''): Promise<boolean> {
1913
const list = await this.readBlockUserList()
2014
const isBlocked = list.includes(username)
2115
return isBlocked
2216
}
17+
private async readBlockUserList(): Promise<string[]> {
18+
const keyname = this.redis.setName.blockList
19+
const list = await this.redis.smembers(keyname)
20+
return list
21+
}
2322
}

packages/velog-server/src/services/ExternalIntegrationService/ExternalIntegrationInterface.ts

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

packages/velog-server/src/services/ExternalIntegrationService/index.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { JwtService } from '@lib/jwt/JwtService.js'
55
import { Time } from '@constants/TimeConstants.js'
66
import { ENV } from '@env'
77
import axios from 'axios'
8-
import { IntegrationTokenData, NotifyParams } from './ExternalIntegrationInterface.js'
98
import { UnauthorizedError } from '@errors/UnauthorizedError.js'
9+
import { SerializePost } from '@services/PostService/index.js'
1010

1111
interface Service {
1212
createIntegrationCode(userId: string): Promise<string>
@@ -114,3 +114,19 @@ export class ExternalIntegrationService implements Service {
114114
.catch(console.error)
115115
}
116116
}
117+
118+
export type IntegrationTokenData = {
119+
integrated_user_id: string
120+
type: 'integration'
121+
app_identifier: 'codenary'
122+
}
123+
124+
export type NotifyParams =
125+
| {
126+
type: 'created' | 'updated'
127+
post: SerializePost
128+
}
129+
| {
130+
type: 'deleted'
131+
post_id: string
132+
}

0 commit comments

Comments
 (0)