diff --git a/.gitignore b/.gitignore index 906596e..e676436 100644 --- a/.gitignore +++ b/.gitignore @@ -144,5 +144,5 @@ dist package-lock.json - +./src/swagger/swagger.yaml # End of https://www.toptal.com/developers/gitignore/api/node \ No newline at end of file diff --git a/src/swagger/openapi.yaml b/src/swagger/openapi.yaml index 1a0e580..f5be86c 100644 --- a/src/swagger/openapi.yaml +++ b/src/swagger/openapi.yaml @@ -115,3 +115,19 @@ paths: $ref: "./users.yaml#/~1users~1disabled" /users/following/{targetUserId}: $ref: "./users.yaml#/~1users~1following~1{targetUserId}" + /places: + $ref: "./places.yaml#/~1places" + /places/search: + $ref: "./places.yaml#/~1places~1search" + /places/{placeId}/reviews: + $ref: "./places.yaml#/~1places~1{placeId}~1reviews" + /places/{placeId}/activities: + $ref: "./places.yaml#/~1places~1{placeId}~1activities" + /places/{placeId}/news: + $ref: "./places.yaml#/~1places~1{placeId}~1news" + /places/{placeId}/books: + $ref: "./places.yaml#/~1places~1{placeId}~1books" + /places/{placeId}: + $ref: "./places.yaml#/~1places~1{placeId}" + /places/{placeId}/bookmarks: + $ref: "./places.yaml#/~1places~1{placeId}~1bookmarks" diff --git a/src/swagger/places.yaml b/src/swagger/places.yaml new file mode 100644 index 0000000..e4407e8 --- /dev/null +++ b/src/swagger/places.yaml @@ -0,0 +1,280 @@ +/places: + get: + tags: + - places + summary: 장소 가져오기 + security: + - bearerAuth: [] + parameters: + - in: query + name: category + required: true + schema: + type: string + description: 카테고리 + - in: query + name: sortBy + required: false + schema: + type: string + description: 정렬 기준 + - in: query + name: lat + required: true + schema: + type: string + description: lat + - in: query + name: lon + required: true + schema: + type: string + description: lon + - in: query + name: last + required: true + schema: + type: string + description: 마지막 장소 id + responses: + "200": + $ref: "./openapi.yaml#/components/responses/successResponse" + "400": + $ref: "./openapi.yaml#/components/responses/BadRequest" + "500": + $ref: "./openapi.yaml#/components/responses/InternalServerError" +/places/search: + get: + tags: + - places + summary: 장소 검색 + security: + - bearerAuth: [] + parameters: + - in: query + name: keyword + required: true + schema: + type: string + description: 검색어 + - in: query + name: sortBy + required: false + schema: + type: string + description: 정렬 기준 + - in: query + name: lat + required: true + schema: + type: string + description: lat + - in: query + name: lon + required: true + schema: + type: string + description: lon + - in: query + name: last + required: true + schema: + type: string + description: 마지막 장소 id + responses: + "200": + $ref: "./openapi.yaml#/components/responses/successResponse" + "400": + $ref: "./openapi.yaml#/components/responses/BadRequest" + "500": + $ref: "./openapi.yaml#/components/responses/InternalServerError" +/places/{placeId}/reviews: + get: + tags: + - places + summary: 장소 리뷰 보기 + security: + - bearerAuth: [] + parameters: + - in: path + name: placeId + required: true + schema: + type: integer + description: 장소 id + - in: query + name: last + required: true + schema: + type: string + description: 마지막 장소 id + responses: + "200": + $ref: "./openapi.yaml#/components/responses/successResponse" + "400": + $ref: "./openapi.yaml#/components/responses/BadRequest" + "500": + $ref: "./openapi.yaml#/components/responses/InternalServerError" + post: + tags: + - places + summary: 장소 리뷰 작성하기 + security: + - bearerAuth: [] + parameters: + - in: path + name: placeId + required: true + schema: + type: integer + description: 장소 id + - in: body + name: visitedAt + required: true + schema: + type: integer + description: 방문 날짜 + - in: body + name: contents + required: true + schema: + type: integer + description: 리뷰 내용 + - in: body + name: rating + required: true + schema: + type: integer + description: 별점 + responses: + "200": + $ref: "./openapi.yaml#/components/responses/successResponse" + "400": + $ref: "./openapi.yaml#/components/responses/BadRequest" + "500": + $ref: "./openapi.yaml#/components/responses/InternalServerError" +/places/{placeId}/activities: + get: + tags: + - places + summary: 장소 활동 보기 + security: + - bearerAuth: [] + parameters: + - in: path + name: placeId + required: true + schema: + type: integer + description: 장소 id + responses: + "200": + $ref: "./openapi.yaml#/components/responses/successResponse" + "400": + $ref: "./openapi.yaml#/components/responses/BadRequest" + "500": + $ref: "./openapi.yaml#/components/responses/InternalServerError" +/places/{placeId}/news: + get: + tags: + - places + summary: 장소 소식 보기 + security: + - bearerAuth: [] + parameters: + - in: path + name: placeId + required: true + schema: + type: integer + description: 장소 id + responses: + "200": + $ref: "./openapi.yaml#/components/responses/successResponse" + "400": + $ref: "./openapi.yaml#/components/responses/BadRequest" + "500": + $ref: "./openapi.yaml#/components/responses/InternalServerError" +/places/{placeId}/books: + get: + tags: + - places + summary: 장소에 있는 책 목록 보기 + security: + - bearerAuth: [] + parameters: + - in: path + name: placeId + required: true + schema: + type: integer + description: 장소 id + responses: + "200": + $ref: "./openapi.yaml#/components/responses/successResponse" + "400": + $ref: "./openapi.yaml#/components/responses/BadRequest" + "500": + $ref: "./openapi.yaml#/components/responses/InternalServerError" +/places/{placeId}: + get: + tags: + - places + summary: 장소 세부 페이지 + security: + - bearerAuth: [] + parameters: + - in: path + name: placeId + required: true + schema: + type: integer + description: 장소 id + responses: + "200": + $ref: "./openapi.yaml#/components/responses/successResponse" + "400": + $ref: "./openapi.yaml#/components/responses/BadRequest" + "500": + $ref: "./openapi.yaml#/components/responses/InternalServerError" +/places/{placeId}/bookmarks: + post: + tags: + - places + summary: 장소 북마크 + security: + - bearerAuth: [] + parameters: + - in: path + name: placeId + required: true + schema: + type: integer + description: 장소 id + responses: + "200": + $ref: "./openapi.yaml#/components/responses/successResponse" + "400": + $ref: "./openapi.yaml#/components/responses/BadRequest" + "500": + $ref: "./openapi.yaml#/components/responses/InternalServerError" + delete: + tags: + - places + summary: 장소 북마크 취소 + security: + - bearerAuth: [] + parameters: + - in: path + name: placeId + required: true + schema: + type: integer + description: 장소 id + responses: + "200": + $ref: "./openapi.yaml#/components/responses/successResponse" + "400": + $ref: "./openapi.yaml#/components/responses/BadRequest" + "500": + $ref: "./openapi.yaml#/components/responses/InternalServerError" diff --git a/src/swagger/swagger.yaml b/src/swagger/swagger.yaml deleted file mode 100644 index 2e30dd3..0000000 --- a/src/swagger/swagger.yaml +++ /dev/null @@ -1,797 +0,0 @@ -openapi: 3.1.0 -info: - title: API Title - version: 1.0.0 -servers: - - url: 'http://localhost:3000/' - - url: 'http://bookjam-dev-env.eba-rpmq2cwb.ap-northeast-3.elasticbeanstalk.com/' -components: - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT - schemas: - Error: - type: object - properties: - success: - type: boolean - message: - type: string - responses: - successResponse: - description: successful request with no data - content: - application/json: - schema: - type: object - example: - status: 200 - isSuccess: true - code: 1000 - message: OK - BadRequest: - description: 잘못된 요청 - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - example: - status: 400 - isSuccess: true - code: 3000 - message: invalid request - InternalServerError: - description: 서버 에러 - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - example: - status: 500 - isSuccess: true - code: 4000 - message: server error -paths: - '/activities/{activityId}': - get: - tags: - - activities - summary: 활동 상세 가져오기 - security: - - bearerAuth: [] - parameters: - - in: path - name: activityId - required: true - schema: - type: integer - description: 활동 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - '/activities/{activityId}/likes': - post: - tags: - - activities - summary: 활동 좋아요 누르기 - security: - - bearerAuth: [] - parameters: - - in: path - name: activityId - required: true - schema: - type: integer - description: 활동 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - delete: - tags: - - activities - summary: 활동 좋아요 취소하기 - security: - - bearerAuth: [] - parameters: - - in: path - name: activityId - required: true - schema: - type: integer - description: 활동 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /auth/friends: - get: - tags: - - auth - summary: 추천 친구 목록 - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /auth/refresh: - get: - tags: - - auth - summary: Access token refresh - security: - - bearerAuth: [] - parameters: - - in: path - name: activityId - required: true - schema: - type: integer - description: 활동 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /auth/email-check: - post: - tags: - - auth - summary: 이미 가입한 이메일인지 확인 - parameters: - - in: body - name: email - required: true - schema: - type: string - description: 확인할 이메일 주소 - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /auth/sign-up: - post: - tags: - - auth - summary: 회원가입 - parameters: - - in: body - name: email - required: true - schema: - type: string - description: 이메일 - - in: body - name: password - required: true - schema: - type: string - description: 비밀번호 - - in: body - name: username - required: true - schema: - type: string - description: 유저명 - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /auth/login: - post: - tags: - - auth - summary: 로그인 - parameters: - - in: body - name: email - required: true - schema: - type: string - description: 활동 id - - in: body - name: password - required: true - schema: - type: string - description: 활동 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /books/list: - get: - tags: - - books - summary: 가게 저장하기 - security: - - bearerAuth: [] - parameters: - - in: query - name: title - required: true - schema: - type: string - description: 검색할 책 제목 - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /records/friends: - post: - tags: - - records - security: - - bearerAuth: [] - parameters: - - in: query - name: friendId - required: false - schema: - type: integer - description: '친구 id(있으면 해당 친구의 기록만, 없으면 모든 친구들의 기록)' - - in: query - name: last - required: false - schema: - type: integer - description: 마지막으로 본 기록 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /records: - post: - tags: - - records - security: - - bearerAuth: [] - parameters: - - in: body - name: place - required: true - schema: - type: integer - description: 장소 id - - in: body - name: isbn - required: true - schema: - type: integer - description: 책 isbn - - in: body - name: date - required: true - schema: - type: datetime - description: 날짜 - - in: body - name: emotions - required: true - schema: - type: integer - description: 감정 - - in: body - name: activity - required: true - schema: - type: integer - description: 활동 id - - in: body - name: contents - required: true - schema: - type: string - description: 기록 내용 - - in: body - name: isNotPublic - required: true - schema: - type: string - description: 공개 여부 - - in: body - name: commentNotAllowed - required: true - schema: - type: string - description: 댓글 작성 가능 여부 - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - '/records/{recordId}/images': - post: - tags: - - records - security: - - bearerAuth: [] - parameters: - - in: path - name: recordId - required: true - schema: - type: integer - description: 기록 id - requestBody: - content: - multipart/form-data: - schema: - type: object - properties: - images: - type: array - items: - type: string - format: binary - description: 사진 array(binary) - encoding: - images: - contentType: 'image/png, image/jpeg' - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - delete: - tags: - - records - security: - - bearerAuth: [] - parameters: - - in: path - name: recordId - required: true - schema: - type: integer - description: 기록 id - - in: body - name: recordImagesId - required: true - schema: - type: array - items: - type: integer - description: 사진 id array - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - '/records/{recordId}': - put: - tags: - - records - security: - - bearerAuth: [] - parameters: - - in: path - name: recordId - required: true - schema: - type: integer - description: 기록 id - - in: body - name: place - required: true - schema: - type: integer - description: 장소 id - - in: body - name: isbn - required: true - schema: - type: integer - description: 책 isbn - - in: body - name: date - required: true - schema: - type: datetime - description: 날짜 - - in: body - name: emotions - required: true - schema: - type: integer - description: 감정 - - in: body - name: activity - required: true - schema: - type: integer - description: 활동 id - - in: body - name: contents - required: true - schema: - type: string - description: 기록 내용 - - in: body - name: isNotPublic - required: true - schema: - type: string - description: 공개 여부 - - in: body - name: commentNotAllowed - required: true - schema: - type: string - description: 댓글 작성 가능 여부 - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - '/records/comment/{commentId}': - patch: - tags: - - records - security: - - bearerAuth: [] - parameters: - - in: path - name: commentId - required: true - schema: - type: integer - description: 댓글 id - - in: body - name: contents - required: true - schema: - type: string - description: 댓글 내용 - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - '/reviews/{reviewId}': - delete: - tags: - - reviews - summary: 리뷰 삭제 - security: - - bearerAuth: [] - parameters: - - in: path - name: reviewId - required: true - schema: - type: integer - description: 리뷰 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - '/reviews/{reviewId}/images': - post: - tags: - - reviews - summary: 리뷰 이미지 저장 - security: - - bearerAuth: [] - parameters: - - in: path - name: reviewId - required: true - schema: - type: integer - description: 리뷰 id - requestBody: - content: - multipart/form-data: - schema: - type: object - properties: - images: - type: array - items: - type: string - format: binary - description: '사진 array(binary), 최대 5개' - encoding: - images: - contentType: 'image/png, image/jpeg' - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /users/records: - get: - tags: - - users - summary: 내가 쓴 기록들 가져오기 - security: - - bearerAuth: [] - parameters: - - in: query - name: lastId - required: true - schema: - type: integer - description: 마지막 기록 id - - in: query - name: category - required: true - schema: - type: integer - description: 기록한 장소 카테고리 - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /users/outline: - get: - tags: - - users - summary: 마이 페이지 전체 개요 - security: - - bearerAuth: [] - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - '/users/record/{recordId}': - get: - tags: - - users - summary: 내 기록 상세 (update용) - security: - - bearerAuth: [] - parameters: - - in: path - name: recordId - required: true - schema: - type: integer - description: 기록 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /users/activities: - get: - tags: - - users - summary: 내가 참여한 활동 가져오기 - security: - - bearerAuth: [] - parameters: - - in: query - name: lastId - required: true - schema: - type: integer - description: 마지막으로 본 활동 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /users/reviews: - get: - tags: - - users - summary: 내가 쓴 기록들 가져오기 - security: - - bearerAuth: [] - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /users/search: - get: - tags: - - users - summary: 사용자 검색 - security: - - bearerAuth: [] - parameters: - - in: query - name: keyword - required: true - schema: - type: integer - description: 검색어 - - in: query - name: last - required: true - schema: - type: integer - description: 마지막으로 본 유저 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /users/following: - post: - tags: - - users - summary: 유저 팔로우 - security: - - bearerAuth: [] - parameters: - - in: body - name: targetUserId - required: true - schema: - type: integer - description: 유저 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /users/username: - patch: - tags: - - users - summary: 유저명 수정 - security: - - bearerAuth: [] - parameters: - - in: body - name: username - required: true - schema: - type: string - description: 바꿀 유저 명 - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /users/password: - patch: - tags: - - users - summary: 활동 상세 가져오기 - security: - - bearerAuth: [] - parameters: - - in: body - name: password - required: true - schema: - type: string - description: 바꿀 비밀번호 - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /users/profile: - get: - tags: - - users - summary: 프로필 사진 변경 - security: - - bearerAuth: [] - requestBody: - content: - multipart/form-data: - schema: - type: object - properties: - images: - type: string - format: binary - description: 프로필 사진 - encoding: - images: - contentType: 'image/png, image/jpeg' - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /users/disabled: - get: - tags: - - users - summary: 회원 탈퇴 - security: - - bearerAuth: [] - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - '/users/following/{targetUserId}': - delete: - tags: - - users - summary: 유저 팔로우 취소 - security: - - bearerAuth: [] - parameters: - - in: path - name: targetUserId - required: true - schema: - type: integer - description: 유저 id - responses: - '200': - $ref: '#/components/responses/successResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError'