-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 토큰 요청 리팩토링 * 리팩토링 수정 완료 * 병합 전 커밋 * 마이페이지 구현 및 테스트 완료 * 마이페이지 구현 완료 및 리스트 오류 해결 중 * 멤버 목록 조회 * 가입된 멤버조회 구현 * 마이페이지 / 스터디 리스트 페이지 테스트 완료 * 개인 일정만 구현하면 진짜진짜 끝... * 세부사양 구현 완료, 개인 일정 CRUD의 경우 엔드포인트가 확정되면 추후 개선 * 기능구현 완료, 디버깅 및 CSS 구현 중 * 기능구현 완료 및 CSS 구현 중 * 세부사양 구현 완료 및 CSS 수정 중
- Loading branch information
1 parent
e7c776f
commit a66349f
Showing
24 changed files
with
933 additions
and
416 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { | ||
StudyInfoDto, | ||
getStudyGroupInfo, | ||
getStudyGroupList, | ||
} from "./StudyGroupApi"; | ||
|
||
// ====================== 개인이 속한 스터디의 스케줄을 가져오는 로직 =========================== | ||
// 1. 개인이 속한 스터디 조회 | ||
// 2. 조회 데이터의 id 추출 | ||
// 3. id를 인자로 전달하여 각 스터디의 상세정보를 추출하고, 변수에 담기 | ||
// 4. 변수에 담은 스터디 정보를 fullCalendar 라이브러리에 맞게 맵핑 | ||
// 5. fullCalendar 라이브러리에 전달하여 이벤트 생성 | ||
export interface Event { | ||
id: string; | ||
title: string; | ||
daysOfWeek?: string[]; | ||
startTime: string; | ||
endTime: string; | ||
startRecur: string; | ||
endRecur: string; | ||
description: string; | ||
overlap: boolean; | ||
} | ||
|
||
export const generateStudyEvents = async ( | ||
isLoggedIn: boolean | ||
): Promise<Event[]> => { | ||
// 1. 개인이 속한 스터디 조회 | ||
const myStudyGroups = await getStudyGroupList(); | ||
console.log(myStudyGroups); | ||
|
||
// 2. 조회 데이터의 id 추출 | ||
const studyGroupIds: number[] = []; | ||
// members 배열에서 스터디 그룹의 ID 추출 | ||
for (const member of myStudyGroups.data.members) { | ||
studyGroupIds.push(member.id); | ||
} | ||
|
||
// 3. id를 인자로 전달하여 각 스터디의 상세정보를 추출하고, 변수에 담기 | ||
const studyGroupInfos: StudyInfoDto[] = []; | ||
for (const id of studyGroupIds) { | ||
const studyGroupInfo = await getStudyGroupInfo(id, isLoggedIn); | ||
studyGroupInfos.push(studyGroupInfo); | ||
} | ||
|
||
// 4. 변수에 담은 스터디 정보를 fullCalendar 라이브러리에 맞게 맵핑 | ||
const events: Event[] = studyGroupInfos.map( | ||
(studyGroupInfo: StudyInfoDto) => { | ||
const mappedDaysOfWeek: string[] = studyGroupInfo.daysOfWeek.map( | ||
(day: string) => { | ||
switch (day) { | ||
case "월": | ||
return "1"; // "월" -> 1 | ||
case "화": | ||
return "2"; // "화" -> 2 | ||
case "수": | ||
return "3"; // "수" -> 3 | ||
case "목": | ||
return "4"; // "목" -> 4 | ||
case "금": | ||
return "5"; // "금" -> 5 | ||
case "토": | ||
return "6"; // "토" -> 6 | ||
case "일": | ||
return "0"; // "일" -> 0 | ||
default: | ||
return ""; // handle any other cases if necessary | ||
} | ||
} | ||
); | ||
|
||
const event: Event = { | ||
id: studyGroupInfo.id.toString(), | ||
title: studyGroupInfo.studyName, | ||
daysOfWeek: mappedDaysOfWeek, | ||
startTime: `${studyGroupInfo.studyTimeStart}:00`, | ||
endTime: `${studyGroupInfo.studyTimeEnd}:00`, | ||
startRecur: studyGroupInfo.studyPeriodStart, | ||
endRecur: studyGroupInfo.studyPeriodEnd, | ||
description: studyGroupInfo.introduction, | ||
overlap: true, | ||
}; | ||
console.log(event); | ||
return event; | ||
} | ||
); | ||
|
||
// 5. fullCalendar 이벤트 배열 반환 | ||
return events; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.