Skip to content

Commit

Permalink
Merge pull request #315 from boostcampwm2023/BE-FindPostListById-#310
Browse files Browse the repository at this point in the history
[BE/#310] 작성자 id로 게시글 검색 구현
  • Loading branch information
namewhat99 authored Dec 5, 2023
2 parents 105d80f + e9e9596 commit 2f466c8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions BE/src/post/post.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import { PostListDto } from './dto/postList.dto';
import { BlockUserEntity } from '../entities/blockUser.entity';
import { BlockPostEntity } from '../entities/blockPost.entity';

interface WhereOption {
is_request?: boolean;
user_hash?: string;
}
@Injectable()
export class PostService {
constructor(
Expand All @@ -25,11 +29,14 @@ export class PostService {
private blockPostRepository: Repository<BlockPostEntity>,
private s3Handler: S3Handler,
) {}
makeWhereOption(query: PostListDto) {
const where = { is_request: undefined };
makeWhereOption(query: PostListDto): WhereOption {
const where: WhereOption = {};
if (query.requestFilter !== undefined) {
where.is_request = query.requestFilter !== 0;
}
if (query.writer !== undefined) {
where.user_hash = query.writer;
}
return where;
}

Expand Down

0 comments on commit 2f466c8

Please sign in to comment.