mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
implement user badges fetch
This commit is contained in:
parent
c002deabaf
commit
6d491ec696
@ -0,0 +1,21 @@
|
||||
import { User, Badge } from "@db_models"
|
||||
|
||||
export default {
|
||||
fn: async (req) => {
|
||||
const { user_id } = req.params
|
||||
|
||||
const user = await User.findOne({
|
||||
_id: user_id
|
||||
}).catch((err) => {
|
||||
return false
|
||||
})
|
||||
|
||||
const badges = await Badge.find({
|
||||
name: {
|
||||
$in: user.badges
|
||||
}
|
||||
})
|
||||
|
||||
return badges
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user