This repository has been archived on 2024-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
node-fftcg/backend/routes/games/list.coffee

26 lines
675 B
CoffeeScript

logger = (require 'logging').default '/games/list'
# session storage (volatile data)
session = (require '../../session')
module.exports =
url: '/games/list'
method: 'POST'
# schema: (require './info.schema')
handler: (request, reply) ->
session.check request.body.session ? ""
.then (userid) ->
# active session found, get associated user
session.getGames()
.then (games) ->
logger.debug "OK '#{userid}' got games"
reply.send
success: true
games: games
.catch ->
# no session found
logger.info "FAIL '#{request.body.session}' session not found"
reply.send
success: false