Skip to content

Commit

Permalink
feat: migrate /coins/shop/list
Browse files Browse the repository at this point in the history
  • Loading branch information
RanolP committed Apr 3, 2024
1 parent 5b61bb9 commit 7fa706d
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 127 deletions.
47 changes: 47 additions & 0 deletions src/models/CoinShopProduct.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using TypeSpec.OpenAPI;

namespace SolvedAC;

/**
* 코인샵에서 판매하고 있는 상품입니다.
*/
model CoinShopProduct {
/**
* 재고(Stock Keeping Unit) ID입니다.
* @example 1
*/
skuId: uint32;

item: Item;

/**
* 1회 구매 시 획득하는 아이템 개수입니다.
* @example 1
*/
units: uint32;

/**
* 가격입니다.
* 코인의 경우 나누기 100을 해야 표시 가격이 됩니다.
* @example 99
*/
price: uint32;

/**
* 가격 단위입니다.
* @example "coins"
*/
priceUnit: "coins" | "stardusts";

/**
* 아이템 사용 시간 제한 여부입니다.
* @example false
*/
itemUseTimeLimited: boolean;

/**
* 아이템 구매 기간 제한 여부입니다.
* @example false
*/
itemSellTimeLimited: boolean;
}
41 changes: 41 additions & 0 deletions src/models/Item.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* 사용자가 사용할 수 있는 아이템입니다.
*/
model Item {
/**
* ID입니다.
* @example "streak-freeze"
*/
itemId: string;

/**
* 아이템 사진으로 가는 하이퍼링크입니다.
* @example "https://static.solved.ac/item/freeze-small-simple.svg"
*/
itemImageUrl: url;

/**
* 최대 소유 가능 개수입니다.
* 사람에 따라 다를 수 있습니다.
* @example 2
*/
inventoryMaxUnits: uint32;

/**
* 사용 가능 여부입니다.
* @example true
*/
usable: boolean;

/**
* 국제화된 이름입니다.
* @example "스트릭 프리즈"
*/
displayName: string;

/**
* 국제화된 설명입니다.
* @example "미리 장착해 두면 어제 문제 푸는 걸 잊었더라도 스트릭이 깨지지 않습니다. 단, 스트릭 길이가 늘어나지는 않습니다.\n인벤토리에서 장착해서 사용할 수 있습니다."
*/
displayDescription: string;
}
4 changes: 2 additions & 2 deletions src/models/PaginatedList.tsp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* 페이지네이션 가능한 쿼리의 응답 결과입니다.
*/
model PaginatedList<Item> {
model PaginatedList<T> {
/**
* 전체 원소 수입니다.
*
Expand All @@ -12,5 +12,5 @@ model PaginatedList<Item> {
/**
* 현재 페이지의 원소 목록입니다.
*/
items: Item[];
items: T[];
}
2 changes: 2 additions & 0 deletions src/models/_barrel.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ import "./RivalUser.tsp";
import "./SocialUser.tsp";
import "./ArenaTier.tsp";
import "./Class.tsp";
import "./CoinShopProduct.tsp";
import "./Item.tsp";
6 changes: 0 additions & 6 deletions src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ openapi: "3.1.0"
paths:
/account/verify_credentials:
$ref: "./paths/account/verify_credentials.yaml#/paths/Path"
/coins/shop/list:
$ref: "./paths/coins/shop/list.yaml#/paths/Path"
/ranking/organization:
$ref: "./paths/ranking/organization.yaml#/paths/Path"
/user/organizations:
Expand All @@ -16,12 +14,8 @@ paths:

components:
schemas:
CoinshopProduct:
$ref: "./schemas/coinshop-product.yaml#/components/schemas/CoinshopProduct"
IconScheme:
$ref: "./schemas/icon-scheme.yaml#/components/schemas/IconScheme"
Item:
$ref: "./schemas/item.yaml#/components/schemas/Item"
Organization:
$ref: "./schemas/organization.yaml#/components/schemas/Organization"
Settings:
Expand Down
1 change: 1 addition & 0 deletions src/operations/coins/_barrel.tsp
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import "./exchange_rate.tsp";
import "./shop/_barrel.tsp";
1 change: 1 addition & 0 deletions src/operations/coins/shop/_barrel.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./list.tsp";
30 changes: 30 additions & 0 deletions src/operations/coins/shop/list.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace SolvedAC;

/**
* 코인샵에서 팔고 있는 상품 목록을 가져옵니다.
*
* @return
* 상품 목록을 가져옵니다.
*/
@summary("코인샵 상품 목록 가져오기")
@tag("coins")
@get
@route("/coins/shop/list")
op getCoinShopProducts(
/**
* 응답을 받을 언어입니다.
*/
@header
`x-solvedac-language`?: Language,
): GetCoinShopProducts.Ok;

namespace GetCoinShopProducts {
@extension(XInternal, true)
model Ok {
@statusCode status: 200;
@body data: CoinShopProduct[];
}
}
25 changes: 0 additions & 25 deletions src/paths/coins/shop/list.yaml

This file was deleted.

49 changes: 0 additions & 49 deletions src/schemas/coinshop-product.yaml

This file was deleted.

45 changes: 0 additions & 45 deletions src/schemas/item.yaml

This file was deleted.

0 comments on commit 7fa706d

Please sign in to comment.