Commit Graph

18 Commits

Author SHA1 Message Date
weli fa14a5ca8c perf: add GIN indexes on clazz JSONB columns and date-range indexes
- GIN indexes on students/teachers (jsonb_path_ops) for fast user lookups
- Composite index on clazz (is_repeat, start_from, end_by) for date range queries
- Indexes on clazz_repeat (clazz_id, repeat_start, repeat_end) for joins

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-03 09:39:36 +08:00
weli 723787a8ea fix: include resolved course_sections in course group API response
ReqCourseGroup now includes a course_sections field populated with
full section objects when returned by find_course_group_by_ids,
fixing unpublished package detail display in the frontend.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 19:04:56 +08:00
weli ce61c8b7d0 fix: prioritize student branch when both student_id and teacher_id present
The daka query branching checked teacher_id first. When a student
has currentTeacherId set, both params are present, causing the
teacher branch to activate (requires scope) and fail with
"scope can not be none". Fixed by adding student_id.is_none()
to the teacher branch condition.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 00:42:09 +08:00
weli 5dfaa3c403 perf: batch-load daka relations to eliminate N+1 queries
List endpoint: batch-load daka_course_section, course_section,
course, and lianxi in single queries instead of per-daka loops.
Detail endpoint: single DB connection + batch relation lookup.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 23:59:46 +08:00
weli 0fa6d4a823 feat: add teacher_id filter to student daka query
Allow students to filter dakas by teacher_id when querying.
Both student_id and teacher_id can now coexist in the request.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 23:50:43 +08:00
weli b4a86071dc fix(htyws): preserve existing fields on course_group partial update
CourseGroup has treat_none_as_null=true, so partial updates would set
unsent fields to NULL. Merge with existing record before update to
preserve org_id, created_by, course_section_ids, and teachers.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 14:54:05 +08:00
weli db08280f6e feat(course-package): add org_visible to course_group and course_package_item table
Migrations:
- htyws: add org_id, org_visible columns to course_group
- htykc: create course_package_item table

Backend:
- CourseGroup: add org_visible, org_id fields; find_org_visible_by_org_id query
- CoursePackageItem: new model with sync/list API
- SUPERVISOR role check for package item management
- New endpoint: GET /api/v1/ws/find_org_visible_course_groups
- New endpoints: POST /api/v1/clazz/course-package/item/sync,
  GET /api/v1/clazz/course-package/item/list/{package_id}

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 14:26:27 +08:00
weli aaa7490a04 fix: tolerate ref-resource errors in course section list APIs
Downgrade list failures when loading ref resources for a section so one bad row does not fail the entire page; log warn with section id.

Made-with: Cursor
2026-04-28 00:25:39 +08:00
weli 2155c66a3b fix(ws-org): enforce org-scoped lianxi relation lookups
Require current_org_id for lianxi deletion and relation traversal, and add org-scoped relation lookups to prevent cross-organization hits in daka/jihua counters.

Made-with: Cursor
2026-04-27 23:20:52 +08:00
weli 07ee6e7cc6 feat(ws-org): add org_id scoping across ws entities
Add org_id fields and migrations for course, section, lianxi, piyue, and jihua/daka data paths, and enforce organization-scoped filtering in ws service queries.

Made-with: Cursor
2026-04-27 23:06:58 +08:00
weli 83f657388c fix(ws-org): enforce current_org_id for teacher-student APIs
Require organization context in teacher/student relation reads and writes, and prevent fallback to cross-organization queries.

Made-with: Cursor
2026-04-27 22:38:59 +08:00
weli c5134c9356 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
2026-04-27 20:12:02 +08:00
weli eee06c31ca refactor(notifications): 模版占位符 QUMU_NAME/COURSE_SECTION → COURSE_NAME/COURSE_SECTION 2026-04-26 22:58:13 +08:00
weli 0e53c9f66d feat(htykc): clazz completed_at migration; logrotate for htykc/htyproc/htyts
Portable run_rotate; moicen_start_huiwings_stack and ws_clazz updates; schema/models sync.

Made-with: Cursor
2026-04-26 17:14:44 +08:00
weli 2d7a46a927 feat: add huike_push_info for PushInfo extra accessors; update notifications
Made-with: Cursor
2026-04-24 09:17:32 +08:00
weli bcd2c50729 feat(htykc): clazz 命名迁移、消课点名与 Diesel 迁移
将课程相关表与 API 从 kecheng 迁至 clazz;新增消课/点名迁移;htyws 路由同步;工作区依赖 patch AuthCore。

Made-with: Cursor
2026-04-24 07:43:05 +08:00
weli 44c320d8fa chore add core rust project files and diesel migrations
Track required workspace crates, scripts, and historical diesel migrations so the repository contains the complete runnable backend baseline.

Made-with: Cursor
2026-04-23 17:20:01 +08:00
weli c843fecbce refactor teaching domain naming to course/course_section/course_group
Add diesel migrations and synchronize backend/frontend model fields plus jsonb key migration to support generic teaching subjects beyond piano-specific naming.

Made-with: Cursor
2026-04-23 17:16:10 +08:00