59394a69af
Task #409: incoming notes now mirror UpcomingMeetingAlert's attention model so recipients can't miss them. Changes: - DB: add `notification_sound_note` (default "knock"), `notify_notes_enabled`, `vibration_enabled_note` to users schema; pushed via drizzle. - API spec: add 3 new fields to AuthUser + UpdateNotificationPreferencesBody; regenerated codegen. - Auth route: include new fields in buildAuthUser + PATCH allowlist. - Socket hook: play notification sound + vibrate on `note_received`, gated by mute/notifyNotesEnabled/socket warmup, with playedNoteIdsRef dedupe (mirrors upcoming-meeting-alert playedRef). - IncomingNotePopupContext: enqueue() now returns boolean acceptance so the socket hook can suppress sound on own-note/duplicate. - Popup visual: z-[110], ring-4 amber, shadow-2xl, animate-in zoom, avatar animate-ping pulse. - Settings UI: refactored to SLOT_KEYS map, added 3rd "Notes" slot tab (grid-cols-3) with enabled/vibration toggles + sound picker. - Locales en/ar: added notifSettings.slot.note, notesEnabled, vibrationNote. Pre-existing typecheck errors in executive-meetings.ts (font settings scope) are unrelated to this task.
34 lines
2.1 KiB
TypeScript
34 lines
2.1 KiB
TypeScript
import { pgTable, text, serial, timestamp, varchar, boolean, integer } from "drizzle-orm/pg-core";
|
|
import { createInsertSchema } from "drizzle-zod";
|
|
import { z } from "zod/v4";
|
|
|
|
export const usersTable = pgTable("users", {
|
|
id: serial("id").primaryKey(),
|
|
username: varchar("username", { length: 100 }).notNull().unique(),
|
|
email: varchar("email", { length: 255 }).notNull().unique(),
|
|
passwordHash: text("password_hash").notNull(),
|
|
displayNameAr: varchar("display_name_ar", { length: 200 }),
|
|
displayNameEn: varchar("display_name_en", { length: 200 }),
|
|
preferredLanguage: varchar("preferred_language", { length: 10 }).notNull().default("ar"),
|
|
clockStyle: varchar("clock_style", { length: 30 }),
|
|
clockHour12: boolean("clock_hour12"),
|
|
avatarUrl: text("avatar_url"),
|
|
isActive: boolean("is_active").notNull().default(true),
|
|
notificationSoundOrder: varchar("notification_sound_order", { length: 30 }).notNull().default("ding"),
|
|
notificationSoundMeeting: varchar("notification_sound_meeting", { length: 30 }).notNull().default("chime"),
|
|
notificationSoundNote: varchar("notification_sound_note", { length: 30 }).notNull().default("knock"),
|
|
notifyOrdersEnabled: boolean("notify_orders_enabled").notNull().default(true),
|
|
notifyMeetingsEnabled: boolean("notify_meetings_enabled").notNull().default(true),
|
|
notifyNotesEnabled: boolean("notify_notes_enabled").notNull().default(true),
|
|
vibrationEnabledOrder: boolean("vibration_enabled_order").notNull().default(true),
|
|
vibrationEnabledMeeting: boolean("vibration_enabled_meeting").notNull().default(true),
|
|
vibrationEnabledNote: boolean("vibration_enabled_note").notNull().default(true),
|
|
notificationsMuted: boolean("notifications_muted").notNull().default(false),
|
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => new Date()),
|
|
});
|
|
|
|
export const insertUserSchema = createInsertSchema(usersTable).omit({ id: true, createdAt: true, updatedAt: true });
|
|
export type InsertUser = z.infer<typeof insertUserSchema>;
|
|
export type User = typeof usersTable.$inferSelect;
|