Feat: Delete customer group (#1102)

This commit is contained in:
Philip Korsholm
2022-02-24 14:20:58 +01:00
committed by GitHub
parent 9ab0568b47
commit e35a4fb2ea
6 changed files with 191 additions and 1 deletions
@@ -0,0 +1,44 @@
import { CustomerGroupService } from "../../../../services"
/**
* @oas [delete] /customer-groups/{id}
* operationId: "DeleteCustomerGroupsCustomerGroup"
* summary: "Delete a CustomerGroup"
* description: "Deletes a CustomerGroup."
* x-authenticated: true
* parameters:
* - (path) id=* {string} The id of the Customer Group
* tags:
* - CustomerGroup
* responses:
* 200:
* description: OK
* content:
* application/json:
* schema:
* properties:
* id:
* type: string
* description: The id of the deleted customer group.
* object:
* type: string
* description: The type of the object that was deleted.
* deleted:
* type: boolean
*/
export default async (req, res) => {
const { id } = req.params
const customerGroupService: CustomerGroupService = req.scope.resolve(
"customerGroupService"
)
await customerGroupService.delete(id)
res.json({
id: id,
object: "customer_group",
deleted: true,
})
}
@@ -10,6 +10,10 @@ export default (app) => {
route.get("/:id", middlewares.wrap(require("./get-customer-group").default))
route.post("/", middlewares.wrap(require("./create-customer-group").default))
route.delete(
"/:id",
middlewares.wrap(require("./delete-customer-group").default)
)
return app
}