Commit Graph

600 Commits

Author SHA1 Message Date
a81fe3cd19 feat(auth): add learner device sessions with a 2-device limit
- Track learner sessions and revoke them immediately on every request
- Add a device replacement challenge for logins over the limit
- Add learner and admin endpoints to list and remove devices
- Trim excess sessions when enforcement is enabled
- Stop logging refresh tokens and authorization headers

Enforcement is off by default through DEVICE_LIMIT_ENFORCED.
2026-11-23 17:38:48 +03:00
9d2f6c62e7 fix(auth): return the rotated refresh token
The refresh endpoint revoked the submitted token but sent it back to the
client, so the next refresh failed and sign-out could not revoke the live
token. Return the new token and cover single-use rotation with a test.
2026-11-23 15:03:39 +03:00
594bbbe941 Add course purchases and affiliate program with documented APIs 2026-11-20 22:39:13 +03:00
2e7f24e7f7 Merge remote-tracking branch 'origin/main' 2026-11-02 13:10:21 +03:00
39c86600f2 Adapt backend and demo curriculum for makeup artistry and clean up services 2026-11-02 13:09:31 +03:00
d0c48f03c4 Merge remote-tracking branch 'origin/main' 2026-11-01 14:59:11 +03:00
06d818cc61 fix: header normalization fixed in server 2026-11-01 14:58:54 +03:00
aa718ae7d0 Document detailed Swagger response schemas for every API 2026-11-01 14:02:47 +03:00
c87ef35390 Implement chapter-based learning, public catalog, and demo fixtures 2026-11-01 13:38:28 +03:00
3ab841c869 Add offline Swagger documentation export 2026-10-29 12:21:10 +03:00
e9c657e2ed Complete Swagger documentation and validate API contracts 2026-10-28 23:11:18 +03:00
84d908e292 Prefix admin panel APIs and preserve customer API paths 2026-10-28 22:56:34 +03:00
c04440914c Enforce LMS subscriptions and add configurable referral commissions 2026-10-28 17:51:56 +03:00
09dc5917f9 Unify LMS hierarchy and assessment support 2026-10-22 13:47:22 +03:00
a1f012774e Adapt LMS backend for makeup education 2026-10-20 13:41:40 +03:00
2134b953ab Initial commit 2026-10-19 17:59:34 +03:00
1eb03b7e03 Add free subscription plans and enforce unique billing periods.
Introduce is_free plans with gateway-free checkout enrollment, require positive pricing for paid plans, and block duplicate category plus period combinations including free versus paid.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-23 21:32:33 +03:00
18c875e89c Fix subscription plan creation for zero-priced packages.
Allow price=0 by replacing required float validation with gte=0 so free plans no longer fail with a misleading required-field error.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 14:09:39 +03:00
1fc7b42533 Improve web checkout auth: phone normalization and Google web OAuth.
Normalize Ethiopian phone inputs for user lookup, accept web Google client IDs for ID token login, and update the checkout integration guide for OTP and social sign-in.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-24 16:48:53 +03:00
2791894e14 Add web checkout link API for iOS subscription paywall.
Send checkout URLs by email or SMS via POST /subscriptions/request-checkout-link, with LEARNER_WEB_CHECKOUT_BASE_URL config, RBAC permission, rate limiting, and client integration docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-24 13:09:09 +03:00
fb528e9e77 Scope practice completion to the specific parent link in Learn English and Exam Prep.
Add migration 000109, require parent context on complete, and update progress queries and LMS rollups.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-22 15:37:20 +03:00
977e4e73e2 Speed up activity log listing with batch actor lookups and search filter.
Batch-load users and team members per page instead of N+1 lookups, and add server-side search on message, action, and resource fields.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 13:13:28 +03:00
135c2bd5ce Add server-side audience filters to GET /users for notification targeting.
Extend UserFilter and GetAllUsers so admins can segment platform users by profile, subscription, engagement, and device fields when building notification audiences.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-16 19:27:39 +03:00
3304d8818f Keep draft practices visible to admin staff and allow multiple Learn English practices per parent.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 12:03:05 +03:00
9c4636ec83 Improve practice full-load errors and orphan response filtering.
Surface underlying load failures in the API message, accept pointer practice types, and keep question counts aligned when set items are missing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 16:45:25 +03:00
f2a1d6ccf5 Add question preview_text so admin bank lists show readable prompts.
DYNAMIC and outbound-dynamic questions omit question_text; preview_text exposes the learner-facing wording for search and display.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 15:54:46 +03:00
644a781cbb Map invalid profile analytics values to field defaults instead of Other.
Empty, unknown, and out-of-catalog values fold into per-field defaults so demographics charts no longer surface an Other bucket.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 13:56:28 +03:00
78b60b8a52 Fix practice full load when question set has orphaned items.
Skip missing questions instead of failing the GET so admins can open and repair practices; map stray ErrNoRows to a clearer 404.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 12:59:36 +03:00
c2e7aea142 Label non-male/female gender analytics as unassigned instead of Other.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 13:20:34 +03:00
8c8c061a00 Collapse non-male/female gender values into Other in user analytics.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 13:09:02 +03:00
f3cecf3c85 Add gender breakdown to analytics dashboard user section.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 13:04:45 +03:00
df4f4d8ade Limit staff team roles to Super Admin, Admin, and Content Manager.
Add CONTENT_MANAGER RBAC defaults, migration, and Super Admin-only team email invitations; restrict assignable team_member roles without changing platform user roles.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 12:01:02 +03:00
4cfc090d06 Block subscription plan delete when subscriptions exist.
Return 409 with a clear message instead of a foreign-key 500 when a plan is still referenced by user subscriptions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 11:21:26 +03:00
992cb3f5f1 Treat INACTIVE user status filter as all non-ACTIVE accounts.
Admin Inactive filter can return pending, deactivated, suspended, and any other non-active statuses in one query.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-04 16:53:13 +03:00
a3f4c1829d Verify stale Chapa payments before expiring them.
Recover SUCCESS/FAILED outcomes from Chapa when webhooks were missed, then expire any rows still pending.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-04 15:09:24 +03:00
d886cb68bc Make EAT the default app timezone for date filters.
Centralize Africa/Addis_Ababa and interpret YYYY-MM-DD query bounds in EAT instead of UTC.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-04 14:44:40 +03:00
651e9e7409 Use EAT for analytics windows and add payment_method filter.
Aligns revenue day/month buckets with Africa/Addis_Ababa and lets dashboards filter payment metrics by method.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-04 03:19:20 -07:00
34307d7717 Support progressive placement with one assessment set per CEFR level.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 11:04:19 -07:00
9f10bc161d Allow optional payment recording on admin grant/extend subscriptions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 10:31:15 -07:00
eb1d0c68e2 Speed up API paths with batch question loads, request memoization, and soft caches.
Also replace question options on update so placement grading stays consistent with admin edits, and tune the Postgres pool defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 00:06:43 -07:00
b1333eadae Require auth for knowledge-level updates and add mobile placement integration guide. 2026-07-31 23:36:01 -07:00
efed1b366f Add graded initial placement assessment with configurable A1–C2 thresholds.
Learners submit answers to one published placement set; the API scores auto-gradable questions, maps percent to CEFR, and updates knowledge_level.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-31 04:22:19 -07:00
2c107cf35a Improve validation error messages for oneof failures.
Return a clear allowed-values message for oneof tags so issue status updates no longer surface empty field errors.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 00:02:17 -07:00
3b08a07c85 Add subscription behaviour analytics and clean profile breakdowns.
Extend the analytics dashboard with live subscription snapshots, renewal/resubscribe metrics, and field-options normalization so Unknown and invalid profile values aggregate as Other. Also include exam_prep in the learner progress summary.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 08:46:30 -07:00
09fc1e80f7 subscription expiration six 2026-07-22 07:38:31 -07:00
dd802aca37 Block deactivated and suspended learners from all auth paths.
Enforce account status on email, phone OTP, social login, token refresh, and authenticated learner requests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 03:03:39 -07:00
d6e727152a Include shared stimulus in practice detail responses.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 08:46:35 -07:00
7f49723661 Include shared stimulus in practice question responses.
Resolve real LMS practice IDs and return stimulus blocks, block links, and additive effective dynamic payloads for paginated practice questions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 03:14:56 -07:00
6dc352b5e0 Keep shared and question stimuli separate and additive.
Preserve matching stimulus IDs, validate question-owned payloads independently, and expose additive effective payloads without overriding shared content.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 11:35:56 -07:00
7ff22080f0 Disable exam-prep precedence locking for STUDENT learners.
Exam-prep content is gated by subscription/tier only. Learn English sequential locking is unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-15 00:32:58 -07:00