impl more
parent
58904c8619
commit
659bf0f559
|
|
@ -56,8 +56,21 @@ func (games Games) GamesForUser(ctx context.Context, id string) ([]string, error
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (games Games) GameByName(ctx context.Context, name string) (string, error) {
|
func (games Games) GameByName(ctx context.Context, uid, name string) (string, error) {
|
||||||
return "", io.EOF
|
var result string
|
||||||
|
err := games.db.Query(ctx, func(rows *sql.Rows) error {
|
||||||
|
return rows.Scan(&result)
|
||||||
|
}, `
|
||||||
|
SELECT
|
||||||
|
players.games_uuid
|
||||||
|
FROM
|
||||||
|
players
|
||||||
|
JOIN games ON players.game_uuid=games.game_uuid
|
||||||
|
WHERE players.user_uuid=? AND games.name=?
|
||||||
|
ORDER BY games.timestamp DESC
|
||||||
|
LIMIT 1
|
||||||
|
`, uid, name)
|
||||||
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
@ -214,11 +227,11 @@ func (games Games) CreateEventAssignmentRotation(ctx context.Context, id string,
|
||||||
// TODO assign victim's target to killer
|
// TODO assign victim's target to killer
|
||||||
// TODO randomize everyone else so not the same as before AND not self
|
// TODO randomize everyone else so not the same as before AND not self
|
||||||
return io.EOF
|
return io.EOF
|
||||||
return games.createEvent(ctx, id, v)
|
//return games.createEvent(ctx, id, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (games Games) createEvent(ctx context.Context, id string, v any) error {
|
func (games Games) createEvent(ctx context.Context, id string, v any) error {
|
||||||
payload, err := json.Marshal(any)
|
payload, err := json.Marshal(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue