aboutsummaryrefslogtreecommitdiffstats
path: root/routes/rates.ts
blob: e532ec78e1c4d8fd9381af5d337f70e70178d617 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { g } from "$lib/db";
import { rate } from "$lib/rates";

export default {
  async fx(_, res) {
    const { fx } = await g("fx");
    res.send({ fx });
  },

  async last(_, res) {
    res.send(rate || (await g("rate")));
  },

  async index(_, res) {
    const { date, fx, ...rates } = await g("rates");
    res.send(rates);
  },
};