Skip to content

Commit

Permalink
Revert "[Feature]: 스터디 상세 정보 작성 (#56)"
Browse files Browse the repository at this point in the history
This reverts commit 6a5c088.
  • Loading branch information
eugene028 authored Aug 30, 2024
1 parent 6a5c088 commit 9cecc4e
Show file tree
Hide file tree
Showing 51 changed files with 216 additions and 1,030 deletions.
11 changes: 11 additions & 0 deletions apps/admin/apis/form/createStudyApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { fetcher } from "@wow-class/utils";
import { apiPath } from "constants/apiPath";
import type { CreateStudyApiRequestDto } from "types/dtos/createStudy";

export const createStudyApi = {
postCreateStudy: async (data: CreateStudyApiRequestDto) => {
const response = await fetcher.post(apiPath.createStudy, data);

return { success: response.ok };
},
};
26 changes: 11 additions & 15 deletions apps/admin/apis/study/createStudyApi.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import { fetcher } from "@wow-class/utils";
import { apiPath } from "constants/apiPath";
import type { CreateStudyApiRequestDto } from "types/dtos/createStudy";
import type { CreateStudyDetailInfoApiRequestDto } from "types/dtos/studyDetailInfo";
import { tags } from "constants/tags";
import type { StudyListApiResponseDto } from "types/dtos/studyList";

