fix: make packages/medusa/src/api/routes/admin/shipping-profiles pass eslint (#642)
This commit is contained in:
@@ -28,7 +28,6 @@
|
|||||||
/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/admin/notes
|
||||||
/packages/medusa/src/api/routes/admin/orders
|
/packages/medusa/src/api/routes/admin/orders
|
||||||
/packages/medusa/src/api/routes/admin/shipping-profiles
|
|
||||||
/packages/medusa/src/api/routes/admin/store
|
/packages/medusa/src/api/routes/admin/store
|
||||||
/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
|
||||||
|
|||||||
@@ -35,12 +35,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 profileService = req.scope.resolve("shippingProfileService")
|
||||||
const profileService = req.scope.resolve("shippingProfileService")
|
const data = await profileService.create(value)
|
||||||
const data = await profileService.create(value)
|
|
||||||
|
|
||||||
res.status(200).json({ shipping_profile: data })
|
res.status(200).json({ shipping_profile: data })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,17 +25,13 @@
|
|||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { profile_id } = req.params
|
const { profile_id } = req.params
|
||||||
try {
|
const profileService = req.scope.resolve("shippingProfileService")
|
||||||
const profileService = req.scope.resolve("shippingProfileService")
|
|
||||||
|
|
||||||
await profileService.delete(profile_id)
|
await profileService.delete(profile_id)
|
||||||
|
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
id: profile_id,
|
id: profile_id,
|
||||||
object: "shipping_profile",
|
object: "shipping_profile",
|
||||||
deleted: true,
|
deleted: true,
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,16 +21,12 @@ import { defaultFields, defaultRelations } from "./"
|
|||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { profile_id } = req.params
|
const { profile_id } = req.params
|
||||||
try {
|
const profileService = req.scope.resolve("shippingProfileService")
|
||||||
const profileService = req.scope.resolve("shippingProfileService")
|
|
||||||
|
|
||||||
const profile = await profileService.retrieve(profile_id, {
|
const profile = await profileService.retrieve(profile_id, {
|
||||||
select: defaultFields,
|
select: defaultFields,
|
||||||
relations: defaultRelations,
|
relations: defaultRelations,
|
||||||
})
|
})
|
||||||
|
|
||||||
res.status(200).json({ shipping_profile: profile })
|
res.status(200).json({ shipping_profile: profile })
|
||||||
} 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("/shipping-profiles", route)
|
app.use("/shipping-profiles", route)
|
||||||
|
|
||||||
route.get("/", middlewares.wrap(require("./list-shipping-profiles").default))
|
route.get("/", middlewares.wrap(require("./list-shipping-profiles").default))
|
||||||
|
|||||||
@@ -18,13 +18,9 @@
|
|||||||
* $ref: "#/components/schemas/shipping_profile"
|
* $ref: "#/components/schemas/shipping_profile"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
try {
|
const profileService = req.scope.resolve("shippingProfileService")
|
||||||
const profileService = req.scope.resolve("shippingProfileService")
|
|
||||||
|
|
||||||
const data = await profileService.list()
|
const data = await profileService.list()
|
||||||
|
|
||||||
res.status(200).json({ shipping_profiles: data })
|
res.status(200).json({ shipping_profiles: data })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,14 +39,10 @@ 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 profileService = req.scope.resolve("shippingProfileService")
|
||||||
const profileService = req.scope.resolve("shippingProfileService")
|
|
||||||
|
|
||||||
await profileService.update(profile_id, value)
|
await profileService.update(profile_id, value)
|
||||||
|
|
||||||
const data = await profileService.retrieve(profile_id)
|
const data = await profileService.retrieve(profile_id)
|
||||||
res.status(200).json({ shipping_profile: data })
|
res.status(200).json({ shipping_profile: data })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user