Commit Graph

50 Commits

Author SHA1 Message Date
weli 5861e646f4 docs: add E2E debugging principles to CLAUDE.md
Document vconsole visibility rules (SYS_TESTER label / SYS_CAN_SUDO tag),
existing debug data injection patterns, and the norm for inserting new
debug data in frontend (console.warn + localStorage), backend (tracing),
and database fixtures.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-02 10:38:12 +08:00
weli debff3a447 fix: use string_to_date in by_hty_id clazz queries
The by_hty_id variants incorrectly used string_to_datetime which expects
%Y-%m-%d %H:%M:%S format, but the API sends date-only %Y-%m-%d.
Switching to string_to_date fixes silent query failures.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-02 10:22:24 +08:00
weli be6734a23d docs: add e2e test workflow and prod smoke test to CLAUDE.md
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 21:10:09 +08:00
weli 5bf43143ea feat: add audit logging and lesson statistics for clazz
- Add clazz_audit_log table with diesel migration for CRUD audit trail
- Add audit log backend: model, queries, handler, route
- Add audit log viewer in clazz detail modal (操作记录)
- Add student_lesson_stats API (GET /api/v1/clazz/stats/my-lessons)
- Add teacher_detail_stats API (GET /api/v1/clazz/stats/teacher-detail)
- Register all new routes in lib.rs

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 19:45:56 +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 f534230af7 fix: public-packages should only return published course packages
Add `published_at IS NOT NULL` filter to the public-packages query.
Unpublished packages (ACTIVE status but no published_at) should not
appear in the student-facing store.

Two new model methods added:
- find_all_published_by_org_with_page
- find_all_published_with_page

Existing find_all_active_* methods unchanged for admin use.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 16:07:44 +08:00
weli 541814307c docs: add Upyun CDN upload requirement for frontend deploy 2026-05-01 15:38:40 +08:00
weli b8f87c4d40 feat: support query public packages without org_id (all orgs)
Make org_id optional in find_public_course_packages API.
When omitted, return all active packages across all orgs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 10:01:31 +08:00
weli eca14626ec feat: add public course packages API for unauth storefront
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 08:08:00 +08:00
weli 4e14f34699 chore: add test-results to gitignore 2026-05-01 00:59:43 +08:00
weli ef0e397426 fix: remove /api/ngx suffix from NGX_URL in env templates 2026-05-01 00:59:41 +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 2a2f32401a chore: misc fixes — NGX_URL, ai_score default, dbtask indexes, CLAUDE.md
- Fix NGX_URL in huiwings htyproc.env (remove /api/ngx suffix)
- Add #[serde(default)] to AiScorePayload::compare_url
- Add dbtask indexes (status_created, updated_at) for task processing perf
- Add CLAUDE.md with server mappings and deployment rules
- Ignore test-results/

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 00:36:45 +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 8afd3d9234 feat(course-package): add publish/unpublish with snapshot locking
- Add published_snapshot (jsonb) and published_at (timestamp) columns
- New POST publish/{id} endpoint: stores snapshot JSON, locks editing
- New POST unpublish/{id} endpoint: clears published_at for editing
- Block update and sync_items when published_at is set
- Frontend detail page with conditional edit/publish/unpublish buttons

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 21:04:14 +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 542fb2461a feat(htykc): add course_package CRUD with pagination and org scoping
Introduce course_package table and API for selling course templates.
Supports teacher-owned and org-wide active package queries with keyword
search, sort order, and pagination.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 08:15:12 +08:00
weli 25d33e76d3 chore: moicen manual enqueue script for IMAGE_FORM_COMPRESS PG+Redis
Made-with: Cursor
2026-04-28 10:26:08 +08:00
weli 5cd016cd5d feat(htyproc): IMAGE_FORM_COMPRESS task posts form_image_compress_audit to ai-api
Made-with: Cursor
2026-04-28 10:14:27 +08:00
weli c310769dd4 fix(migration): add_clazz_completed_at 使用 IF NOT EXISTS 便于重复执行
Made-with: Cursor
2026-04-28 00:45:03 +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 a15b5dbf58 fix(htyproc): convert task_result values to string in wrap_common_task; preserve body text in parse_hty_response on JSON error 2026-04-27 00:32:09 +08:00
weli 2f10cebeca htyproc: add DEBUG trace for task pipeline, TS client, and AI polling
Made-with: Cursor
2026-04-27 00:00:48 +08:00
weli d9b4171771 htyproc: replace local HtyResp with HtyResponse from htycommons 2026-04-26 23:50:25 +08:00
weli 7379b64217 htyproc: add detailed tracing to AI_SCORE pipeline 2026-04-26 23:42:03 +08:00
weli eca81f0134 htyproc: dynamic sudo token via loginWithCert → sudo, drop PROC_SUDOER_TOKEN 2026-04-26 23:15:08 +08:00
weli eee06c31ca refactor(notifications): 模版占位符 QUMU_NAME/COURSE_SECTION → COURSE_NAME/COURSE_SECTION 2026-04-26 22:58:13 +08:00
weli 8af2bc18c9 moicen: start htyproc from release binary when present
Made-with: Cursor
2026-04-26 21:25:33 +08:00
weli c30b5b927e fix(htyts): add trailing slash route /api/v1/ts/ to match nginx proxy_pass
nginx proxy_pass with location /api/v2/ts/ strips the prefix and appends
the remaining path to /api/v1/ts/, resulting in /api/v1/ts/ for root requests.
axum routes are exact-match by default, so add the trailing slash variant.
2026-04-26 20:47:00 +08:00
weli 220265195c feat(moicen): htyts 预检脚本与一键栈 release 检测含 htyts/htyproc
- scripts/moicen_htyts_smoke.sh:Redis、PG/dbtask、本机 TS HTTP、可选公网 v2
- moicen_start:存在 target/release/htyts|htyproc 时也使用 --release

