From 086441f6f5ed04ffa3f271aecbd0a1628f3bece3 Mon Sep 17 00:00:00 2001 From: Devin Zuczek Date: Tue, 21 Jul 2026 01:20:20 -0400 Subject: [PATCH] misc cleanup --- apps/accounts/src/accounts.app.ts | 2 +- apps/playersettings/src/default-settings.ts | 2 +- apps/rooms/migrations/0004_room_instance.sql | 2 +- apps/rooms/src/test/integration/api.test.ts | 2 +- apps/www/src/www.app.ts | 6 ++---- packages/domain/src/room-instance-db.ts | 6 +++--- pnpm-lock.yaml | 3 +++ 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/accounts/src/accounts.app.ts b/apps/accounts/src/accounts.app.ts index 63c9db6..a544309 100644 --- a/apps/accounts/src/accounts.app.ts +++ b/apps/accounts/src/accounts.app.ts @@ -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 diff --git a/apps/playersettings/src/default-settings.ts b/apps/playersettings/src/default-settings.ts index 46dcf15..d460b1b 100644 --- a/apps/playersettings/src/default-settings.ts +++ b/apps/playersettings/src/default-settings.ts @@ -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 }> = [ diff --git a/apps/rooms/migrations/0004_room_instance.sql b/apps/rooms/migrations/0004_room_instance.sql index 756f08e..6cdd607 100644 --- a/apps/rooms/migrations/0004_room_instance.sql +++ b/apps/rooms/migrations/0004_room_instance.sql @@ -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. diff --git a/apps/rooms/src/test/integration/api.test.ts b/apps/rooms/src/test/integration/api.test.ts index 1ab871e..2f42c96 100644 --- a/apps/rooms/src/test/integration/api.test.ts +++ b/apps/rooms/src/test/integration/api.test.ts @@ -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) diff --git a/apps/www/src/www.app.ts b/apps/www/src/www.app.ts index 2d53973..6006834 100644 --- a/apps/www/src/www.app.ts +++ b/apps/www/src/www.app.ts @@ -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, maxAge: number): CookieOptions { const local = c.env.ENVIRONMENT === 'development' || c.env.ENVIRONMENT === 'VITEST' @@ -247,7 +245,7 @@ const app = new Hono() method: 'POST', headers: { 'content-type': 'application/json', authorization: `Bearer ${token}` }, body: JSON.stringify({ - notificationType: SERVER_MAINTENANCE, + notificationType: NotificationType.ServerMaintenance, data: { StartsInMinutes: startsIn }, }), }) diff --git a/packages/domain/src/room-instance-db.ts b/packages/domain/src/room-instance-db.ts index d9a4d05..8c73148 100644 --- a/packages/domain/src/room-instance-db.ts +++ b/packages/domain/src/room-instance-db.ts @@ -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 diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2e6c234..209d888 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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