feat(gps): фильтры heartbeat-эхо/valid=false/spike; доступ к GPS и Финансам — матрица на /users (пользователи+роли)

This commit is contained in:
2026-08-26 17:13:49 +03:00
parent 2fb7ad6606
commit ac4f89d42e
16 changed files with 431 additions and 227 deletions

View File

@@ -101,6 +101,9 @@ export const users = pgTable("users", {
additionalPhones: jsonb("additional_phones").default(sql`'[]'`),
additionalEmails: jsonb("additional_emails").default(sql`'[]'`),
appRole: varchar("app_role", { length: 100 }).notNull().default("user"), // 'admin', 'user', 'accountant'
// Флаги доступа к модулям (матрица на /users): GPS и Финансы
gpsAccess: boolean("gps_access").notNull().default(true),
financeAccess: boolean("finance_access").notNull().default(true),
isActive: boolean("is_active").default(true),
emailVerified: boolean("email_verified").default(false),
verificationToken: varchar("verification_token", { length: 255 }),
@@ -2972,6 +2975,9 @@ export const roles = pgTable("roles", {
description: text("description"),
parentId: integer("parent_id"),
managerId: integer("manager_id").references(() => users.id, { onDelete: "set null" }),
// Флаги доступа к модулям для членов роли (матрица на /users)
gpsAccess: boolean("gps_access").notNull().default(true),
financeAccess: boolean("finance_access").notNull().default(true),
createdAt: timestamp("created_at").defaultNow(),
}, (table) => ({
orgIdx: index("roles_org_idx").on(table.organizationId),