Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

API SharedTimetables

Subeen Park edited this page Mar 19, 2023 · 2 revisions

GET /v1/shared-tables/

유저가 가진 공유시간표 목록을 반환합니다.

OUTPUT (Example)

[
    {
        "id": "6416fa5cf874ed393bed983d",
        "title": "얘는 곧 삭제할거임",
        "created_at": "2023-03-19T21:04:44.664",
        "updated_at": "2023-03-19T21:04:44.664",
        "is_valid": true
    },
    {
        "id": "6416fa79f874ed393bed983e",
        "title": "gongyou",
        "created_at": "2023-03-19T21:05:13.146",
        "updated_at": "2023-03-19T21:05:13.146",
        "is_valid": true
    }
]

POST /v1/shared-tables/

공유시간표를 새로 생성합니다.


body

name description example
title 공유 시간표의 제목 땡떙 시간표
timetable_id 시간표 id 641c656(공유 링크로부터 클라이언트가 얻은 값)

Output

성공 시 200이 내려옵니다. 실패시 적절한 http status code와 함께 { errcode: string, message: string }

SHARED_TIME_TABLE_ALREADY_EXISTS(HttpStatus.BAD_REQUEST, 40004, "이미 공유시간표에 존재하는 timetableId입니다.", "이미 추가된 공유시간표입니다.")
TIMETABLE_NOT_FOUND(HttpStatus.NOT_FOUND, 40400, "timetable_id가 유효하지 않습니다", "존재하지 않는 시간표입니다.")

GET shared-tables/:id/

해당 공유 시간표의 정보를 반환합니다.

Output

{
    "id": "641327e66d785a4ab83f7af4",
    "user_id": "63941ce102cbe6001047d1bf",
    "title": "진짜 공유받은 시간펴 이름바꿈",
    "timetable": {
        "_id": "641325ed0537a3001683c649",
        "userId": "641325e2df48c83154b793b6",
        "year": 2023,
        "semester": 1,
        "lectures": [
            {
                "_id": "64132ab70537a3001683c653",
                "academic_year": "3학년",
                "category": "",
                "class_time": "월(1-2)/수(1-2)",
                "real_class_time": "월(09:00~10:50)/수(09:00~10:50)",
                "class_time_json": [
                    {
                        "_id": "64132ab70537a3001683c655",
                        "day": 0,
                        "place": "302-208",
                        "start_time": "09:00",
                        "end_time": "10:50",
                        "len": 2.0,
                        "start": 1.0
                    },
                    {
                        "_id": "64132ab70537a3001683c654",
                        "day": 2,
                        "place": "302-310-2",
                        "start_time": "09:00",
                        "end_time": "10:50",
                        "len": 2.0,
                        "start": 1.0
                    }
                ],
                "class_time_mask": [
                    251658240,
                    0,
                    251658240,
                    0,
                    0,
                    0,
                    0
                ],
                "classification": "전선",
                "credit": 3,
                "department": "컴퓨터공학부",
                "instructor": "유승주",
                "lecture_number": "001",
                "quota": 50,
                "remark": "",
                "course_number": "4190.309A",
                "course_title": "하드웨어시스템설계",
                "color": null,
                "color_index": 2
            }
        ],
        "title": "진짜 공유할 시간표",
        "theme": 0,
        "updatedAt": "2023-03-16T14:41:59.182Z"
    }
}

PUT shared-tables/:id/

공유 시간표 제목을 수정합니다.

body

name description example
title 공유 시간표의 제목 새로운 제목

Output

성공 시 200이 내려옵니다. 실패시 적절한 http status code와 함께 { errcode: string, message: string }


DELETE shared-tables/:id/

공유시간표를 삭제합니다.

Output

삭제된 lecture가 있던 현재 테이블 객체를 반환합니다. 위 GET tables/:id/ 참고. 실패시 적절한 http status code와 함께 { errcode: string, message: string }

SHARED_TIMETABLE_NOT_FOUND(HttpStatus.NOT_FOUND, 40401, "shared_timetable_id가 유효하지 않습니다", "존재하지 않는 공유시간표입니다.")
NOT_SHARED_TIMETABLE_OWNER(HttpStatus.BAD_REQUEST, 40003, "내 shared timetable이 아닙니다.", "내 공유시간표가 아니면 삭제할 수 없습니다."),