Skip to content

Commit 2c5388c

Browse files
committed
refactor: ♻️ 팔로우 리스트에 limit 추가
- #406
1 parent 8276894 commit 2c5388c

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

app/src/follow/follow.resolve.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ export class FollowResolver {
7070
async getFollowerList(
7171
@MyUserId() userId: number,
7272
@Args('target') target: string,
73+
@Args('limit', { defaultValue: 3 }) limit: number,
7374
): Promise<FollowListWithCount> {
7475
const followerList = await this.followService.getFollowerList(
7576
userId,
7677
target,
78+
limit,
7779
);
7880
const count = await this.followService.getFollowerCount(target);
7981

@@ -88,10 +90,12 @@ export class FollowResolver {
8890
async getFollowingList(
8991
@MyUserId() userId: number,
9092
@Args('target') target: string,
93+
@Args('limit', { defaultValue: 3 }) limit: number,
9194
): Promise<FollowListWithCount> {
9295
const followingList = await this.followService.getFollowingList(
9396
userId,
9497
target,
98+
limit,
9599
);
96100
const count = await this.followService.getFollowingCount(target);
97101

app/src/follow/follow.service.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ export class FollowService {
9494
}
9595

9696
// getFollowerList("yeju") -> yeju를 팔로우 하는 사람들
97-
async getFollowerList(userId: number, target: string): Promise<FollowList[]> {
97+
async getFollowerList(
98+
userId: number,
99+
target: string,
100+
limit: number,
101+
): Promise<FollowList[]> {
98102
//target의 id
99103
const targetId = await this.cursusUserService.getuserIdByLogin(target);
100104

@@ -106,6 +110,7 @@ export class FollowService {
106110
const follower: follow[] = await this.findAllAndLean({
107111
filter: { followId: targetId },
108112
sort: { _id: 'desc' },
113+
limit,
109114
});
110115

111116
const followerUserPreview: UserPreview[] = await Promise.all(
@@ -136,6 +141,7 @@ export class FollowService {
136141
async getFollowingList(
137142
userId: number,
138143
target: string,
144+
limit: number,
139145
): Promise<FollowList[]> {
140146
const targetId = await this.cursusUserService.getuserIdByLogin(target);
141147

@@ -147,6 +153,7 @@ export class FollowService {
147153
const following: follow[] = await this.findAllAndLean({
148154
filter: { userId: targetId },
149155
sort: { _id: 'desc' },
156+
limit,
150157
});
151158

152159
const followingUserPreview: UserPreview[] = await Promise.all(

app/src/schema.gql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ type Query {
631631
getEvalLogs(after: String, first: Int! = 20, corrector: String, corrected: String, projectName: String, outstandingOnly: Boolean! = false, imperfectOnly: Boolean! = false, sortOrder: EvalLogSortOrder! = BEGIN_AT_DESC): EvalLogsPaginated!
632632
getSetting: Setting!
633633
getExpTable: [ExpTable!]!
634-
getFollowerList(target: String!): FollowListWithCount!
635-
getFollowingList(target: String!): FollowListWithCount!
634+
getFollowerList(target: String!, limit: Int! = 3): FollowListWithCount!
635+
getFollowingList(target: String!, limit: Int! = 3): FollowListWithCount!
636636
}
637637

638638
enum EvalLogSortOrder {

0 commit comments

Comments
 (0)