export const createStudyApi = {
postCreateStudy: async (data: CreateStudyApiRequestDto) => {
const response = await fetcher.post(apiPath.createStudy, data);

return { success: response.ok };
},
postStudyDetailInfo: async (
data: CreateStudyDetailInfoApiRequestDto,
studyId: number
) => {
const response = await fetcher.patch(
`${apiPath.createStudyDetailInfo}/${studyId}`,
data
getStudyList: async () => {
const response = await fetcher.get<StudyListApiResponseDto[]>(
apiPath.studyList,
{
next: { tags: [tags.studyList] },
cache: "force-cache",
}
);
return { success: response.ok };

return response.data;
},
};
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
import { fetcher } from "@wow-class/utils";
import { apiPath, mentorApiPath } from "constants/apiPath";
import { mentorApiPath } from "constants/apiPath";
import { tags } from "constants/tags";
import type { AnnouncementApiResponseDto } from "types/dtos/announcement";
import type { AssignmentApiResponseDto } from "types/dtos/assignmentList";
import type { CurriculumApiResponseDto } from "types/dtos/curriculumList";
import type { SessionApiResponseDto } from "types/dtos/sessionList";
import type { StudyBasicInfoApiResponseDto } from "types/dtos/studyBasicInfo";
import type { StudyAnnouncementType } from "types/entities/study";

import type { StudyListApiResponseDto } from "../../types/dtos/studyList";

export const studyApi = {
getStudyList: async () => {
const response = await fetcher.get<StudyListApiResponseDto[]>(
apiPath.studyList,
{
next: { tags: [tags.studyList] },
}
);

return response.data;
},
export const studyInfoApi = {
getStudyBasicInfo: async (studyId: number) => {
const response = await fetcher.get<StudyBasicInfoApiResponseDto>(
`/common/studies/${studyId}`,
Expand Down Expand Up @@ -48,11 +36,11 @@ export const studyApi = {

return { success: response.ok };
},
getCurriculumList: async (studyId: number) => {
const response = await fetcher.get<CurriculumApiResponseDto[]>(
`${mentorApiPath.curriculums}?studyId=${studyId}`,
getSessionList: async (studyId: number) => {
const response = await fetcher.get<SessionApiResponseDto[]>(
`${mentorApiPath.sessions}?study=${studyId}`,
{
next: { tags: [tags.curriculums] },
next: { tags: [tags.sessions] },
cache: "force-cache",
}
);
Expand Down
3 changes: 0 additions & 3 deletions apps/admin/app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ body {
flex-direction: row;
min-height: 100vh;
}
::-webkit-scrollbar {
display: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Flex } from "@styled-system/jsx";
import { Modal, Space, Text } from "@wow-class/ui";
import { useModalRoute } from "@wow-class/ui/hooks";
import { studyApi } from "apis/study/studyApi";
import { studyInfoApi } from "apis/study/studyInfoApi";
import { tags } from "constants/tags";
import { useSearchParams } from "next/navigation";
import { revalidateTagByName } from "utils/revalidateTagByName";
Expand All @@ -17,7 +17,7 @@ const AnnouncementDeleteModal = () => {
const { closeModal } = useModalRoute();

const handleClickDeleteButton = async () => {
const result = await studyApi.deleteStudyAnnouncement(
const result = await studyInfoApi.deleteStudyAnnouncement(
Number(studyAnnouncementId)
);
if (result.success) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Flex } from "@styled-system/jsx";
import { Modal, Space, Text } from "@wow-class/ui";
import { useModalRoute } from "@wow-class/ui/hooks";
import { studyApi } from "apis/study/studyApi";
import { studyInfoApi } from "apis/study/studyInfoApi";
import { tags } from "constants/tags";
import { useSearchParams } from "next/navigation";
import { useState } from "react";
Expand All @@ -25,7 +25,7 @@ const AnnouncementModifyModal = () => {
const { closeModal } = useModalRoute();

const handleClickModifyButton = async () => {
const result = await studyApi.modifyStudyAnnouncement(
const result = await studyInfoApi.modifyStudyAnnouncement(
Number(studyAnnouncementId),
studyAnnouncement
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { css } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { Text } from "@wow-class/ui";
import { studyApi } from "apis/study/studyApi";
import { studyInfoApi } from "apis/study/studyInfoApi";
import { tags } from "constants/tags";
import { useState } from "react";
import type { StudyAnnouncementType } from "types/entities/study";
Expand All @@ -19,7 +19,7 @@ const CreateStudyAnnouncement = ({ studyId }: { studyId: string }) => {
});

const handlePublishAnnouncement = async (studyId: string) => {
const { success } = await studyApi.publishStudyAnnouncement(
const { success } = await studyInfoApi.publishStudyAnnouncement(
parseInt(studyId, 10),
studyAnnouncement
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { Space, Table, Text } from "@wow-class/ui";
import { studyApi } from "apis/study/studyApi";
import { studyInfoApi } from "apis/study/studyInfoApi";
import { routerPath } from "constants/router/routerPath";
import Image from "next/image";
import Link from "next/link";
Expand All @@ -12,12 +12,12 @@ import TextButton from "wowds-ui/TextButton";
import CreateStudyAnnouncement from "./CreateStudyAnnouncement";

const StudyAnnouncement = async ({ studyId }: { studyId: string }) => {
const announcementList = await studyApi.getStudyAnnouncement(
const announcementList = await studyInfoApi.getStudyAnnouncement(
parseInt(studyId, 10)
);

return (
<section aria-label="curriculum-list">
<section aria-label="session-list">
<Text typo="h2">스터디 공지</Text>
<Space height={24} />
<CreateStudyAnnouncement studyId={studyId} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Space, Text } from "@wow-class/ui";
import { studyApi } from "apis/study/studyApi";
import { studyInfoApi } from "apis/study/studyInfoApi";

import AssignmentListItem from "./AssignmentListItem";

const AssignmentList = async ({ studyId }: { studyId: string }) => {
const assignmentList = await studyApi.getAssignmentList(
const assignmentList = await studyInfoApi.getAssignmentList(
parseInt(studyId, 10)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { cva } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { Table, Text } from "@wow-class/ui";
import { padWithZero, parseISODate } from "@wow-class/utils";
import { studyApi } from "apis/study/studyApi";
import { studyInfoApi } from "apis/study/studyInfoApi";
import { tags } from "constants/tags";
import Link from "next/link";
import type { AssignmentApiResponseDto } from "types/dtos/assignmentList";
Expand All @@ -30,7 +30,7 @@ const AssignmentListItem = ({
const studyDeadline = `종료 : ${year}${month}${day}${padWithZero(hours)}:${padWithZero(minutes)}`;

const handleCancelAssignment = async (studyDetailId: number) => {
const { success } = await studyApi.cancelAssignment(studyDetailId);
const { success } = await studyInfoApi.cancelAssignment(studyDetailId);
if (success) {
window.alert("휴강 처리에 성공했어요.");
revalidateTagByName(tags.assignments);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";
import { Flex } from "@styled-system/jsx";
import { studyApi } from "apis/study/studyApi";
import { studyInfoApi } from "apis/study/studyInfoApi";
import { useRouter } from "next/navigation";
import type { StudyAssignmentStatusType } from "types/entities/study";
import type { AssignmentStatusType } from "types/entities/study";
import Button from "wowds-ui/Button";

const CancelStudyButton = ({
Expand All @@ -12,11 +12,11 @@ const CancelStudyButton = ({
}: {
descriptionLink: string;
studyDetailId: number;
assignmentStatus: StudyAssignmentStatusType;
assignmentStatus: AssignmentStatusType;
}) => {
const router = useRouter();
const handleCancelAssignment = async (studyDetailId: number) => {
const { success } = await studyApi.cancelAssignment(studyDetailId);
const { success } = await studyInfoApi.cancelAssignment(studyDetailId);
if (success) {
console.log("휴강 처리에 성공했어요.");
} else {
Expand Down

This file was deleted.

Loading

0 comments on commit 9cecc4e

Please sign in to comment.