From 2d09567be6802d381388ea078a055bd57871244b Mon Sep 17 00:00:00 2001 From: sycha Date: Thu, 2 Dec 2021 23:15:40 +0900 Subject: [PATCH] [Docs] swagger updatet --- backend/src/swagger/components/auth.yaml | 64 ++++++ backend/src/swagger/components/chat.yaml | 72 ------- backend/src/swagger/components/schedule.yaml | 7 +- backend/src/swagger/components/team.yaml | 11 ++ backend/src/swagger/openapi.yaml | 15 +- backend/src/swagger/paths/auth/info.yaml | 4 + backend/src/swagger/paths/auth/login.yaml | 9 + backend/src/swagger/paths/auth/signout.yaml | 8 + backend/src/swagger/paths/auth/signup.yaml | 9 + backend/src/swagger/paths/chat/chat.yaml | 31 --- backend/src/swagger/paths/chat/chatRoom.yaml | 14 -- .../paths/schedule/scheduleByTeamId.yaml | 7 - backend/src/swagger/swagger.yaml | 186 +++++++----------- 13 files changed, 181 insertions(+), 256 deletions(-) create mode 100644 backend/src/swagger/components/auth.yaml delete mode 100644 backend/src/swagger/components/chat.yaml create mode 100644 backend/src/swagger/paths/auth/signout.yaml delete mode 100644 backend/src/swagger/paths/chat/chat.yaml delete mode 100644 backend/src/swagger/paths/chat/chatRoom.yaml diff --git a/backend/src/swagger/components/auth.yaml b/backend/src/swagger/components/auth.yaml new file mode 100644 index 0000000..d1f64bd --- /dev/null +++ b/backend/src/swagger/components/auth.yaml @@ -0,0 +1,64 @@ +components: + parameters: + GetScheduleParam: + - name: team_id + in: query + required: true + description: 대상 팀 id + schema: + type: integer + - name: start_date + in: query + required: true + description: 시작 날짜 + schema: + type: string + - name: end_date + in: query + required: true + description: 끝 날짜 + schema: + type: string + ScheduleId: + - name: schedule_id + in: path + required: true + description: shedule id + schema: + type: integer + schemas: + login: + type: object + properties: + userEmail: + type: string + userPassword: + type: string + example: + userEmail: test@test.com + userPassword: 1qwrj1233ssd + signup: + type: object + properties: + userName: + type: string + userEmail: + type: string + userPassword: + type: string + example: + userName: testName + userEmail: test@test.com + userPassword: 1qwrj1233ssd + loginRes: + type: object + properties: + user: + type: object + signupRes: + type: object + properties: + signup: + type: boolean + example: + signup: true diff --git a/backend/src/swagger/components/chat.yaml b/backend/src/swagger/components/chat.yaml deleted file mode 100644 index 01e98ac..0000000 --- a/backend/src/swagger/components/chat.yaml +++ /dev/null @@ -1,72 +0,0 @@ -components: - parameters: - GetChatRooms: - - name: teamId - in: query - required: true - schema: - type: integer - - name: userId - in: query - required: true - schema: - type: integer - ChatRoomInfo: - - name: chatRoomId - in: path - required: true - schema: - type: integer - schemas: - CreateChatRoomBody: - type: object - properties: - team_id: - type: integer - chat_room_name: - type: string - user_id_list: - type: array - items: - type: object - properties: - user_id: - type: integer - CreateChatRoomRes: - type: object - properties: - chat_room_id: - type: integer - chat_room_name: - type: string - user_list: - type: array - items: - type: object - properties: - user_id: - type: integer - GetChatRooms: - type: object - properties: - chat_rooms: - type: array - items: - type: object - properties: - chat_room_id: - type: integer - chat_room_name: - type: string - ChatRoomInfo: - type: object - properties: - chat_room_id: - type: integer - user_list: - type: array - items: - type: object - properties: - user_id: - type: integer diff --git a/backend/src/swagger/components/schedule.yaml b/backend/src/swagger/components/schedule.yaml index f116585..9a7b574 100644 --- a/backend/src/swagger/components/schedule.yaml +++ b/backend/src/swagger/components/schedule.yaml @@ -2,7 +2,7 @@ components: parameters: GetScheduleParam: - name: team_id - in: path + in: query required: true description: 대상 팀 id schema: @@ -20,7 +20,7 @@ components: schema: type: string ScheduleId: - - name: schdule_id + - name: schedule_id in: path required: true description: shedule id @@ -132,6 +132,8 @@ components: CreateScheduleBody: type: object properties: + team_id: + type: integer title: type: string start_date: @@ -147,6 +149,7 @@ components: color: type: integer example: + team_id: 1 title: 매일 5번 반복 start_date: 2021-11-01T03:00:00.000Z end_date: 2021-11-01T04:00:00.000Z diff --git a/backend/src/swagger/components/team.yaml b/backend/src/swagger/components/team.yaml index b1fe805..1e7511f 100644 --- a/backend/src/swagger/components/team.yaml +++ b/backend/src/swagger/components/team.yaml @@ -12,6 +12,17 @@ components: required: true schema: type: integer + TeamUser: + - name: userId + in: path + required: true + schema: + type: integer + - name: teamId + in: path + required: true + schema: + type: integer schemas: TeamList: type: array diff --git a/backend/src/swagger/openapi.yaml b/backend/src/swagger/openapi.yaml index fbe4720..62ea2fe 100644 --- a/backend/src/swagger/openapi.yaml +++ b/backend/src/swagger/openapi.yaml @@ -6,13 +6,11 @@ info: license: name: MIT servers: - - url: http://localhost:4000/ + - url: https://www.boostteams.kro.kr description: BoostTeams Server tags: - name: auth description: Join / Login / Logout - - name: chat - description: Chat Page - name: schedule description: Calendar Page - name: team @@ -31,16 +29,13 @@ paths: $ref: './paths/auth/signup.yaml' /api/auth/info: $ref: './paths/auth/info.yaml' - # schdule - /api/schedules/{team_id}: + /api/auth/signout: + $ref: './paths/auth/signout.yaml' + # schedule + /api/schedules: $ref: './paths/schedule/scheduleByTeamId.yaml' /api/schedules/{schedule_id}: $ref: './paths/schedule/scheduleByScheduleId.yaml' - # chat - /api/chat/room: - $ref: './paths/chat/chat.yaml' - /api/chat/room/{chatRoomId}: - $ref: './paths/chat/chatRoom.yaml' # user /api/users: $ref: './paths/user/user.yaml' diff --git a/backend/src/swagger/paths/auth/info.yaml b/backend/src/swagger/paths/auth/info.yaml index 9652e4e..44cdc42 100644 --- a/backend/src/swagger/paths/auth/info.yaml +++ b/backend/src/swagger/paths/auth/info.yaml @@ -4,5 +4,9 @@ get: responses: 200: description: 성공 + content: + application/json: + schema: + $ref: '../../components/auth.yaml#/components/schemas/loginRes' 401: description: error diff --git a/backend/src/swagger/paths/auth/login.yaml b/backend/src/swagger/paths/auth/login.yaml index 81b9c1e..3f8e477 100644 --- a/backend/src/swagger/paths/auth/login.yaml +++ b/backend/src/swagger/paths/auth/login.yaml @@ -1,8 +1,17 @@ post: summary: 로그인하기 tags: [auth] + requestBody: + content: + application/json: + schema: + $ref: '../../components/auth.yaml#/components/schemas/login' responses: 200: description: 성공 + content: + application/json: + schema: + $ref: '../../components/auth.yaml#/components/schemas/loginRes' 401: description: error diff --git a/backend/src/swagger/paths/auth/signout.yaml b/backend/src/swagger/paths/auth/signout.yaml new file mode 100644 index 0000000..b8cc20d --- /dev/null +++ b/backend/src/swagger/paths/auth/signout.yaml @@ -0,0 +1,8 @@ +get: + summary: 회원 탈퇴 + tags: [auth] + responses: + 204: + description: 성공 + 401: + description: error diff --git a/backend/src/swagger/paths/auth/signup.yaml b/backend/src/swagger/paths/auth/signup.yaml index 5f71247..771ff48 100644 --- a/backend/src/swagger/paths/auth/signup.yaml +++ b/backend/src/swagger/paths/auth/signup.yaml @@ -1,8 +1,17 @@ post: summary: 회원가입하기 tags: [auth] + requestBody: + content: + application/json: + schema: + $ref: '../../components/auth.yaml#/components/schemas/signup' responses: 200: description: 성공 + content: + application/json: + schema: + $ref: '../../components/auth.yaml#/components/schemas/signupRes' 409: description: error diff --git a/backend/src/swagger/paths/chat/chat.yaml b/backend/src/swagger/paths/chat/chat.yaml deleted file mode 100644 index fbe6c64..0000000 --- a/backend/src/swagger/paths/chat/chat.yaml +++ /dev/null @@ -1,31 +0,0 @@ -get: - summary: 채팅방 목록 가져오기 - tags: [chat] - parameters: - $ref: '../../components/chat.yaml#/components/parameters/GetChatRooms' - responses: - 200: - description: 성공 - content: - application/json: - schema: - $ref: '../../components/chat.yaml#/components/schemas/GetChatRooms' - 404: - description: error -post: - summary: 채팅방 생성하기 - tags: [chat] - requestBody: - content: - application/json: - schema: - $ref: '../../components/chat.yaml#/components/schemas/CreateChatRoomBody' - responses: - 200: - description: 성공 - content: - application/json: - schema: - $ref: '../../components/chat.yaml#/components/schemas/CreateChatRoomRes' - 409: - description: error diff --git a/backend/src/swagger/paths/chat/chatRoom.yaml b/backend/src/swagger/paths/chat/chatRoom.yaml deleted file mode 100644 index e0acbef..0000000 --- a/backend/src/swagger/paths/chat/chatRoom.yaml +++ /dev/null @@ -1,14 +0,0 @@ -get: - summary: 채팅방 정보 가져오기 - tags: [chat] - parameters: - $ref: '../../components/chat.yaml#/components/parameters/ChatRoomInfo' - responses: - 200: - description: 성공 - content: - application/json: - schema: - $ref: '../../components/chat.yaml#/components/schemas/ChatRoomInfo' - 404: - description: error diff --git a/backend/src/swagger/paths/schedule/scheduleByTeamId.yaml b/backend/src/swagger/paths/schedule/scheduleByTeamId.yaml index 0b29c04..15978ba 100644 --- a/backend/src/swagger/paths/schedule/scheduleByTeamId.yaml +++ b/backend/src/swagger/paths/schedule/scheduleByTeamId.yaml @@ -15,13 +15,6 @@ get: post: summary: 일정 추가하기 tags: [schedule] - parameters: - - name: team_id - in: path - required: true - description: 대상 팀 id - schema: - type: integer requestBody: content: application/json: diff --git a/backend/src/swagger/swagger.yaml b/backend/src/swagger/swagger.yaml index 7a9ef0c..6b471a6 100644 --- a/backend/src/swagger/swagger.yaml +++ b/backend/src/swagger/swagger.yaml @@ -6,13 +6,11 @@ info: license: name: MIT servers: - - url: 'http://localhost:4000/' + - url: 'https://www.boostteams.kro.kr' description: BoostTeams Server tags: - name: auth description: Join / Login / Logout - - name: chat - description: Chat Page - name: schedule description: Calendar Page - name: team @@ -25,9 +23,26 @@ paths: summary: 로그인하기 tags: - auth + requestBody: + content: + application/json: + schema: + type: object + properties: + userEmail: + type: string + userPassword: + type: string + example: + userEmail: test@test.com + userPassword: 1qwrj1233ssd responses: '200': description: 성공 + content: + application/json: + schema: + $ref: '#/paths/~1api~1auth~1info/get/responses/200/content/application~1json/schema' '401': description: error /api/auth/github: @@ -55,9 +70,34 @@ paths: summary: 회원가입하기 tags: - auth + requestBody: + content: + application/json: + schema: + type: object + properties: + userName: + type: string + userEmail: + type: string + userPassword: + type: string + example: + userName: testName + userEmail: test@test.com + userPassword: 1qwrj1233ssd responses: '200': description: 성공 + content: + application/json: + schema: + type: object + properties: + signup: + type: boolean + example: + signup: true '409': description: error /api/auth/info: @@ -68,16 +108,33 @@ paths: responses: '200': description: 성공 + content: + application/json: + schema: + type: object + properties: + user: + type: object + '401': + description: error + /api/auth/signout: + get: + summary: 회원 탈퇴 + tags: + - auth + responses: + '204': + description: 성공 '401': description: error - '/api/schedules/{team_id}': + /api/schedules: get: summary: 일정 가져오기 tags: - schedule parameters: - name: team_id - in: path + in: query required: true description: 대상 팀 id schema: @@ -156,19 +213,14 @@ paths: summary: 일정 추가하기 tags: - schedule - parameters: - - name: team_id - in: path - required: true - description: 대상 팀 id - schema: - type: integer requestBody: content: application/json: schema: type: object properties: + team_id: + type: integer title: type: string start_date: @@ -184,6 +236,7 @@ paths: color: type: integer example: + team_id: 1 title: 매일 5번 반복 start_date: 2021-11-01T03:00:00.000Z end_date: 2021-11-01T04:00:00.000Z @@ -266,7 +319,7 @@ paths: tags: - schedule parameters: - - name: schdule_id + - name: schedule_id in: path required: true description: shedule id @@ -335,113 +388,6 @@ paths: color: 4 '409': description: error - /api/chat/room: - get: - summary: 채팅방 목록 가져오기 - tags: - - chat - parameters: - - name: teamId - in: query - required: true - schema: - type: integer - - name: userId - in: query - required: true - schema: - type: integer - responses: - '200': - description: 성공 - content: - application/json: - schema: - type: object - properties: - chat_rooms: - type: array - items: - type: object - properties: - chat_room_id: - type: integer - chat_room_name: - type: string - '404': - description: error - post: - summary: 채팅방 생성하기 - tags: - - chat - requestBody: - content: - application/json: - schema: - type: object - properties: - team_id: - type: integer - chat_room_name: - type: string - user_id_list: - type: array - items: - type: object - properties: - user_id: - type: integer - responses: - '200': - description: 성공 - content: - application/json: - schema: - type: object - properties: - chat_room_id: - type: integer - chat_room_name: - type: string - user_list: - type: array - items: - type: object - properties: - user_id: - type: integer - '409': - description: error - '/api/chat/room/{chatRoomId}': - get: - summary: 채팅방 정보 가져오기 - tags: - - chat - parameters: - - name: chatRoomId - in: path - required: true - schema: - type: integer - responses: - '200': - description: 성공 - content: - application/json: - schema: - type: object - properties: - chat_room_id: - type: integer - user_list: - type: array - items: - type: object - properties: - user_id: - type: integer - '404': - description: error /api/users: patch: summary: 유저 닉네임 변경하기