fix: make packages/medusa/src/api/routes/admin/notes pass eslint (#690)

This commit is contained in:
Asian Cat
2021-10-31 09:34:47 +01:00
committed by GitHub
parent d9ee127284
commit f01166272d
7 changed files with 32 additions and 53 deletions
-1
View File
@@ -23,7 +23,6 @@
/packages/medusa/src/loaders/subscribers.js /packages/medusa/src/loaders/subscribers.js
/packages/medusa/src/api/routes/admin/auth /packages/medusa/src/api/routes/admin/auth
/packages/medusa/src/api/routes/admin/collections /packages/medusa/src/api/routes/admin/collections
/packages/medusa/src/api/routes/admin/notes
/packages/medusa/src/api/routes/store/carts /packages/medusa/src/api/routes/store/carts
/packages/medusa/src/api/routes/store/return-reasons /packages/medusa/src/api/routes/store/return-reasons
/packages/medusa/src/api/routes/store/returns /packages/medusa/src/api/routes/store/returns
@@ -46,7 +46,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 noteService = req.scope.resolve("noteService") const noteService = req.scope.resolve("noteService")
const result = await noteService.create({ const result = await noteService.create({
@@ -57,7 +56,4 @@ export default async (req, res) => {
}) })
res.status(200).json({ note: result }) res.status(200).json({ note: result })
} catch (err) {
throw err
}
} }
@@ -24,12 +24,8 @@
export default async (req, res) => { export default async (req, res) => {
const { id } = req.params const { id } = req.params
try {
const noteService = req.scope.resolve("noteService") const noteService = req.scope.resolve("noteService")
await noteService.delete(id) await noteService.delete(id)
res.status(200).json({ id, deleted: true }) res.status(200).json({ id, deleted: true })
} catch (err) {
throw err
}
} }
@@ -20,12 +20,8 @@
export default async (req, res) => { export default async (req, res) => {
const { id } = req.params const { id } = req.params
try {
const noteService = req.scope.resolve("noteService") const noteService = req.scope.resolve("noteService")
const note = await noteService.retrieve(id, { relations: ["author"] }) const note = await noteService.retrieve(id, { relations: ["author"] })
res.status(200).json({ note }) res.status(200).json({ note })
} catch (err) {
throw err
}
} }
@@ -3,7 +3,7 @@ import middlewares from "../../../middlewares"
const route = Router() const route = Router()
export default app => { export default (app) => {
app.use("/notes", route) app.use("/notes", route)
route.get("/:id", middlewares.wrap(require("./get-note").default)) route.get("/:id", middlewares.wrap(require("./get-note").default))
@@ -18,7 +18,6 @@
* $ref: "#/components/schemas/note" * $ref: "#/components/schemas/note"
*/ */
export default async (req, res) => { export default async (req, res) => {
try {
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
@@ -36,7 +35,4 @@ export default async (req, res) => {
}) })
res.status(200).json({ notes }) res.status(200).json({ notes })
} catch (err) {
throw err
}
} }
@@ -40,12 +40,8 @@ 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 noteService = req.scope.resolve("noteService") const noteService = req.scope.resolve("noteService")
const result = await noteService.update(id, value.value) const result = await noteService.update(id, value.value)
res.status(200).json({ note: result }) res.status(200).json({ note: result })
} catch (err) {
throw err
}
} }