Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
add show and delete routes to user
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaszimmer committed Nov 8, 2022
1 parent 592df5c commit 6bdd7e4
Show file tree
Hide file tree
Showing 4 changed files with 4,177 additions and 4,406 deletions.
22 changes: 22 additions & 0 deletions app/Controllers/Http/Admin/UserController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,26 @@ export default class UserController {
const document = new ApiDocument(ctx, resource);
await document.send();
}

public async delete(ctx: HttpContextContract) {
const { bouncer, params } = ctx;
await bouncer.authorize('superuser');

const user = await User.findOrFail(params.id);
const document = new ApiDocument(ctx, await user.delete());
await document.send();
}

public async show(ctx: HttpContextContract) {
const { bouncer, params } = ctx;
await bouncer.authorize('superuser');

const user = await User.findOrFail(params.id);

const resource = new Resource(user);
resource.boot();

const document = new ApiDocument(ctx, resource);
await document.send();
}
}
Loading

0 comments on commit 6bdd7e4

Please sign in to comment.