feat(enakgame): filter play history by game and status
GET /customer/enakgame/sessions takes optional game_id and status, so a game reloaded mid-play finds the session it was running (status=STARTED) instead of starting a new one and charging EnakCoin again. An invalid game_id or status is refused. integration-enakgame.md §4.4 now describes recovery after a reload: keep the session_id in sessionStorage, continue a STARTED session before expires_at, and call complete again for a COMPLETED one to get the full answer, prize included. The mobile guide and RFC §11 mention the filters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b5d2cd491a
commit
52e8fe11c6
@@ -50,16 +50,18 @@ func (h *EnakGameCustomerHandler) StartSession(c *gin.Context) {
|
||||
util.HandleResponse(c.Writer, c.Request, h.service.StartSession(c.Request.Context(), customerID, &req, idempotencyKey(c)), method)
|
||||
}
|
||||
|
||||
// ListSessions is GET /customer/enakgame/sessions?page=&limit=.
|
||||
// ListSessions is GET /customer/enakgame/sessions?game_id=&status=&page=&limit=.
|
||||
func (h *EnakGameCustomerHandler) ListSessions(c *gin.Context) {
|
||||
const method = "EnakGameCustomerHandler::ListSessions"
|
||||
customerID, ok := customerIDFromGin(c, method)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
page, _ := strconv.Atoi(c.Query("page"))
|
||||
limit, _ := strconv.Atoi(c.Query("limit"))
|
||||
util.HandleResponse(c.Writer, c.Request, h.service.ListSessions(c.Request.Context(), customerID, page, limit), method)
|
||||
var q models.GameSessionListQuery
|
||||
if !bindQuery(c, &q, method) {
|
||||
return
|
||||
}
|
||||
util.HandleResponse(c.Writer, c.Request, h.service.ListSessions(c.Request.Context(), customerID, q), method)
|
||||
}
|
||||
|
||||
// GetSession is GET /customer/enakgame/sessions/:id.
|
||||
|
||||
Reference in New Issue
Block a user