feat: write REST API endpoint to delete role

This commit is contained in:
Ali BARIN
2024-09-05 15:31:24 +00:00
parent ea667bb6a9
commit 0b6c28422c
4 changed files with 187 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import Role from '../../../../../models/role.js';
export default async (request, response) => {
const role = await Role.query()
.findById(request.params.roleId)
.throwIfNotFound();
await role.deleteWithPermissions();
response.status(204).end();
};