feat: add app_config table with runtime log level control and POS structured logging
- New app_config key-value table for system settings, with in-memory cache (mirrors ModuleService pattern) - GET/PATCH /v1/config endpoints for reading and updating config (settings.view/settings.edit permissions) - Runtime log level: PATCH /v1/config/log_level applies immediately, persists across restarts - Startup loads log level from DB in onReady hook (env var is default, DB overrides) - Add structured request.log.info() to POS routes: transaction create/complete/void, drawer open/close, discount create/update/delete Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
9
packages/shared/src/schemas/config.schema.ts
Normal file
9
packages/shared/src/schemas/config.schema.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const LogLevel = z.enum(['fatal', 'error', 'warn', 'info', 'debug', 'trace'])
|
||||
export type LogLevel = z.infer<typeof LogLevel>
|
||||
|
||||
export const AppConfigUpdateSchema = z.object({
|
||||
value: z.union([z.string(), z.number(), z.boolean(), z.null()]),
|
||||
})
|
||||
export type AppConfigUpdateInput = z.infer<typeof AppConfigUpdateSchema>
|
||||
@@ -191,3 +191,6 @@ export type {
|
||||
DrawerOpenInput,
|
||||
DrawerCloseInput,
|
||||
} from './pos.schema.js'
|
||||
|
||||
export { LogLevel, AppConfigUpdateSchema } from './config.schema.js'
|
||||
export type { AppConfigUpdateInput } from './config.schema.js'
|
||||
|
||||
Reference in New Issue
Block a user