Made-with: Cursor
2026-04-26 20:30:55 +08:00
weli 517023a6cd feat(moicen): htyts/htyproc 与一键栈一致的 nohup 与 logrotate 日志
- start.sh:清代理、可选 --release、追加 *.nohup.log
- moicen_start:默认在有 htyproc/.env 时起 htyproc(MOICEN_START_HTYPROC=0|no 可关)
- moicen_stop:pkill 含 htyproc

Made-with: Cursor
2026-04-26 20:22:15 +08:00
weli 917685eeb5 feat(moicen): 默认在有 htyts/.env 时随栈启动 htyts
MOICEN_START_HTYTS=0|no 可关闭;显式 1|yes 仍可用。更新脚本说明。

Made-with: Cursor
2026-04-26 20:14:49 +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 dcb0d3c365 chore(moicen): add env/bootstrap scripts for split AuthCore layout
Make moicen env copying compatible with sibling AuthCore repo and add start/stop/build helper scripts for huiwings stack bring-up on moicen hosts.

Made-with: Cursor
2026-04-25 15:06:11 +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 86b1a988a9 chore: 移除 workspace 开源许可证字段(私有仓库)
Made-with: Cursor
2026-04-24 08:35:15 +08:00
weli d1f7db2ab7 ci: sibling 检出 AuthCore 以匹配 Cargo [patch] ../AuthCore
GHA 默认只检出 huike-back,导致 ../AuthCore 不存在。将本仓库检出到 huike-back/、AuthCore 检出到同级目录,并在子目录运行 cargo check;rust-cache 指向 huike-back workspace。

根 Cargo.toml 保留 ../AuthCore patch,避免把 AuthCore 嵌进本 workspace(否则会继承 huike-back 的 workspace.dependencies 而缺依赖)。

Made-with: Cursor
2026-04-24 08:07:30 +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 1fbd3b7e29 docs update backend ci badge links
Point README CI badge to the current huike-back repository workflow URL.

Made-with: Cursor
2026-04-23 21:50:46 +08:00
weli 4f00f215fc ci add github actions workflow for rust workspace checks
Run cargo check for the backend workspace with required Postgres build dependencies on push/pull_request.

Made-with: Cursor
2026-04-23 21:40:55 +08:00
weli 15dc2c1a3c refactor course_category naming and add jsonb migration runbook
Rename remaining qumu_category db artifacts to course_category and document jsonb key migration procedure for existing production data.

Made-with: Cursor
2026-04-23 21:39:13 +08:00
weli ec85a319a1 Update README.md 2026-04-23 17:22:13 +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