Add endpoint for fetching my-team/players

This commit is contained in:
2020-11-04 23:09:36 -06:00
parent 19567dcfb0
commit 33c37f6855
4 changed files with 23 additions and 5 deletions

View File

@@ -21,6 +21,13 @@ class Teams extends Controller {
return res.api(await req.user_team.to_api())
}
async get_my_team_players(req, res, next) {
const players = await req.user_team.players()
console.log(players)
console.log(await players[0].to_api())
return res.api(await Promise.all(players.map(x => x.to_api())))
}
async list_all_teams(req, res) {
const TeamModel = this.models.get('Team')
const teams = await TeamModel.find()