Added filterable stash pages.
This commit is contained in:
10
src/users.js
10
src/users.js
@@ -46,17 +46,17 @@ export async function fetchUser(userId, options = {}) {
|
||||
.groupBy('users.id', 'users_roles.role')
|
||||
.first();
|
||||
|
||||
const stashes = await knex('stashes')
|
||||
.where('user_id', user.id)
|
||||
.leftJoin('stashes_meta', 'stashes_meta.stash_id', 'stashes.id');
|
||||
|
||||
if (!user) {
|
||||
throw HttpError(`User '${userId}' not found`, 404);
|
||||
}
|
||||
|
||||
if (options.raw) {
|
||||
return user;
|
||||
return { user, stashes };
|
||||
}
|
||||
|
||||
const stashes = await knex('stashes')
|
||||
.where('user_id', user.id)
|
||||
.leftJoin('stashes_meta', 'stashes_meta.stash_id', 'stashes.id');
|
||||
|
||||
return curateUser(user, { stashes });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user