From f46c5126f716493833407976559fd15bde30bf22 Mon Sep 17 00:00:00 2001 From: RanolP Date: Sun, 17 Mar 2024 02:26:48 +0900 Subject: [PATCH] feat: migrate /user/top_100 --- src/openapi.yaml | 2 -- src/operations/user/_barrel.tsp | 1 + src/operations/user/top_100.tsp | 35 +++++++++++++++++++++++++++ src/paths/user/top_100.yaml | 42 --------------------------------- 4 files changed, 36 insertions(+), 44 deletions(-) create mode 100644 src/operations/user/top_100.tsp delete mode 100644 src/paths/user/top_100.yaml diff --git a/src/openapi.yaml b/src/openapi.yaml index 86fbecf..bc22d5b 100644 --- a/src/openapi.yaml +++ b/src/openapi.yaml @@ -76,8 +76,6 @@ paths: responses: "200": description: "TODO" - /user/top_100: - $ref: "./paths/user/top_100.yaml#/paths/Path" components: schemas: diff --git a/src/operations/user/_barrel.tsp b/src/operations/user/_barrel.tsp index c27a06a..7e56202 100644 --- a/src/operations/user/_barrel.tsp +++ b/src/operations/user/_barrel.tsp @@ -1 +1,2 @@ import "./show.tsp"; +import "./top_100.tsp"; diff --git a/src/operations/user/top_100.tsp b/src/operations/user/top_100.tsp new file mode 100644 index 0000000..38a951c --- /dev/null +++ b/src/operations/user/top_100.tsp @@ -0,0 +1,35 @@ +using TypeSpec.Http; +using TypeSpec.OpenAPI; + +namespace SolvedAC; + +/** + * 사용자가 푼 문제 중 문제 수준이 높은 상위 100 문제를 가져옵니다 + * + * @return + * 상위 100 문제 목록 + */ +@summary("상위 100 문제 가져오기") +@tag("user") +@get +@route("/user/top_100") +op getUserTop100( + /** + * 응답을 받을 언어입니다. + */ + @header + `x-solvedac-language`?: Language, + + /** + * 요청할 사용자명 + */ + @query + handle: string, +): GetUserTop100.Ok; + +namespace GetUserTop100 { + @extension(XInternal, true) + model Ok is PaginatedList { + @statusCode status: 200; + } +} diff --git a/src/paths/user/top_100.yaml b/src/paths/user/top_100.yaml deleted file mode 100644 index 001ad85..0000000 --- a/src/paths/user/top_100.yaml +++ /dev/null @@ -1,42 +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: "상위 100문제 가져오기" - description: "사용자가 푼 문제 중 상위 100문제를 가져옵니다." - tags: - - user - operationId: getTop100 - - parameters: - - name: "handle" - in: "query" - description: "사용자 ID" - required: true - schema: - type: "string" - - responses: - "200": - description: "서버가 반환에 성공한 경우입니다." - content: - application/json: - schema: - type: "object" - properties: - count: - description: "문제 수입니다." - type: "integer" - format: "int64" - example: 1 - maximum: 100 - items: - description: "문제 목록입니다." - type: "array" - items: - $ref: "../../schemas/tagged-problem.yaml#/components/schemas/TaggedProblem"