(
env: AutoRoutingModeEnv,
owner: { userId: string; organizationId: string | null }
)
| 58 | await this.ctx.storage.put(POOL_STORAGE_KEY, pool); |
| 59 | } |
| 60 | |
| 61 | async getSettings(): Promise<AutoRoutingOwnerSettings> { |
| 62 | const [mode, pool] = await Promise.all([this.getMode(), this.getPool()]); |
| 63 | return { mode, pool }; |
| 64 | } |
| 65 | |
| 66 | async setSettings(settings: AutoRoutingOwnerSettings): Promise<void> { |
| 67 | // Mode and pool commit or fail together in one storage transaction. |
| 68 | // setMode/setPool stay single-key for individual callers. |
| 69 | const toPut: Record<string, unknown> = {}; |
| 70 | const toDelete: string[] = []; |
| 71 | if (settings.mode === null) { |
| 72 | toDelete.push(MODE_STORAGE_KEY); |
| 73 | } else { |
| 74 | toPut[MODE_STORAGE_KEY] = settings.mode; |
| 75 | } |
| 76 | if (settings.pool === null) { |
| 77 | toDelete.push(POOL_STORAGE_KEY); |
| 78 | } else { |
| 79 | toPut[POOL_STORAGE_KEY] = settings.pool; |
| 80 | } |
no test coverage detected