misc cleanup

This commit is contained in:
Devin Zuczek
2026-07-21 01:20:20 -04:00
parent 41fa8b9979
commit 086441f6f5
7 changed files with 12 additions and 11 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ function toSelfAccountDto(account: Account) {
const HUB_INSTANCE = 'global'
/**
* Push the notifications that follow an account mutation, mirroring the C#/Go
* Push the notifications that follow an account mutation, mirroring the reference
* hub behavior: the owner receives `SelfAccountUpdate` and `AccountUpdate`, and
* every connected client receives an `AccountUpdate` broadcast. Hub failures are
* logged and swallowed — the account write has already committed, so a hub
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* Default player settings seeded on a player's first read, ported verbatim from
* the C# `PlayerSettingsController.GetPlayerSettings`. Ordered; written to KV the
* the reference's `PlayerSettingsController.GetPlayerSettings`. Ordered; written to KV the
* first time a player has no stored settings.
*/
export const DEFAULT_SETTINGS: Array<{ Key: string; Value: string }> = [
+1 -1
View File
@@ -1,5 +1,5 @@
-- Room instances — live sessions of a room. Stored as a JSON blob in `data` with
-- generated (virtual) columns for every field (snake_case, per the C# `[Column]`
-- generated (virtual) columns for every field (snake_case, per the reference's `[Column]`
-- names), the same pattern as the rooms/accounts tables. `id` (roomInstanceId) is
-- a sequential key held in the blob. Generated from src/room-instance-db.ts
-- (SCHEMA_DDL) — keep in sync. Written/read by the match worker.
+1 -1
View File
@@ -1058,7 +1058,7 @@ describe('rooms endpoints', () => {
expect(created.roomInstanceId).toBeGreaterThan(0)
expect(created.roomId).toBe(2)
expect(created.isPrivate).toBe(true)
expect(created.EncryptVoiceChat).toBe(true) // PascalCase JSON key, per the C#
expect(created.EncryptVoiceChat).toBe(true) // PascalCase JSON key, per the reference
// Reads back identically; JsonIgnore columns are not in the DTO.
const fetched = await getRoomInstance(env.DB, created.roomInstanceId)
+2 -4
View File
@@ -4,6 +4,7 @@ import { useWorkersLogger } from 'workers-tagged-logger'
import { withOnError } from '@repo/hono-helpers'
import { NotificationType } from '../../notify/src/notification-types'
import { docsPage, fetchSpec } from './docs'
import { accountsBase, apiBase, authBase, imgBase, notifyBase, postForm } from './upstream'
@@ -37,9 +38,6 @@ const WEB_PLATFORM = '4'
*/
const ADMIN_ROLES = new Set(['developer', 'moderator'])
/** `NotificationType.ServerMaintenance` in the notify worker's enum. */
const SERVER_MAINTENANCE = 25
/** Cookie flags for the session token. `secure` is dropped for local http dev. */
function sessionCookieOptions(c: Context<App>, maxAge: number): CookieOptions {
const local = c.env.ENVIRONMENT === 'development' || c.env.ENVIRONMENT === 'VITEST'
@@ -247,7 +245,7 @@ const app = new Hono<App>()
method: 'POST',
headers: { 'content-type': 'application/json', authorization: `Bearer ${token}` },
body: JSON.stringify({
notificationType: SERVER_MAINTENANCE,
notificationType: NotificationType.ServerMaintenance,
data: { StartsInMinutes: startsIn },
}),
})
+3 -3
View File
@@ -2,12 +2,12 @@
* Room instances — live sessions of a room. Stored with the same JSON-blob pattern
* as the rooms/accounts tables: the full instance is a JSON blob in `data`, and
* every field is a SQLite generated (virtual) column extracted from it (snake_case
* per the C# `[Column]` names). `id` is a sequential key held in the blob.
* per the reference's `[Column]` names). `id` is a sequential key held in the blob.
*
* The `rooms` worker owns the schema (migrations/0004_room_instance.sql); the
* `match` worker finds/creates instances here at matchmake time. This module is the
* single source of truth for the helpers — both workers import it from
* `@repo/domain`. Columns marked `[JsonIgnore]` in the C# (owner_account_id,
* `@repo/domain`. Columns marked `[JsonIgnore]` in the reference (owner_account_id,
* data_blob, allow_new_users, join_disabled) live in the blob but are dropped from
* the client DTO (`toDto`).
*/
@@ -63,7 +63,7 @@ export interface RoomInstanceDto {
roomCode: string
roomInstanceType: number
clubId: number
// PascalCase JSON key, per the C# `[JsonPropertyName("EncryptVoiceChat")]`.
// PascalCase JSON key, per the reference's `[JsonPropertyName("EncryptVoiceChat")]`.
EncryptVoiceChat: boolean
matchmakingPolicy: number
createdAt: string
+3
View File
@@ -231,6 +231,9 @@ importers:
'@repo/hono-helpers':
specifier: workspace:*
version: link:../../packages/hono-helpers
'@repo/jwt':
specifier: workspace:*
version: link:../../packages/jwt
hono:
specifier: 4.12.27
version: 4.12.27