chore: Make packages/medusa/src/api/routes/admin/notifications pass linting (#675)
Co-authored-by: Nicholas Ni <nicholas_ni@intuit.com>
This commit is contained in:
1 parent
95f80f8a66
commit
25ed7dc056
4 files changed
+3
-12
No files matched your search
@@ -30,7 +30,6 @@
|
|||||||
/packages/medusa/src/api/routes/admin/discounts
|
/packages/medusa/src/api/routes/admin/discounts
|
||||||
/packages/medusa/src/api/routes/admin/draft-orders
|
/packages/medusa/src/api/routes/admin/draft-orders
|
||||||
/packages/medusa/src/api/routes/admin/notes
|
/packages/medusa/src/api/routes/admin/notes
|
||||||
/packages/medusa/src/api/routes/admin/notifications
|
|
||||||
/packages/medusa/src/api/routes/admin/orders
|
/packages/medusa/src/api/routes/admin/orders
|
||||||
/packages/medusa/src/api/routes/admin/return-reasons
|
/packages/medusa/src/api/routes/admin/return-reasons
|
||||||
/packages/medusa/src/api/routes/admin/returns
|
/packages/medusa/src/api/routes/admin/returns
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import middlewares from "../../../middlewares"
|
|||||||
|
|
||||||
const route = Router()
|
const route = Router()
|
||||||
|
|
||||||
export default app => {
|
export default (app) => {
|
||||||
app.use("/notifications", route)
|
app.use("/notifications", route)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,13 +21,12 @@ import { defaultRelations, defaultFields } from "./"
|
|||||||
* $ref: "#/components/schemas/notification"
|
* $ref: "#/components/schemas/notification"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
try {
|
|
||||||
const notificationService = req.scope.resolve("notificationService")
|
const notificationService = req.scope.resolve("notificationService")
|
||||||
|
|
||||||
const limit = parseInt(req.query.limit) || 50
|
const limit = parseInt(req.query.limit) || 50
|
||||||
const offset = parseInt(req.query.offset) || 0
|
const offset = parseInt(req.query.offset) || 0
|
||||||
|
|
||||||
let selector = {}
|
const selector = {}
|
||||||
|
|
||||||
let includeFields = []
|
let includeFields = []
|
||||||
if ("fields" in req.query) {
|
if ("fields" in req.query) {
|
||||||
@@ -74,10 +73,7 @@ export default async (req, res) => {
|
|||||||
const notifications = await notificationService.list(selector, listConfig)
|
const notifications = await notificationService.list(selector, listConfig)
|
||||||
|
|
||||||
const fields = [...listConfig.select, ...listConfig.relations]
|
const fields = [...listConfig.select, ...listConfig.relations]
|
||||||
const data = notifications.map(o => _.pick(o, fields))
|
const data = notifications.map((o) => _.pick(o, fields))
|
||||||
|
|
||||||
res.json({ notifications: data, offset, limit })
|
res.json({ notifications: data, offset, limit })
|
||||||
} catch (error) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,6 @@ export default async (req, res) => {
|
|||||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const notificationService = req.scope.resolve("notificationService")
|
const notificationService = req.scope.resolve("notificationService")
|
||||||
|
|
||||||
const config = {}
|
const config = {}
|
||||||
@@ -49,7 +48,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.json({ notification })
|
res.json({ notification })
|
||||||
} catch (error) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user