Sistema de préstamos LabRe UABC — implementación inicial
Sistema web para gestión de préstamos de material del Laboratorio de Sistemas Computacionales de la UABC. - Backend: Supabase self-hosted, schema aislado `prestamos` con RLS, triggers de stock y audit log (supabase/migrations/0001_init.sql). - Auth: Google OAuth restringido a @uabc.edu.mx, verificado en middleware y como segunda línea en trigger de DB. - Frontend: Astro 7 (SSR con adapter Node) + React islands + Tailwind v4 con paleta UABC (primary #00723F, secondary #DD971A) bajo regla 60/30/10. - Interfaz alumno mobile-first: catálogo con filtro por categorías, solicitud de préstamos, historial personal. - Interfaz admin desktop-first: panel con KPIs, bandeja de solicitudes (aprobar/rechazar/devolver), CRUD de inventario y categorías, reportes filtrables con export CSV nativo. - Modales con `<dialog>` nativo, cero librerías de UI adicionales. - Deploy: Dockerfile multi-stage node:22-alpine + docker-compose para publicar bajo prestamos.buglabs.dev vía Cloudflare Tunnel. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { createServerClient, createBrowserClient, type CookieOptionsWithName } from '@supabase/ssr';
|
||||
import type { AstroCookies } from 'astro';
|
||||
|
||||
const SCHEMA = 'prestamos';
|
||||
|
||||
const cookieOptions: CookieOptionsWithName = {
|
||||
name: 'sb',
|
||||
path: '/',
|
||||
sameSite: 'lax',
|
||||
httpOnly: true,
|
||||
secure: import.meta.env.PROD,
|
||||
};
|
||||
|
||||
export function serverClient(cookies: AstroCookies) {
|
||||
return createServerClient(
|
||||
import.meta.env.PUBLIC_SUPABASE_URL,
|
||||
import.meta.env.PUBLIC_SUPABASE_ANON_KEY,
|
||||
{
|
||||
db: { schema: SCHEMA },
|
||||
cookieOptions,
|
||||
cookies: {
|
||||
get: (name) => cookies.get(name)?.value,
|
||||
set: (name, value, options) => cookies.set(name, value, options),
|
||||
remove: (name, options) => cookies.delete(name, options),
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function browserClient() {
|
||||
return createBrowserClient(
|
||||
import.meta.env.PUBLIC_SUPABASE_URL,
|
||||
import.meta.env.PUBLIC_SUPABASE_ANON_KEY,
|
||||
{ db: { schema: SCHEMA }, cookieOptions },
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user