Adds get and list routes for customers

This commit is contained in:
olivermrbl
2020-07-07 21:24:35 +02:00
parent 5bca1a793c
commit 9265ea2a9d
2 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
export default async (req, res) => {
const { id } = req.params
try {
const customerService = req.scope.resolve("customerService")
let customer = await customerService.retrieve(id)
res.json({ customer })
} catch (err) {
throw err
}
}

View File

@@ -0,0 +1,12 @@
export default async (req, res) => {
const selector = {}
try {
const customerService = req.scope.resolve("customerService")
const customers = await customerService.list(selector)
res.json({ customers })
} catch (error) {
throw error
}
}