Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
fix : 검색 결과에 사용자 본인 안뜨도록
Browse files Browse the repository at this point in the history
where 조건 수정
  • Loading branch information
yewonahn committed Feb 11, 2024
1 parent 48d0565 commit c12aa97
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/rule/rule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { S3UtilService} from "../utils/S3.service";
import { GetMemberListDto} from "./dto/get-member-list.dto";
import {UserService} from "../user/user.service";
import {GetRuleListDto, MemberPairDto} from "./dto/get-rule-list.dto";
import {LessThan, Like} from "typeorm";
import {Equal, LessThan, Like, Not} from "typeorm";
import {GetSearchMemberDto} from "./dto/get-search-member.dto";
import {UpdateRuleDto} from "./dto/update-rule.dto";
import {CursorPageOptionsDto} from "../mate/cursor-page/cursor-page-option.dto";
Expand Down Expand Up @@ -283,7 +283,10 @@ export class RuleService {
// 해당 결과값을 name 혹은 nickName 에 포함하고 있는 사용자 찾기
console.log('검색 값: ', searchTerm);
const resultUsers = await UserEntity.find({
where: [{ name: Like(`%${searchTerm}%`) }, { nickname: Like(`%${searchTerm}%`) }],
where: [
{ name: Like(`%${searchTerm}%`) },
{ nickname: Like(`%${searchTerm}%`)},
{ id: Not(Equal(userId)) }], // 사용자 본인은 검색결과에 뜨지 않도록
relations: {profileImage : true, ruleParticipate: true}
});

Expand Down

0 comments on commit c12aa97

Please sign in to comment.