From c6b9355bd1a5661e7bb8852f089569330176d5a2 Mon Sep 17 00:00:00 2001 From: RanolP Date: Sun, 17 Mar 2024 22:45:49 +0900 Subject: [PATCH] feat: migrate /ranking/rival --- src/openapi.yaml | 21 -------------- src/operations/ranking/_barrel.tsp | 1 + src/operations/ranking/rival.tsp | 37 ++++++++++++++++++++++++ src/paths/ranking/rival.yaml | 45 ------------------------------ 4 files changed, 38 insertions(+), 66 deletions(-) create mode 100644 src/operations/ranking/rival.tsp delete mode 100644 src/paths/ranking/rival.yaml diff --git a/src/openapi.yaml b/src/openapi.yaml index 4baaa6e..cf9ff81 100644 --- a/src/openapi.yaml +++ b/src/openapi.yaml @@ -2,25 +2,6 @@ --- openapi: "3.1.0" - -tags: - - name: "account" - description: "계정과 관련이 있는 API입니다" - - name: "badge" - description: "뱃지와 관련이 있는 API입니다" - - name: "background" - description: "배경과 관련이 있는 API입니다" - - name: "coins" - description: "코인/별조각과 관련이 있는 API입니다" - - name: "other" - description: "아직 분류하지 못한 API입니다" - - name: "problem" - description: "문제와 관련이 있는 API입니다" - - name: "search" - description: "검색과 관련이 있는 API입니다" - - name: "user" - description: "사용자와 관련이 있는 API입니다" - paths: /account/verify_credentials: $ref: "./paths/account/verify_credentials.yaml#/paths/Path" @@ -36,8 +17,6 @@ paths: description: "TODO" /ranking/tier: $ref: "./paths/ranking/tier.yaml#/paths/Path" - /ranking/rival: - $ref: "./paths/ranking/rival.yaml#/paths/Path" /ranking/organization: $ref: "./paths/ranking/organization.yaml#/paths/Path" /search/suggestion: diff --git a/src/operations/ranking/_barrel.tsp b/src/operations/ranking/_barrel.tsp index a9d31b4..e93b853 100644 --- a/src/operations/ranking/_barrel.tsp +++ b/src/operations/ranking/_barrel.tsp @@ -2,3 +2,4 @@ import "./contribution.tsp"; import "./class.tsp"; import "./streak.tsp"; import "./reverse_rival.tsp"; +import "./rival.tsp"; diff --git a/src/operations/ranking/rival.tsp b/src/operations/ranking/rival.tsp new file mode 100644 index 0000000..faa75d5 --- /dev/null +++ b/src/operations/ranking/rival.tsp @@ -0,0 +1,37 @@ +using TypeSpec.Http; +using TypeSpec.OpenAPI; + +namespace SolvedAC; + +/** + * 라이벌인 사용자 중에서 티어가 높은 사용자가 먼저 오도록 정렬한 목록을 가져옵니다. + * + * @return + * 페이지네이션 가능한 사용자 목록을 반환합니다. + */ +@summary("티어 순 라이벌 랭킹 가져오기") +@tag("ranking") +@useAuth(TokenAuth) +@get +@route("/ranking/rival") +op getRivalRankingByTier( + /** + * 응답을 받을 언어입니다. + */ + @header + `x-solvedac-language`?: Language, + + /** + * 페이지 + */ + @query + page?: uint32, +): GetRivalRankingByTier.Ok | Unauthorized; + +namespace GetRivalRankingByTier { + @extension(XInternal, true) + model Ok { + @statusCode status: 200; + @body data: PaginatedList; + } +} diff --git a/src/paths/ranking/rival.yaml b/src/paths/ranking/rival.yaml deleted file mode 100644 index 88dbbb5..0000000 --- a/src/paths/ranking/rival.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# yaml-language-server: $schema=https://spec.openapis.org/oas/3.1/schema/2021-05-20 ---- -# for the intellisense -openapi: "3.1.0" -info: { title: "", version: "" } - -paths: - Path: - get: - summary: "라이벌 순위 가져오기" - description: "현재 사용자의 라이벌 티어 순위를 가져옵니다." - tags: - - ranking - operationId: getRivalRanking - - security: - - solvedacToken: [] - - parameters: - - name: "page" - in: "query" - description: "페이지" - schema: - type: "number" - - responses: - "403": - description: "solvedacToken이 올바르지 않은 경우입니다." - "200": - description: "서버가 반환에 성공한 경우입니다." - content: - application/json: - schema: - type: "object" - properties: - count: - description: "순위가 배정된 라이벌의 수입니다." - type: "integer" - format: "int64" - example: 26 - items: - description: "티어 순위로 정렬된 라이벌 목록입니다." - type: "array" - items: - $ref: "../../schemas/user.yaml#/components/schemas/User"