Adds get and list routes for customers
This commit is contained in:
@@ -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