Skip to content

Commit

Permalink
feat: migrate /ranking/class
Browse files Browse the repository at this point in the history
  • Loading branch information
RanolP committed Mar 16, 2024
1 parent 058fbe1 commit c36fa07
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 47 deletions.
17 changes: 17 additions & 0 deletions src/models/RivalUser.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace SolvedAC;

model RivalUser is User {
/**
* 라이벌 여부입니다.
*
* @example false
*/
isRival: boolean;

/**
* 역라이벌 여부입니다.
*
* @example false
*/
isReverseRival: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace SolvedAC;
/**
* solved.ac 사용자 정보입니다.
*/
model UserWithSocial is User {
model SocialUser is User {
/**
* 라이벌 여부입니다.
*
Expand Down
4 changes: 3 additions & 1 deletion src/models/User.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ model User {
proUntil: offsetDateTime;

/**
* 사용자의 문제 풀이 레이팅 순위입니다.
* 사용자의 순위입니다.
* 이 값은 요청하는 엔드포인트의 정렬 기준에 따라 다를 수 있습니다.
* 예) /ranking/* 엔드포인트에서는 해당 랭킹의 순위, /show 엔드포인트에서는 문제풀이 레이팅 순위
*
* @example 130
*/
Expand Down
3 changes: 2 additions & 1 deletion src/models/_barrel.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ import "./ProblemTagAlias.tsp";
import "./ProblemTag.tsp";
import "./PaginatedList.tsp";
import "./User.tsp";
import "./RivalUser.tsp";
import "./SocialUser.tsp";
import "./ArenaTier.tsp";
import "./UserWithSocial.tsp";
2 changes: 0 additions & 2 deletions src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ paths:
$ref: "./paths/problem/class.yaml#/paths/Path"
/ranking/tier:
$ref: "./paths/ranking/tier.yaml#/paths/Path"
/ranking/class:
$ref: "./paths/ranking/class.yaml#/paths/Path"
/ranking/streak:
$ref: "./paths/ranking/streak.yaml#/paths/Path"
/ranking/rival:
Expand Down
1 change: 1 addition & 0 deletions src/operations/ranking/_barrel.tsp
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import "./contribution.tsp";
import "./class.tsp";
35 changes: 35 additions & 0 deletions src/operations/ranking/class.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace SolvedAC;

/**
* CLASS가 높은 사용자가 먼저 오도록 정렬한 사용자 목록을 가져옵니다.
*
* @return
* 페이지네이션 가능한 사용자 목록을 반환합니다.
*/
@summary("CLASS 순으로 정렬해 사용자 목록 가져오기")
@tag("ranking")
@get
@route("/ranking/class")
op getRankingByClass(
/**
* 응답을 받을 언어입니다.
*/
@header
`x-solvedac-language`?: Language,

/**
* 페이지
*/
@query
page?: uint32,
): GetRankingByClass.Ok;

namespace GetRankingByClass {
@extension(XInternal, true)
model Ok is PaginatedList<RivalUser> {
@statusCode status: 200;
}
}
2 changes: 1 addition & 1 deletion src/operations/ranking/contribution.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ op getRankingByContribution(

namespace GetRankingByContribution {
@extension(XInternal, true)
model Ok is PaginatedList<User> {
model Ok is PaginatedList<RivalUser> {
@statusCode status: 200;
}
}
2 changes: 1 addition & 1 deletion src/operations/user/show.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ op getUserByHandle(

namespace GetUserByHandle {
@extension(XInternal, true)
model Ok is UserWithSocial {
model Ok is SocialUser {
@statusCode status: 200;
}
}
40 changes: 0 additions & 40 deletions src/paths/ranking/class.yaml

This file was deleted.

0 comments on commit c36fa07

Please sign in to comment.