(newQueue: NewQueue)
| 179 | |
| 180 | // throws error on conflict |
| 181 | insertQueue(newQueue: NewQueue) { |
| 182 | try { |
| 183 | return db.transaction(() => { |
| 184 | this.incrementGuildStat("queuesAdded"); |
| 185 | this.dbQueues.clear(); |
| 186 | return db |
| 187 | .insert(QUEUE_TABLE) |
| 188 | .values(omitBy(newQueue, isNil) as NewQueue) |
| 189 | .returning().get(); |
| 190 | }); |
| 191 | } |
| 192 | catch (e) { |
| 193 | if ((e as Error).message.includes("UNIQUE constraint failed")) { |
| 194 | throw new QueueAlreadyExistsError(); |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | // replace on conflict |
| 200 | insertVoice(newVoice: NewVoice) { |
no test coverage detected