Adds get and list routes for customers
This commit is contained in:
1 parent
5bca1a793c
commit
9265ea2a9d
2 files changed
+22
No files matched your search
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user