Feat: add password for player
This commit is contained in:
@ -32,7 +32,7 @@ func (p *RepoProvider) PlayerListNames(ctx context.Context) ([]string, error) {
|
||||
|
||||
func (p *RepoProvider) PlayerGetByName(ctx context.Context, username string) (*models.Player, error) {
|
||||
var player models.Player
|
||||
err := sqlx.GetContext(ctx, p.DB, &player, "SELECT id, room_id, username, team, role, is_bot FROM players WHERE username = ?", username)
|
||||
err := sqlx.GetContext(ctx, p.DB, &player, "SELECT id, room_id, username, team, role, is_bot, password FROM players WHERE username = ?", username)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -44,8 +44,8 @@ func (p *RepoProvider) PlayerGetByName(ctx context.Context, username string) (*m
|
||||
|
||||
func (p *RepoProvider) PlayerAdd(ctx context.Context, player *models.Player) error {
|
||||
db := getDB(ctx, p.DB)
|
||||
_, err := db.ExecContext(ctx, "INSERT INTO players (room_id, username, team, role, is_bot) VALUES (?, ?, ?, ?, ?)",
|
||||
player.RoomID, player.Username, player.Team, player.Role, player.IsBot)
|
||||
_, err := db.ExecContext(ctx, "INSERT INTO players (room_id, username, team, role, is_bot, password) VALUES (?, ?, ?, ?, ?, ?)",
|
||||
player.RoomID, player.Username, player.Team, player.Role, player.IsBot, player.Password)
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user