Skip to content

Commit

Permalink
fix: add is_regular_member in club manage member list:
Browse files Browse the repository at this point in the history
  • Loading branch information
pbc1017 committed May 5, 2024
1 parent 57bbafb commit 41218a2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
11 changes: 11 additions & 0 deletions back/routes/member.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,16 @@ router.get("/list", async (req, res) => {
model: Member,
as: "student", // Make sure this alias matches the one defined in your association
attributes: ["name", "email"],
include: [
{
model: MemberStatus,
as: "MemberStatuses",
attributes: ["is_regular_member"],
where: {
semester_id: currentSemester.id,
},
},
],
},
],
attributes: [
Expand All @@ -500,6 +510,7 @@ router.get("/list", async (req, res) => {
...reg.toJSON(),
memberName: reg.student.name,
memberEmail: reg.student.email,
isRegularMember: reg.student.MemberStatuses[0].is_regular_member == 1,
apply_time: reg.apply_time_formatted, // Use the formatted apply_time
};
});
Expand Down
15 changes: 11 additions & 4 deletions front/src/pages/club/ClubManage/ClubManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ type ApplyInfo = {
studentId: number;
startDate: string;
feedbackType: number;
isRegularMember: boolean;
};

export const ClubManage = (): JSX.Element => {
const userRepresentativeStatuses = useUserRepresentativeStatus(); // 배열을 반환한다고 가정
const { durationStatus } = useReportDurationStatus();
const { durationStatus: fundingStatus } = useReportDurationStatus();
const { durationStatus: fundingStatus } = useFundingDurationStatus();
const navigate = useNavigate();
const [clubInfos, setClubInfos] = useState<{ [key: number]: ClubInfo }>({});
const [advisorSignedStatus, setAdvisorSignedStatus] = useState<{
Expand Down Expand Up @@ -163,26 +164,30 @@ export const ClubManage = (): JSX.Element => {
await getRequest(
`member/list?club_id=${clubId}`,
(data) => {
console.log(data.data[0]);
const formattedData = data.data.map(
(item: {
student_id: any;
memberEmail: any;
memberName: any;
apply_time_formatted: any;
approved_type: any;
isRegularMember: any;
}) => ({
studentId: item.student_id,
email: item.memberEmail,
name: item.memberName,
startDate: item.apply_time_formatted,
feedbackType: item.approved_type,
isRegularMember: item.isRegularMember,
})
);

setApplyLists((applyLists) => ({
...applyLists,
[clubId]: formattedData,
}));
console.log(formattedData);
},
(error) => {
console.error("Error fetching applies:", error);
Expand Down Expand Up @@ -439,7 +444,9 @@ export const ClubManage = (): JSX.Element => {
<Activity
key={index}
index={index + 1}
name={`${member.studentId} ${member.name}`}
name={`${member.studentId} ${member.name} (${
member.isRegularMember ? "정회원" : "준회원"
})`}
type={member.email}
start_date={member.startDate}
activityStateProperty1={member.feedbackType}
Expand Down Expand Up @@ -554,7 +561,7 @@ export const ClubManage = (): JSX.Element => {
/>
</div>
<div className="frame-28">
{status.typeId < 4 && durationStatus == 1 && (
{status.typeId < 4 && fundingStatus === 1 && (
<>
<div
className="rectangle"
Expand Down Expand Up @@ -611,7 +618,7 @@ export const ClubManage = (): JSX.Element => {
<div className="frame-28">
{activitiesLists[status.clubId]?.length < 20 &&
status.typeId < 4 &&
durationStatus == 1 && (
durationStatus === 1 && (
<>
<div
className="rectangle"
Expand Down

0 comments on commit 41218a2

Please sign in to comment.