Fix error creating a table
This commit is contained in:
parent
30abe56325
commit
454bd204b8
@ -43,7 +43,7 @@ final class TableManagement {
|
||||
try await table.create(on: database)
|
||||
player.$table.id = table.id
|
||||
try await player.update(on: database)
|
||||
let waitingTable = WaitingTable(newTable: table)
|
||||
let waitingTable = WaitingTable(newTable: table, user: player)
|
||||
self.tables[waitingTable.id] = waitingTable
|
||||
return waitingTable.tableInfo(forPlayer: player.name)
|
||||
}
|
||||
|
@ -23,10 +23,9 @@ final class WaitingTable: AbstractTable<WaitingPlayer> {
|
||||
/**
|
||||
Create a new table.
|
||||
- Parameter name: The name of the table
|
||||
- Parameter isPublic: The table is visible and joinable by everyone
|
||||
- Parameter player: The user who created the table
|
||||
*/
|
||||
init(newTable object: Table) {
|
||||
let user = object.players[0]
|
||||
init(newTable object: Table, user: User) {
|
||||
let player = WaitingPlayer(name: user.name, points: user.points)
|
||||
player.isNextActor = true
|
||||
super.init(id: object.id!, name: object.name, isPublic: object.isPublic, players: [player])
|
||||
|
Loading…
Reference in New Issue
Block a user