feat(org): enforce tenant isolation in ws/kc with leave and stats APIs

Add org_id schema migrations and service-level filtering for teacher-student and class workflows, then cover org-context behavior with focused unit/e2e tests for leave and hour statistics.

Made-with: Cursor
This commit is contained in:
2026-04-27 20:12:02 +08:00
parent a15b5dbf58
commit c5134c9356
19 changed files with 1226 additions and 87 deletions
@@ -0,0 +1,34 @@
create table clazz_leave_request
(
id varchar not null,
org_id varchar not null,
clazz_id varchar not null
constraint clazz_leave_request_clazz_id_fk
references clazz (id),
student_id varchar not null,
teacher_id varchar,
leave_type varchar not null,
reason varchar,
request_status varchar not null default 'PENDING',
created_at timestamp not null default now(),
created_by varchar,
reviewed_at timestamp,
reviewed_by varchar,
is_delete boolean not null default false
);
create unique index clazz_leave_request_id_uindex
on clazz_leave_request (id);
alter table clazz_leave_request
add constraint clazz_leave_request_pk
primary key (id);
create index idx_clazz_leave_request_org_id
on clazz_leave_request (org_id);
create index idx_clazz_leave_request_clazz_id
on clazz_leave_request (clazz_id);
create index idx_clazz_leave_request_student_id
on clazz_leave_request (student_id);