(target?: TargetChat)
| 495 | const prefix = `${target.storageKey}:`; |
| 496 | const keys = Object.keys(db.data.values).filter((key) => |
| 497 | key.startsWith(prefix), |
| 498 | ); |
| 499 | |
| 500 | for (const key of keys) { |
| 501 | delete db.data.values[key]; |
| 502 | } |
| 503 | |
| 504 | await db.write(); |
| 505 | return keys.length; |
| 506 | } |
| 507 | |
| 508 | async function getLockedSeatSet(target: TargetChat): Promise<Set<string>> { |
| 509 | const db = await getSeatLockDb(); |
| 510 | return new Set(db.data.lockedSeats[target.storageKey] || []); |
| 511 | } |
| 512 | |
| 513 | async function updateLockedSeats( |
| 514 | target: TargetChat, |
| 515 | userIds: string[], |
| 516 | locked: boolean, |
| 517 | ): Promise<void> { |
| 518 | const db = await getSeatLockDb(); |
| 519 | const current = new Set(db.data.lockedSeats[target.storageKey] || []); |
| 520 | |
| 521 | for (const userId of userIds) { |
no test coverage detected