init
[risinglegends.git] / src / server / shopItem.ts
1 import { db } from '@lib/db';
2 import {ShopItem} from '@shared/inventory';
3
4 export function listShopItems(where: Partial<ShopItem>): Promise<ShopItem[]> {
5   return db.select('*').from<ShopItem>('shop_items')
6         .where(where)
7         .orderBy('requirement_level')
8         .orderBy('type')
9         .orderBy('subType');
10 }
11
12 export function getShopItem(id: string): Promise<ShopItem> {
13   return db.select('*').from<ShopItem>('shop_items').where({
14     id
15   }).first();
16 }