Skip to content

Commit

Permalink
fix: 관심사의 id로 쿼리하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Coalery committed Oct 28, 2023
1 parent a3b412c commit 0c946a1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/application/user/query/IUserQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { UserState } from '@sight/app/domain/user/model/constant';

export type ListUserParams = {
state: UserState | null;
interest: string | null;
interestId: string | null;
limit: number;
offset: number;
};
Expand Down
2 changes: 1 addition & 1 deletion src/app/application/user/query/listUser/ListUserQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { UserState } from '@sight/app/domain/user/model/constant';
export class ListUserQuery implements IQuery {
constructor(
readonly state: UserState | null,
readonly interest: string | null,
readonly interestId: string | null,
readonly limit: number,
readonly offset: number,
) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('ListUserQueryHandler', () => {
let listView: UserListView;

const state = UserState.UNDERGRADUATE;
const interest = '관심사';
const interestId = 'interestId';
const limit = 5;
const offset = 0;

Expand All @@ -40,21 +40,21 @@ describe('ListUserQueryHandler', () => {
});

test('파라미터를 의도대로 쿼리에 넘겨주어야 한다', async () => {
const query = new ListUserQuery(state, interest, limit, offset);
const query = new ListUserQuery(state, interestId, limit, offset);

await listUserQueryHandler.execute(query);

expect(userQuery.listUser).toBeCalledTimes(1);
expect(userQuery.listUser).toBeCalledWith({
state,
interest,
interestId,
limit,
offset,
});
});

test('유저 목록 뷰를 의도대로 반환해야 한다', async () => {
const query = new ListUserQuery(state, interest, limit, offset);
const query = new ListUserQuery(state, interestId, limit, offset);

const queryResult = await listUserQueryHandler.execute(query);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export class ListUserQueryHandler
) {}

async execute(query: ListUserQuery): Promise<ListUserQueryResult> {
const { state, interest, limit, offset } = query;
const { state, interestId, limit, offset } = query;

const listView = await this.userQuery.listUser({
state,
interest,
interestId,
limit,
offset,
});
Expand Down

0 comments on commit 0c946a1

Please sign in to comment.