corregido refreshtoken y mejorado ver informacion ui por roles

This commit is contained in:
2026-02-10 21:45:34 -04:00
parent 63c39e399e
commit 42e802f8a7
22 changed files with 2438 additions and 324 deletions

View File

@@ -1,9 +1,8 @@
import * as t from 'drizzle-orm/pg-core';
import { sql } from 'drizzle-orm';
import { authSchema } from './schemas';
import * as t from 'drizzle-orm/pg-core';
import { timestamps } from '../timestamps';
import { states, municipalities, parishes } from './general';
import { municipalities, parishes, states } from './general';
import { authSchema } from './schemas';
// Tabla de Usuarios sistema
export const users = authSchema.table(
@@ -15,9 +14,15 @@ export const users = authSchema.table(
fullname: t.text('fullname').notNull(),
phone: t.text('phone'),
password: t.text('password').notNull(),
state: t.integer('state').references(() => states.id, { onDelete: 'set null' }),
municipality: t.integer('municipality').references(() => municipalities.id, { onDelete: 'set null' }),
parish: t.integer('parish').references(() => parishes.id, { onDelete: 'set null' }),
state: t
.integer('state')
.references(() => states.id, { onDelete: 'set null' }),
municipality: t
.integer('municipality')
.references(() => municipalities.id, { onDelete: 'set null' }),
parish: t
.integer('parish')
.references(() => parishes.id, { onDelete: 'set null' }),
isTwoFactorEnabled: t
.boolean('is_two_factor_enabled')
.notNull()
@@ -32,7 +37,6 @@ export const users = authSchema.table(
}),
);
// Tabla de Roles
export const roles = authSchema.table(
'roles',
@@ -46,8 +50,6 @@ export const roles = authSchema.table(
}),
);
//tabla User_roles
export const usersRole = authSchema.table(
'user_role',
@@ -88,7 +90,6 @@ LEFT JOIN
LEFT JOIN
auth.roles r ON ur.role_id = r.id`);
// Tabla de Sesiones
export const sessions = authSchema.table(
'sessions',
@@ -103,6 +104,9 @@ export const sessions = authSchema.table(
.notNull(),
sessionToken: t.text('session_token').notNull(),
expiresAt: t.integer('expires_at').notNull(),
previousSessionToken: t.varchar('previous_session_token'),
lastRotatedAt: t.timestamp('last_rotated_at'),
...timestamps,
},
(sessions) => ({
@@ -110,8 +114,6 @@ export const sessions = authSchema.table(
}),
);
//tabla de tokens de verificación
export const verificationTokens = authSchema.table(
'verificationToken',