Skip to content

Commit

Permalink
feat: hCode 및 전체 목록 조회 API 수정사항 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
June1010 committed Nov 24, 2022
1 parent ca756c4 commit 0ce2df9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion server/src/common/type/raw-recruit-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ export interface RawRecruitData {
course_img: string;
course_path: string;
course_pathLength: number;
course_hCode: string;
course_name: string;
course_createdAt: Date;
id: number;
title: string;
startTime: Date;
maxPpl: number;
currentPpl: string;
userId: number;
createdAt: Date;
}
4 changes: 2 additions & 2 deletions server/src/entities/recruit.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class Recruit {
pace: number;

@Column({ type: "varchar", length: 10 })
hCode: string;
name: string;

@CreateDateColumn()
createdAt: Date;
Expand Down Expand Up @@ -69,7 +69,7 @@ export class Recruit {
recruit.startTime = startTime;
recruit.maxPpl = maxPpl;
recruit.pace = pace;
recruit.hCode = hCode;
recruit.name = hCode;
recruit.userId = userId;
recruit.courseId = courseId;
return recruit;
Expand Down
3 changes: 3 additions & 0 deletions server/src/recruit/recruit.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ export class RecruitRepository extends Repository<Recruit> {
return this.createQueryBuilder("recruit")
.innerJoinAndSelect("recruit.course", "course")
.leftJoinAndSelect("recruit.userRecruits", "user_recruit")
.innerJoinAndSelect("recruit.user", "user")
.select([
"recruit.id AS id",
"recruit.title AS title",
"recruit.startTime AS startTime",
"recruit.maxPpl AS maxPpl",
"recruit.createdAt AS createdAt",
"user.userId AS userId",
"COUNT(user_recruit.id) AS currentPpl",
"course.id",
"course.title",
Expand Down
10 changes: 8 additions & 2 deletions server/src/recruit/recruit.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ export class RecruitService {
startTime,
maxPpl,
currentPpl,
createdAt,
userId,
course_id,
course_title,
course_img,
course_path,
course_pathLength,
course_hCode,
course_name,
course_createdAt,
}) => {
return {
Expand All @@ -34,13 +36,17 @@ export class RecruitService {
startTime,
maxPpl,
currentPpl: parseInt(currentPpl),
userId,
createdAt,
course: {
id: course_id,
title: course_title,
img: course_img,
path: JSON.parse(course_path),
pathLength: course_pathLength,
hCode: course_hCode,
hDong: {
course_name,
},
createdAt: course_createdAt,
},
};
Expand Down

0 comments on commit 0ce2df9

Please sign in to comment.