feat: add city/state/country to complex, new settings page with sidebar, and Biome linting
- Added city, state, and country optional fields to Complex model - Updated onboarding to include optional location fields - Created new settings page with sidebar navigation (Datos del Complejo, Canchas) - Replaced ESLint with Biome for frontend and backend linting - Added parallel dev script with concurrently - Migrated register-routes to use direct app.route() pattern
This commit is contained in:
@@ -1,35 +1,29 @@
|
||||
import type { MiddlewareHandler } from 'hono'
|
||||
import type { AppEnv } from '@/types/hono'
|
||||
import type { AppEnv } from '@/types/hono';
|
||||
import type { MiddlewareHandler } from 'hono';
|
||||
|
||||
function getSuperAdminEmails(): Set<string> {
|
||||
const raw = Bun.env.SUPER_ADMIN_EMAILS ?? ''
|
||||
const raw = Bun.env.SUPER_ADMIN_EMAILS ?? '';
|
||||
const emails = raw
|
||||
.split(',')
|
||||
.map((value) => value.trim().toLowerCase())
|
||||
.filter(Boolean)
|
||||
return new Set(emails)
|
||||
.filter(Boolean);
|
||||
return new Set(emails);
|
||||
}
|
||||
|
||||
export const requireSuperAdmin: MiddlewareHandler<AppEnv> = async (
|
||||
c,
|
||||
next,
|
||||
) => {
|
||||
const authUser = c.get('authUser')
|
||||
const role =
|
||||
typeof authUser.app_metadata?.role === 'string'
|
||||
? authUser.app_metadata.role
|
||||
: null
|
||||
const email = authUser.email?.toLowerCase()
|
||||
export const requireSuperAdmin: MiddlewareHandler<AppEnv> = async (c, next) => {
|
||||
const authUser = c.get('authUser');
|
||||
const role = typeof authUser.app_metadata?.role === 'string' ? authUser.app_metadata.role : null;
|
||||
const email = authUser.email?.toLowerCase();
|
||||
|
||||
if (role === 'super_admin') {
|
||||
await next()
|
||||
return
|
||||
await next();
|
||||
return;
|
||||
}
|
||||
|
||||
if (email && getSuperAdminEmails().has(email)) {
|
||||
await next()
|
||||
return
|
||||
await next();
|
||||
return;
|
||||
}
|
||||
|
||||
return c.json({ message: 'Este recurso requiere permisos de super admin.' }, 403)
|
||||
}
|
||||
return c.json({ message: 'Este recurso requiere permisos de super admin.' }, 403);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user