From b0f079f7873f62985e7d15cf0b87c6b817d965a4 Mon Sep 17 00:00:00 2001 From: ma91n Date: Fri, 31 May 2024 17:34:12 +0900 Subject: [PATCH 1/3] 1st commit openapi.yaml --- .../openapi.yaml" | 380 ++++++++++++++++++ 1 file changed, 380 insertions(+) create mode 100644 "documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" diff --git "a/documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" "b/documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" new file mode 100644 index 00000000..bae4d130 --- /dev/null +++ "b/documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" @@ -0,0 +1,380 @@ +openapi: 3.0.3 +info: + title: Future Muscle Partner API + description: パーソナルトレーナーのマッチング + version: 1.0.0 +tags: + - name: account + description: アカウント管理 + - name: profile + description: プロフィール + - name: trainer + description: パーソナルトレーナー + - name: booking + description: 予約 + - name: payment + description: 決済 +security: + - Bearer: [] +paths: + /login: + post: + tags: + - account + summary: "[API01] ログインAPI" + operationId: loginUser + security: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/LoginRequest' + responses: + '200': + description: ログインに成功しました。 + /logout: + post: + tags: + - account + summary: "[API02] ログアウトAPI" + operationId: logoutUser + security: [] + responses: + '200': + description: ログアウトに成功しました。 + /Signin: + post: + tags: + - account + summary: "[API03] 会員登録API" + operationId: registerUser + security: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SigninRequest' + responses: + '200': + description: 会員登録に成功しました。 + /Signout: + post: + tags: + - account + summary: "[API04] 会員退会API" + operationId: signoutUser + responses: + '200': + description: 会員退会に成功しました。 + /profile: + get: + tags: + - profile + summary: "[API05] 自分のプロフィール表示API" + operationId: getUserProfile + responses: + '200': + description: プロフィールの取得に成功しました。 + /trainers: + get: + tags: + - trainer + summary: "[API07] パーソナルトレーナー検索API" + operationId: searchTrainers + security: [] + responses: + '200': + description: トレーナーの検索結果を取得しました。 + /trainers/{trainerId}/menu: + get: + tags: + - trainer + summary: "[API08] トレーニングメニュー取得API" + operationId: getTrainingMenu + security: [] + parameters: + - name: trainerId + in: path + description: トレーナーのID + required: true + schema: + type: string + responses: + '200': + description: トレーニングメニューを取得しました。 + /trainers/{trainerId}/profile: + get: + tags: + - trainer + summary: "[API09] トレーナープロフィール取得API" + operationId: getTrainerProfile + security: [] + parameters: + - name: trainerId + in: path + description: トレーナーのID + required: true + schema: + type: string + responses: + '200': + description: トレーナープロフィールを取得しました。 + /trainers/{trainerId}/reviews: + get: + tags: + - trainer + summary: "[API10] トレーナー口コミ取得API" + operationId: getTrainerReviews + security: [] + parameters: + - name: trainerId + in: path + description: トレーナーのID + required: true + schema: + type: string + responses: + '200': + description: トレーナーの口コミを取得しました。 + /trainers/{trainerId}/schedule: + get: + tags: + - trainer + summary: "[API11] トレーナースケジュール取得API" + operationId: getTrainerSchedule + security: [] + parameters: + - name: trainerId + in: path + description: トレーナーのID + required: true + schema: + type: string + responses: + '200': + description: トレーナーのスケジュールを取得しました。 + /bookings: + get: + tags: + - booking + summary: "[API06] 予約済みトレーニング取得API" + operationId: getBookings + responses: + '200': + description: ユーザーの予約情報を取得しました。 + post: + tags: + - booking + summary: "[API12] トレーニング予約API(仮登録)" + operationId: bookTraining + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/BookingRequest' + responses: + '200': + description: 予約が仮登録されました。 + /bookings/{bookingId}/confirm: + post: + tags: + - booking + summary: "[API14] トレーニング予約API(本登録)" + operationId: confirmBooking + parameters: + - name: bookingId + in: path + description: 予約ID + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/BookingConfirmationRequest' + responses: + '200': + description: 予約が本登録されました。 + /booking/{bookingId}/status: + put: + tags: + - booking + summary: "[API14] トレーニング受講ステータス変更API" + operationId: updateTrainingStatus + parameters: + - name: bookingId + in: path + description: 予約ID + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TrainingStatusUpdateRequest' + responses: + '200': + description: ステータスが更新されました。 + /payment: + post: + tags: + - payment + summary: "[API13] 決済API" + operationId: makePayment + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequest' + responses: + '200': + description: 決済が完了しました。 +components: + schemas: + ProblemDetailError: + description: A Problem Details object (RFC 9457) + type: object + properties: + title: + type: string + description: A short summary of the problem type. Written in English and readable for engineers (usually not suited for non technical stakeholders and not localized). + example: Service Unavailable + status: + type: integer + format: int32 + description: The HTTP status code generated by the origin server for this occurrence of the problem. + minimum: 400 + maximum: 600 + exclusiveMaximum: true + example: 503 + detail: + type: string + description: A human-readable explanation specific to this occurrence of the problem + example: + title: Description of the type of problem that occurred + status: 400 # HTTP response status, appropriate for the problem type + detail: Description of specific occurrence of the problem + + LoginRequest: + type: object + properties: + email: + type: string + format: email + description: メールアドレス + password: + type: string + format: password + description: パスワード + SigninRequest: + type: object + properties: + email: + type: string + format: email + description: メールアドレス + password: + type: string + format: password + description: パスワード + name: + type: string + description: 名前 + BookingRequest: + type: object + properties: + trainingId: + type: string + description: トレーニングのID + date: + type: string + format: date + description: トレーニングの日付 + PaymentRequest: + type: object + properties: + amount: + type: number + format: double + description: 支払金額 + method: + type: string + description: 支払方法 + BookingConfirmationRequest: + type: object + properties: + bookingId: + type: string + description: 予約のID + TrainingStatusUpdateRequest: + type: object + properties: + trainingId: + type: string + description: トレーニングのID + status: + type: string + description: ステータス + responses: + BadRequest: + description: 400 Bad Request + content: + application/json: + schema: + $ref: "#/components/schemas/ProblemDetailError" + Unauthorized: + description: 401 Unauthorized + content: + application/json: + schema: + $ref: "#/components/schemas/ProblemDetailError" + Forbidden: + description: 403 Forbidden + content: + application/json: + schema: + $ref: "#/components/schemas/ProblemDetailError" + NotFound: + description: 404 Not Found + content: + application/json: + schema: + $ref: "#/components/schemas/ProblemDetailError" + Conflict: + description: 409 Conflict + content: + application/json: + schema: + $ref: "#/components/schemas/ProblemDetailError" + UnprocessableEntity: + description: 422 Unprocessable Content + content: + application/json: + schema: + $ref: "#/components/schemas/ProblemDetailError" + InternalServer: + description: 500 Internal Server + content: + application/json: + schema: + $ref: "#/components/schemas/ProblemDetailError" + ServiceUnavaliable: + description: 503 Service Unavailable + content: + application/json: + schema: + $ref: "#/components/schemas/ProblemDetailError" + securitySchemes: + Bearer: + type: http + scheme: bearer + bearerFormat: JWT + description: 'Bearer トークン認証' From c71524e4bf9857f8d12744b9f9f5dfd816029885 Mon Sep 17 00:00:00 2001 From: ma91n Date: Fri, 31 May 2024 17:44:49 +0900 Subject: [PATCH 2/3] fix path & error response --- .../openapi.yaml" | 142 +++++++++++++++++- 1 file changed, 139 insertions(+), 3 deletions(-) diff --git "a/documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" "b/documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" index bae4d130..9b0d3d8e 100644 --- "a/documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" +++ "b/documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" @@ -33,6 +33,12 @@ paths: responses: '200': description: ログインに成功しました。 + '400': + $ref: '#/components/responses/BadRequest' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' /logout: post: tags: @@ -43,7 +49,19 @@ paths: responses: '200': description: ログアウトに成功しました。 - /Signin: + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' + /signin: post: tags: - account @@ -59,7 +77,13 @@ paths: responses: '200': description: 会員登録に成功しました。 - /Signout: + '400': + $ref: '#/components/responses/BadRequest' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' + /signout: post: tags: - account @@ -68,6 +92,14 @@ paths: responses: '200': description: 会員退会に成功しました。 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' /profile: get: tags: @@ -77,6 +109,12 @@ paths: responses: '200': description: プロフィールの取得に成功しました。 + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' /trainers: get: tags: @@ -87,6 +125,12 @@ paths: responses: '200': description: トレーナーの検索結果を取得しました。 + '400': + $ref: '#/components/responses/BadRequest' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' /trainers/{trainerId}/menu: get: tags: @@ -104,6 +148,15 @@ paths: responses: '200': description: トレーニングメニューを取得しました。 + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' + /trainers/{trainerId}/profile: get: tags: @@ -121,6 +174,15 @@ paths: responses: '200': description: トレーナープロフィールを取得しました。 + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' + /trainers/{trainerId}/reviews: get: tags: @@ -138,6 +200,14 @@ paths: responses: '200': description: トレーナーの口コミを取得しました。 + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' /trainers/{trainerId}/schedule: get: tags: @@ -155,6 +225,14 @@ paths: responses: '200': description: トレーナーのスケジュールを取得しました。 + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' /bookings: get: tags: @@ -164,6 +242,12 @@ paths: responses: '200': description: ユーザーの予約情報を取得しました。 + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' post: tags: - booking @@ -178,6 +262,19 @@ paths: responses: '200': description: 予約が仮登録されました。 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '409': + $ref: '#/components/responses/Conflict' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' + /bookings/{bookingId}/confirm: post: tags: @@ -200,6 +297,18 @@ paths: responses: '200': description: 予約が本登録されました。 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '409': + $ref: '#/components/responses/Conflict' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' /booking/{bookingId}/status: put: tags: @@ -222,6 +331,20 @@ paths: responses: '200': description: ステータスが更新されました。 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' /payment: post: tags: @@ -237,6 +360,19 @@ paths: responses: '200': description: 決済が完了しました。 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '409': + $ref: '#/components/responses/Conflict' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' + components: schemas: ProblemDetailError: @@ -366,7 +502,7 @@ components: application/json: schema: $ref: "#/components/schemas/ProblemDetailError" - ServiceUnavaliable: + ServiceUnavailable: description: 503 Service Unavailable content: application/json: From 578e291c3dd8903f350158a4fbc2f5acbdeb492c Mon Sep 17 00:00:00 2001 From: ma91n Date: Sun, 2 Jun 2024 18:42:00 +0900 Subject: [PATCH 3/3] Add openapi.yaml --- .../openapi.yaml" | 208 +++++++++++++++++- 1 file changed, 198 insertions(+), 10 deletions(-) diff --git "a/documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" "b/documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" index 9b0d3d8e..a8d4bbb8 100644 --- "a/documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" +++ "b/documents/forMarkdown/future_muscle_partner/docs/04_WebAPI\350\250\255\350\250\210/openapi.yaml" @@ -12,8 +12,12 @@ tags: description: パーソナルトレーナー - name: booking description: 予約 + - name: review + description: レビュー - name: payment description: 決済 + - name: provider + description: パーソナルトレーニング提供者 security: - Bearer: [] paths: @@ -119,7 +123,7 @@ paths: get: tags: - trainer - summary: "[API07] パーソナルトレーナー検索API" + summary: "[API06] パーソナルトレーナー検索API" operationId: searchTrainers security: [] responses: @@ -135,7 +139,7 @@ paths: get: tags: - trainer - summary: "[API08] トレーニングメニュー取得API" + summary: "[API07] トレーニングメニュー取得API" operationId: getTrainingMenu security: [] parameters: @@ -161,7 +165,7 @@ paths: get: tags: - trainer - summary: "[API09] トレーナープロフィール取得API" + summary: "[API08] トレーナープロフィール取得API" operationId: getTrainerProfile security: [] parameters: @@ -182,12 +186,11 @@ paths: $ref: '#/components/responses/InternalServer' '503': $ref: '#/components/responses/ServiceUnavailable' - /trainers/{trainerId}/reviews: get: tags: - trainer - summary: "[API10] トレーナー口コミ取得API" + summary: "[API09] トレーナー口コミ取得API" operationId: getTrainerReviews security: [] parameters: @@ -212,7 +215,7 @@ paths: get: tags: - trainer - summary: "[API11] トレーナースケジュール取得API" + summary: "[API10] トレーナースケジュール取得API" operationId: getTrainerSchedule security: [] parameters: @@ -237,7 +240,7 @@ paths: get: tags: - booking - summary: "[API06] 予約済みトレーニング取得API" + summary: "[API11] 予約済みトレーニング取得API" operationId: getBookings responses: '200': @@ -274,7 +277,32 @@ paths: $ref: '#/components/responses/InternalServer' '503': $ref: '#/components/responses/ServiceUnavailable' - + /bookings/{bookingId}: + delete: + tags: + - booking + summary: "[API13] トレーニング予約削除" + operationId: deleteBooking + parameters: + - name: bookingId + in: path + description: 予約ID + required: true + schema: + type: string + responses: + '200': + description: 予約が削除されました。 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServer' + '503': + $ref: '#/components/responses/ServiceUnavailable' /bookings/{bookingId}/confirm: post: tags: @@ -313,7 +341,7 @@ paths: put: tags: - booking - summary: "[API14] トレーニング受講ステータス変更API" + summary: "[API15] トレーニング受講ステータス変更API" operationId: updateTrainingStatus parameters: - name: bookingId @@ -349,7 +377,7 @@ paths: post: tags: - payment - summary: "[API13] 決済API" + summary: "[API16] 決済API" operationId: makePayment requestBody: required: true @@ -372,6 +400,132 @@ paths: $ref: '#/components/responses/InternalServer' '503': $ref: '#/components/responses/ServiceUnavailable' + /reviews: + post: + tags: + - review + summary: "[API17] 口コミ登録" + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Review' + responses: + '200': + description: 口コミ登録成功 + /reviews/{reviewId}: + put: + tags: + - review + summary: "[API18] 口コミ修正" + parameters: + - name: reviewId + in: path + description: 口コミID + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Review' + responses: + '200': + description: 口コミ修正成功 + delete: + tags: + - review + summary: "[API19] 口コミ削除" + parameters: + - name: reviewId + in: path + description: 口コミID + required: true + schema: + type: string + responses: + '200': + description: 口コミ削除成功 + /trainer-register: + post: + tags: + - provider + summary: "[API20] トレーナー登録" + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Trainer' + responses: + '200': + description: トレーナー登録成功 + /trainer-attributes: + put: + tags: + - provider + summary: "[API21]トレーナー属性更新" + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TrainerAttributes' + responses: + '200': + description: トレーナー属性更新成功 + /training-menus: + post: + tags: + - provider + summary: "[API22] トレーニングメニュー登録" + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TrainingMenu' + responses: + '200': + description: トレーニングメニュー登録成功 + /training-menu/{menuId}: + put: + tags: + - provider + summary: "[API23] トレーニングメニュー更新" + parameters: + - name: menuId + in: path + description: メニューID + required: true + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TrainingMenu' + responses: + '200': + description: トレーニングメニュー更新成功 + delete: + tags: + - provider + summary: "[API24] トレーニングメニュー削除" + parameters: + - name: menuId + in: path + description: メニューID + required: true + schema: + type: integer + responses: + '200': + description: トレーニングメニュー削除成功 components: schemas: @@ -459,6 +613,40 @@ components: status: type: string description: ステータス + Review: + type: object + properties: + id: + type: string + title: + type: string + content: + type: string + Trainer: + type: object + properties: + id: + type: string + name: + type: string + age: + type: integer + TrainerAttributes: + type: object + properties: + speciality: + type: string + experience: + type: integer + TrainingMenu: + type: object + properties: + id: + type: string + name: + type: string + description: + type: string responses: BadRequest: description: 400 Bad Request