fix: loyalty tier crash, chat duplicate rooms, sidebar defaults
- LoyaltyPage: levelBadge() now falls back to bronze for unknown tiers (DB had loyalty_tier='standard' from old seed data) - migration 040: deduplicate general chat rooms + add unique index, normalize loyalty_tier to bronze for non-standard values - chat.ts: ON CONFLICT clause now targets the new partial unique index - Sidebar: DEFAULT_GROUPS only opens 'basics' by default; bump localStorage key to sidebarGroups_v2 to clear stale stored state Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ const chatRoutes: FastifyPluginAsync = async (fastify) => {
|
||||
const { rows } = await db.query(
|
||||
`INSERT INTO chat_rooms (hotel_id, type, name)
|
||||
VALUES ($1, 'general', 'Общий чат')
|
||||
ON CONFLICT DO NOTHING
|
||||
ON CONFLICT (hotel_id) WHERE type = 'general' DO NOTHING
|
||||
RETURNING id`,
|
||||
[hotelId],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user