mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-09 05:58:18 +00:00
chore: more tests
This commit is contained in:
@@ -109,8 +109,11 @@ join iam.units un on un.key = 'edr_freight_app' and un.organization_id = o.id
|
||||
where u.email like '%@edr.local'
|
||||
and not exists (select 1 from iam.employees e where e.user_id = u.id);
|
||||
|
||||
insert into iam.employee_positions (id, is_delegate, is_current, status, unit_id, employee_id, position_id)
|
||||
select gen_random_uuid(), false, true, 'APPROVED', un.id, e.id, p.id
|
||||
-- start_date must be set: the login query filters positions on
|
||||
-- start_date <= NOW(), and a NULL start_date silently drops the position
|
||||
-- (and with it every permission) from the JWT.
|
||||
insert into iam.employee_positions (id, is_delegate, is_current, status, start_date, unit_id, employee_id, position_id)
|
||||
select gen_random_uuid(), false, true, 'APPROVED', now() - interval '1 day', un.id, e.id, p.id
|
||||
from (values
|
||||
('linestaff@edr.local', 'operation'),
|
||||
('chief@edr.local', 'chief'),
|
||||
@@ -128,3 +131,7 @@ join iam.positions p on p.key = v.position_key and p.unit_id = un.id
|
||||
where not exists (
|
||||
select 1 from iam.employee_positions ep where ep.employee_id = e.id and ep.position_id = p.id
|
||||
);
|
||||
|
||||
-- Backfill for rows created before start_date was included above.
|
||||
update iam.employee_positions set start_date = now() - interval '1 day'
|
||||
where start_date is null;
|
||||
|
||||
Reference in New Issue
Block a user