Skip to content

Commit

Permalink
hotfix: clear v0.3 bogs
Browse files Browse the repository at this point in the history
  • Loading branch information
gchoi96 committed Dec 14, 2022
1 parent c85db58 commit a299010
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 21 deletions.
5 changes: 3 additions & 2 deletions client/src/components/Card/RecruitCard/RecruitCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { timeDifference } from "#utils/cardUtils";

interface RecruitCardProps {
data: Recruit;
userIdVisible?: boolean;
}

const RecruitCard = ({ data }: RecruitCardProps) => {
const RecruitCard = ({ data, userIdVisible = true }: RecruitCardProps) => {
return (
<Card to={`/recruit/${data.id}`} path={data.course.path}>
<SummaryHead>
Expand All @@ -30,7 +31,7 @@ const RecruitCard = ({ data }: RecruitCardProps) => {
<img width="14" height="14" alt="CLOCK_ICON" src={CLOCK_ICON} />
<span>{timeDifference(data.startTime)}</span>
</div>
<UserIdLabel>{data.userId}</UserIdLabel>
<UserIdLabel>{userIdVisible && data.userId}</UserIdLabel>
</SummaryBody>
</Card>
);
Expand Down
7 changes: 6 additions & 1 deletion client/src/components/CardList/CourseList/CorseList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ const CorseList = ({ distance, query, authorFilter, titleFilter }: CourseListPro
const { data, fetchNextPage, hasNextPage } = useCoursesQuery({ distance, query, authorFilter, titleFilter });

return (
<InfiniteScroll loadMore={() => fetchNextPage()} hasMore={hasNextPage} loader={<CardLoader />}>
<InfiniteScroll
loadMore={() => fetchNextPage()}
hasMore={hasNextPage}
loader={<CardLoader />}
useWindow={false}
>
<CardWrapper>
{data?.pages.map((page, pageIdx) =>
page?.map((card, idx) => <CourseCard data={card} key={`${pageIdx}_${idx}`} />),
Expand Down
1 change: 1 addition & 0 deletions client/src/components/CardList/RecruitList/RecruitList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const RecruitList = (props: RecruitListProps) => {
<CardLoader />
</div>
}
useWindow={false}
>
<CardWrapper>
{data?.pages.map((page, pageIdx) =>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Layout/Layout.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const Container = styled.div`
> div:last-child {
background-color: ${COLOR.WHITE};
position: relative;
height: 100vh;
overflow-y: scroll;
}
@media screen and (min-width: 480px) {
${flexRowCenter};
Expand All @@ -38,8 +40,6 @@ export const Container = styled.div`
box-shadow: 2px 0 16px rgba(0, 0, 0, 0.25), -2px 0 16px rgba(0, 0, 0, 0.25);
width: 390px;
min-width: 390px;
height: 100%;
overflow-y: scroll;
-ms-overflow-style: none;
scrollbar-width: none;
::-webkit-scrollbar {
Expand Down
6 changes: 5 additions & 1 deletion client/src/hooks/queries/useCoursesQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ const useCoursesQuery = ({ distance, query, authorFilter, titleFilter }: CourseL
["courses", distance?.min, distance?.max, authorFilter, titleFilter, query],
({ pageParam = 1 }) => get("/course", courseQueryParams(pageParam)).then((res) => res.data),
{
getNextPageParam: (lastPage, allPages) => (lastPage ? lastPage?.length > 0 && allPages.length + 1 : 1),
getNextPageParam: (lastPage, allPages) => {
if (!lastPage) return 1;
if (lastPage?.length > 0) return allPages.length + 1;
else return undefined;
},
suspense: true,
},
);
Expand Down
14 changes: 10 additions & 4 deletions client/src/hooks/queries/useRecruitsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,24 @@ const useRecruitsQuery = ({ distance, query, availFilter, authorFilter, titleFil
param.maxLen = (distance.max * 1000).toString();
param.minLen = (distance.min * 1000).toString();
}
if (time) {
param.time = time.max.toString();

if (time?.max) {
param.hour = time.max.toString();
}

param.page = page;
return param;
};

return useInfiniteQuery(
["recruits", distance?.min, distance?.max, authorFilter, titleFilter, query],
["recruits", distance?.min, distance?.max, authorFilter, titleFilter, query, time],
({ pageParam = 1 }) => get("/recruit", recruitQueryParams(pageParam)).then((res) => res.data),
{
getNextPageParam: (lastPage, allPages) => (lastPage ? lastPage?.length > 0 && allPages.length + 1 : 1),
getNextPageParam: (lastPage, allPages) => {
if (!lastPage) return 1;
if (lastPage?.length > 0) return allPages.length + 1;
else return undefined;
},
suspense: true,
},
);
Expand Down
10 changes: 6 additions & 4 deletions client/src/pages/Courses/Courses.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, FormEventHandler, Suspense } from "react";
import React, { useState, Suspense, ChangeEvent } from "react";
import Header from "#components/Header/Header";
import SearchBar from "#components/SearchBar/SearchBar";
import FilterBar from "#components/FilterBar/FilterBar";
Expand All @@ -11,16 +11,17 @@ import { LOCATION_ICON } from "#assets/icons";
import PlusButton from "#components/PlusButton/PlusButton";
import CourseList from "#components/CardList/CourseList/CorseList";
import CardListLoader from "#components/CardList/CardList.loader";
import { debounce } from "#utils/timerUtils";

const Courses = () => {
const [currentDistanceFilter, setCurrentDistanceFilter] = useFilter({ text: "3-5KM", min: 3, max: 5 });
const [titleFilter, toggleTitleFilter] = useOnOffFilter(false);
const [authorFilter, toggleAuthorFilter] = useOnOffFilter(false);
const [searchContent, setSearchContent] = useState("");

const handleSearchContentChange: FormEventHandler<HTMLInputElement> = (e) => {
setSearchContent(e.currentTarget.value);
};
const handleSearchContentChange = debounce((e: ChangeEvent<HTMLInputElement>) => {
setSearchContent(e.target.value);
}, 200);

return (
<>
Expand All @@ -45,6 +46,7 @@ const Courses = () => {
filterIcon={LOCATION_ICON}
filterState={currentDistanceFilter}
filterOptions={[
{ text: "5KM ์ด์ƒ", min: 5, max: Number.MAX_SAFE_INTEGER },
{ text: "3-5KM", min: 3, max: 5 },
{ text: "1-3KM", min: 1, max: 3 },
{ text: "1KM ์ด๋‚ด", min: 0, max: 1 },
Expand Down
4 changes: 3 additions & 1 deletion client/src/pages/MyPage/MyPageRecruits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const MyPageRecruits = ({ MyPageOption }: MyPageProps) => {
if (!pastRecruitsToggled) filteredRecruit = filterPastRecruits(filteredRecruit);
if (myRecruitsToggled) filteredRecruit = filterMyRecruits(filteredRecruit);

return filteredRecruit.map((r: Recruit, idx: number) => <RecruitCard data={r} key={idx} />);
return filteredRecruit.map((r: Recruit, idx: number) => (
<RecruitCard data={r} key={idx} userIdVisible={false} />
));
};

return (
Expand Down
11 changes: 7 additions & 4 deletions client/src/pages/Recruits/Recruits.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Suspense, useState } from "react";
import React, { ChangeEvent, Suspense, useState } from "react";
import Header from "#components/Header/Header";
import SearchBar from "#components/SearchBar/SearchBar";
import FilterBar from "#components/FilterBar/FilterBar";
Expand All @@ -11,6 +11,7 @@ import { LOCATION_ICON, CLOCK_ICON } from "#assets/icons";
import PlusButton from "#components/PlusButton/PlusButton";
import RecruitList from "#components/CardList/RecruitList/RecruitList";
import CardListLoader from "#components/CardList/CardList.loader";
import { debounce } from "#utils/timerUtils";

const Recruits = () => {
const [currentDistanceFilter, setCurrentDistanceFilter] = useFilter({ text: "3-5KM", min: 3, max: 5 });
Expand All @@ -20,9 +21,9 @@ const Recruits = () => {
const [availFilter, toggleAvailFilter] = useOnOffFilter(false);
const [searchContent, setSearchContent] = useState("");

const handleSearchContentChange = (e: React.FormEvent<HTMLInputElement>) => {
setSearchContent(e.currentTarget.value);
};
const handleSearchContentChange = debounce((e: ChangeEvent<HTMLInputElement>) => {
setSearchContent(e.target.value);
}, 200);

return (
<>
Expand Down Expand Up @@ -52,6 +53,7 @@ const Recruits = () => {
filterIcon={LOCATION_ICON}
filterState={currentDistanceFilter}
filterOptions={[
{ text: "5KM ์ด์ƒ", min: 5, max: Number.MAX_SAFE_INTEGER },
{ text: "3-5KM", min: 3, max: 5 },
{ text: "1-3KM", min: 1, max: 3 },
{ text: "1KM ์ด๋‚ด", min: 0, max: 1 },
Expand All @@ -63,6 +65,7 @@ const Recruits = () => {
filterIcon={CLOCK_ICON}
filterState={currentTimeFilter}
filterOptions={[
{ text: "์ƒ๊ด€ ์—†์Œ", min: 0, max: 0 },
{ text: "5์‹œ๊ฐ„ ์ด๋‚ด", min: 0, max: 5 },
{ text: "3์‹œ๊ฐ„ ์ด๋‚ด", min: 0, max: 3 },
{ text: "1์‹œ๊ฐ„ ์ด๋‚ด", min: 0, max: 1 },
Expand Down
4 changes: 2 additions & 2 deletions noti-server/src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export class AppService {

// 30๋ถ„ ์ „ ์‹œ์ž‘ ์•Œ๋ฆผ
createRecruitMessage(body: any) {
const { recruitId, user, title, hDong, startTime, pathLength } = body;
const { recruitId, author, title, hDong, startTime, pathLength } = body;
const result = {};

result['type'] = 'recruit';
result['email'] = user.email; // ์ด๋ฉ”์ผ ํ•˜๋‚˜
result['email'] = author.email; // ์ด๋ฉ”์ผ ํ•˜๋‚˜
result['data'] = {
title,
hName: hDong.name,
Expand Down
1 change: 1 addition & 0 deletions server/src/common/repositories/course.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class CourseRepository extends Repository<Course> {
])
.offset((page - 1) * pageSize)
.limit(pageSize)
.orderBy("course.id", "DESC")
.getMany();
}
async findOneById(id: number): Promise<Course> {
Expand Down
2 changes: 2 additions & 0 deletions server/src/common/repositories/recruit.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class RecruitRepository extends Repository<Recruit> {
"h_dong.name",
])
.where("recruit.id = :recruitId", { recruitId })
.orderBy("recruit.id", "DESC")
.getRawOne();
}

Expand Down Expand Up @@ -94,6 +95,7 @@ export class RecruitRepository extends Repository<Recruit> {
.groupBy("recruit.id")
.offset((page - 1) * pageSize)
.limit(pageSize)
.orderBy("recruit.id", "DESC")
.getRawMany();
}

Expand Down

0 comments on commit a299010

Please sign in to comment.