aboutsummaryrefslogtreecommitdiffstats
path: root/routes/invoices.js
blob: a4155d948129156b3d9484f72e234d1e64278a2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { g, s } from "$lib/db";
import { invoice } from "$lib/invoices";

export default {
  async get({ query: { hash } }, res) {
    let invoice = await g(`invoice:${hash}`);
    invoice.user = await g(`user:${invoice.uid}`);
    res.send(invoice);
  },

  async create({ body: { invoice, user }, user: sender }, res) {
    res.send(await invoice({ invoice, user, sender }));
  }
};