Skip to content

Commit

Permalink
feat (term): retrieve current user
Browse files Browse the repository at this point in the history
  • Loading branch information
santanche committed Feb 1, 2022
1 parent d31c2c6 commit 98f9f3a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/adonisjs/app/Controllers/Http/v1/TermController.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@ class TermController {
* @param {Response} ctx.response
* @param {View} ctx.view
*/
async showTermUser ({ params, request, response, view }) {
async showTermUser ({ params, request, response, view, auth }) {
try {
let userId = request.input('userId')
if (userId == null)
userId = auth.user.id
const uterm = await Database
.select('*')
.from('users_terms')
.where('user_id', request.input('userId'))
.where('user_id', userId)
.where('term_id', request.input('termId'))
if (uterm != null)
return response.json(uterm)
Expand Down

0 comments on commit 98f9f3a

Please sign in to comment.