diff --git a/README.md b/README.md
index bddf8d3..626798e 100644
--- a/README.md
+++ b/README.md
@@ -50,9 +50,8 @@ https://www.boostteams.kro.kr
## κΈ°μ μ€ν π¨βπ» π©βπ»
![image](https://user-images.githubusercontent.com/47925079/144397243-4754a039-1255-468c-bc41-5392dd1ca4a0.png)
-
## μμ€ν
ꡬμ±λ βοΈ
-
+![image](https://user-images.githubusercontent.com/47925079/144424027-d6230ee5-35ff-400f-a848-b76dd17b3b06.png)
## μ€κ³ π¨
- [Design: Figma](https://www.figma.com/file/ARSNGmB4baVv48Os7TrELl/Teams?node-id=0%3A1)
diff --git a/backend/src/controllers/schedule-controller.ts b/backend/src/controllers/schedule-controller.ts
index a58df99..0cc4e84 100644
--- a/backend/src/controllers/schedule-controller.ts
+++ b/backend/src/controllers/schedule-controller.ts
@@ -2,17 +2,10 @@ import { Request, Response } from 'express';
import moment from 'moment';
import ScheduleService from '@services/schedule-service';
-const changeFieldToNumber = (teamID, newScheduleData) => {
- newScheduleData.team_id = Number(teamID);
- newScheduleData.color = Number(newScheduleData.color);
- return newScheduleData;
-};
-
const ScheduleController = {
async createSchedule(req: Request, res: Response) {
try {
- const scheduleInfo = changeFieldToNumber(req.params.teamId, req.body);
- const newSchedule = await ScheduleService.getInstance().createSchedule(scheduleInfo);
+ const newSchedule = await ScheduleService.getInstance().createSchedule(req.body);
res.json(newSchedule);
} catch (err) {
res.sendStatus(409);
@@ -20,11 +13,10 @@ const ScheduleController = {
},
async getSchedule(req: Request, res: Response) {
try {
- const { start_date, end_date }: { start_date?: string; end_date?: string } = req.query;
- const team_id = Number(req.params.teamId);
+ const { team_id, start_date, end_date }: { team_id?: string; start_date?: string; end_date?: string } = req.query;
const startDate = moment(start_date, 'YYYYMMDD').format('YYYY-MM-DD');
const endDate = moment(end_date, 'YYYYMMDD').format('YYYY-MM-DD');
- const schedules = await ScheduleService.getInstance().getSchedule(team_id, startDate, endDate);
+ const schedules = await ScheduleService.getInstance().getSchedule(Number(team_id), startDate, endDate);
res.json(schedules);
} catch (err) {
res.sendStatus(404);
diff --git a/backend/src/routes/schedule-router.ts b/backend/src/routes/schedule-router.ts
index 44b2dfb..4eeb2c7 100644
--- a/backend/src/routes/schedule-router.ts
+++ b/backend/src/routes/schedule-router.ts
@@ -1,13 +1,12 @@
import express from 'express';
import ScheduleController from '@controllers/schedule-controller';
-import { checkTeamUser } from '@src/middlewares/user';
import { authenticateToken } from '@src/middlewares/token';
const router = express.Router();
-router.post('/:teamId', authenticateToken, checkTeamUser, ScheduleController.createSchedule);
-router.get('/:teamId', authenticateToken, checkTeamUser, ScheduleController.getSchedule);
-router.put('/:scheduleId', ScheduleController.updateRepeatSchedule);
-router.delete('/:scheduleId', ScheduleController.deleteSchedule);
+router.post('/', authenticateToken, ScheduleController.createSchedule);
+router.get('/', authenticateToken, ScheduleController.getSchedule);
+router.put('/:scheduleId', authenticateToken, ScheduleController.updateRepeatSchedule);
+router.delete('/:scheduleId', authenticateToken, ScheduleController.deleteSchedule);
export default router;
diff --git a/frontend/src/apis/schedule.ts b/frontend/src/apis/schedule.ts
index efcaa58..6117c0b 100644
--- a/frontend/src/apis/schedule.ts
+++ b/frontend/src/apis/schedule.ts
@@ -4,7 +4,7 @@ import fetchApi from '@utils/fetch';
export const getSchedules = async (teamId: number, firstDate: string, lastDate: string): Promise => {
try {
- const res = await fetchApi.get(`/api/schedules/${teamId}?start_date=${firstDate}&end_date=${lastDate}`);
+ const res = await fetchApi.get(`/api/schedules?team_id=${teamId}&start_date=${firstDate}&end_date=${lastDate}`);
if (res.status === 404) throw new Error('π£ μΌμ μ κ°μ Έμ¬ μ μμ΅λλ€!');
else if (res.status === 403) throw new Error('π£ κΆνμ΄ μμ΅λλ€!');
const data = await res.json();
@@ -16,9 +16,9 @@ export const getSchedules = async (teamId: number, firstDate: string, lastDate:
}
};
-export const createNewSchedule = async (teamId: number, newSchedule: ScheduleReqType): Promise => {
+export const createNewSchedule = async (newSchedule: ScheduleReqType): Promise => {
try {
- const res = await fetchApi.post(`/api/schedules/${teamId}`, { ...newSchedule });
+ const res = await fetchApi.post('/api/schedules', { ...newSchedule });
if (res.status === 409) throw new Error('π£ μΌμ μΆκ°μ μ€ν¨νμμ΅λλ€!');
else if (res.status === 403) throw new Error('π£ κΆνμ΄ μμ΅λλ€!');
const data = await res.json();
diff --git a/frontend/src/components/Calendar/CalendarHeader/style.ts b/frontend/src/components/Calendar/CalendarHeader/style.ts
index 7b1fe27..24b13e3 100644
--- a/frontend/src/components/Calendar/CalendarHeader/style.ts
+++ b/frontend/src/components/Calendar/CalendarHeader/style.ts
@@ -8,7 +8,7 @@ export const Container = styled.header`
width: 100%;
height: 2.5rem;
background-color: ${ColorCode.BACKGROUND1};
- padding: 0 1rem 0 0;
+ padding: 0 1rem;
box-sizing: border-box;
border-bottom: solid 1px ${ColorCode.LINE2};
svg {
diff --git a/frontend/src/components/Calendar/CalendarModal/index.tsx b/frontend/src/components/Calendar/CalendarModal/index.tsx
index 0c2b2bd..b03e711 100644
--- a/frontend/src/components/Calendar/CalendarModal/index.tsx
+++ b/frontend/src/components/Calendar/CalendarModal/index.tsx
@@ -64,6 +64,7 @@ const CalendarModal: React.FC = ({
repeat_option: selectedRepeat,
repeat_count: isNum(selectedRepeatCount) ? selectedRepeatCount : 1,
content: contentRef.current?.value,
+ team_id: teamId,
};
};
@@ -90,7 +91,7 @@ const CalendarModal: React.FC = ({
const newScheduleData = getScheduleData();
if (validateSchedule(newScheduleData)) {
if (checkModalMode('create')) {
- const newSchedules = await createNewSchedule(teamId, newScheduleData);
+ const newSchedules = await createNewSchedule(newScheduleData);
addSchedule(newSchedules);
} else {
newScheduleData.schedule_id = scheduleId;
diff --git a/frontend/src/types/calendar.ts b/frontend/src/types/calendar.ts
index feee80e..9cc9547 100644
--- a/frontend/src/types/calendar.ts
+++ b/frontend/src/types/calendar.ts
@@ -49,6 +49,7 @@ export interface ScheduleReqType {
repeat_count: number;
content?: string;
color: number;
+ team_id: number;
}
export interface TimeType {