c45182012c
- conexion supabase - autenticacion solo correos glm - pantalla gestor empleados
37 lines
1.9 KiB
SQL
37 lines
1.9 KiB
SQL
alter table public.rutero_empleados
|
|
add column if not exists jornada_codigo text not null default 'LUN_VIE_40',
|
|
add column if not exists horas_descanso_por_dia numeric(4,2) not null default 1,
|
|
add column if not exists dias_descanso jsonb not null default '[]'::jsonb;
|
|
|
|
alter table public.rutero_empleados
|
|
add constraint rutero_empleados_jornada_valida
|
|
check (jornada_codigo in ('LUN_DOM_44', 'LUN_SAB_40', 'LUN_SAB_44', 'LUN_VIE_40')) not valid;
|
|
|
|
alter table public.rutero_empleados
|
|
add constraint rutero_empleados_descanso_valido
|
|
check (horas_descanso_por_dia >= 0 and horas_descanso_por_dia < 24) not valid;
|
|
|
|
alter table public.rutero_empleados enable row level security;
|
|
|
|
drop policy if exists "Solo GomezLee puede consultar empleados" on public.rutero_empleados;
|
|
drop policy if exists "Solo GomezLee puede crear empleados" on public.rutero_empleados;
|
|
drop policy if exists "Solo GomezLee puede editar empleados" on public.rutero_empleados;
|
|
drop policy if exists "Solo GomezLee puede eliminar empleados" on public.rutero_empleados;
|
|
|
|
create policy "Solo GomezLee puede consultar empleados"
|
|
on public.rutero_empleados for select to authenticated
|
|
using (lower(coalesce(auth.jwt() ->> 'email', '')) like '%@gomezleemarketing.com');
|
|
|
|
create policy "Solo GomezLee puede crear empleados"
|
|
on public.rutero_empleados for insert to authenticated
|
|
with check (lower(coalesce(auth.jwt() ->> 'email', '')) like '%@gomezleemarketing.com');
|
|
|
|
create policy "Solo GomezLee puede editar empleados"
|
|
on public.rutero_empleados for update to authenticated
|
|
using (lower(coalesce(auth.jwt() ->> 'email', '')) like '%@gomezleemarketing.com')
|
|
with check (lower(coalesce(auth.jwt() ->> 'email', '')) like '%@gomezleemarketing.com');
|
|
|
|
create policy "Solo GomezLee puede eliminar empleados"
|
|
on public.rutero_empleados for delete to authenticated
|
|
using (lower(coalesce(auth.jwt() ->> 'email', '')) like '%@gomezleemarketing.com');
|