Commit Graph

46 Commits

Author SHA1 Message Date
DarkSky 65c3271beb feat(server): clean up dirty data from legacy version (#15078)
#### PR Dependency Tree


* **PR #15078** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
  * Persist and replay incoming payment webhooks for reliability.
* Track provider-level subscriptions, payment events, and per-target
trial usage across providers.
  * Nightly replay job to reprocess stuck payment events.
* Shadow backfill mode and emit-suppression options to control
projection/backfill side effects.
  * Subscriptions now derived from entitlements + provider facts.

* **Bug Fixes**
* Improved error propagation, retry tracking, and safer owner-grant
projection handling.

* **Tests**
* Added webhook failure/replay, provider integration, entitlement
projection, and trial/checkout tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-04 16:38:44 +08:00
DarkSky 81760fd45c chore: cleanup legacy logic (#15072) 2026-06-03 16:20:15 +08:00
DarkSky b4be9118ad feat: doc status & share status (#14426)
#### PR Dependency Tree


* **PR #14426** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Admin dashboard: view workspace analytics (storage, sync activity, top
shared links) with charts and configurable windows.
* Document analytics tab: see total/unique/guest views and trends over
selectable time windows.
* Last-accessed members: view who last accessed a document, with
pagination.
* Shared links analytics: browse and paginate all shared links with
view/unique/guest metrics and share URLs.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-13 01:01:29 +08:00
DarkSky 6951f1002f feat: improve event handle (#14177) 2025-12-29 18:54:59 +08:00
DarkSky 762b702e46 feat: sync rcat data (#13628)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* RevenueCat support: public webhook endpoint, webhook handler/service,
nightly reconciliation and per-user sync; subscriptions now expose
provider and iapStore; new user-facing error for App Store/Play-managed
subscriptions.
* **Chores**
* Multi-provider subscription schema (Provider, IapStore); Stripe
credentials moved into payment.stripe (top-level apiKey/webhookKey
deprecated); new payment.revenuecat config and defaults added.
* **Tests**
  * Comprehensive RevenueCat integration test suite and snapshots.
* **Documentation**
  * Admin config descriptions updated with deprecation guidance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-23 08:52:23 +00:00
DarkSky a0b73cdcec feat: improve model resolve (#13601)
fix AI-419
2025-09-18 10:51:12 +00:00
Yii 61da63a4a0 fix(server): separate active subscriptions (#13077)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved accuracy of subscription management by ensuring only active
or trialing subscriptions are considered in all relevant user,
workspace, and license actions.
* Enhanced consistency in subscription retrieval for workspace member
updates and subscription-related operations.

* **Refactor**
* Updated internal subscription retrieval methods to distinguish between
general and active subscriptions for more precise handling across the
app.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-08 03:02:08 +00:00
forehalo 0ea38680fa refactor(server): config system (#11081) 2025-03-27 12:32:28 +00:00
forehalo 8b67496951 refactor(server): saving past_due subscription in db (#10908)
close CLOUD-122
2025-03-17 10:17:14 +00:00
forehalo ea72599bde feat(server): ban account (#10761)
close CLOUD-158
2025-03-12 02:52:18 +00:00
fengmk2 289d3cd20e feat(server): get public user by id (#10434)
close CLOUD-160
2025-03-06 15:25:06 +00:00
forehalo 8129434a2e fix(server): allow to checkout selfhost team in canary (#10130) 2025-02-12 12:19:28 +00:00
forehalo 7826e2b7c8 refactor(server): use feature model (#9932) 2025-02-05 10:27:26 +00:00
forehalo 994d758c07 feat(server): support selfhost licenses (#8947) 2025-01-22 10:21:07 +00:00
forehalo 44de4474c3 feat(server): use user model (#9710) 2025-01-17 07:06:12 +00:00
forehalo 0e73737407 refactor(server): make redis required module (#9121) 2024-12-13 06:27:15 +00:00
forehalo 4c23991047 chore: rename fundamentals to base (#9119) 2024-12-13 06:27:13 +00:00
forehalo 564faa439a fix(server): should auto apply ea price for users (#9082) 2024-12-10 05:31:19 +00:00
forehalo 0436e59b6a feat(server): auto init stripe products when development (#9034) 2024-12-05 14:21:59 +00:00
forehalo 5bf8ed1095 feat(server): support team workspace subscription (#8919)
close AF-1724, AF-1722
2024-12-05 08:31:01 +00:00
forehalo 4055e3aa67 refactor(server): payment service (#8906) 2024-12-05 08:31:00 +00:00
Boshen c349a24e95 chore: upgrade oxlint to v0.13.2 (#8891)
Co-authored-by: LongYinan <lynweklm@gmail.com>
2024-11-26 17:56:35 +08:00
forehalo 69fb5c06f4 feat(server): support onetime payment subscription (#8369) 2024-10-10 10:12:40 +00:00
forehalo 4ec89ebd69 chore(server): standardize server db names and columns (#7674) 2024-07-31 07:59:23 +00:00
forehalo 14fbeb7879 fix(server): should clean bill date if lifetime subscription (#7577) 2024-07-23 08:19:28 +00:00
forehalo 9ef8829ef1 feat(server): add lifetime plan flag (#7443) 2024-07-08 07:41:30 +00:00
forehalo de91027852 feat(server): support lifetime subscription (#7405)
closes CLOUD-48

- [x] lifetime subscription quota
- [ ] tests
2024-07-08 07:41:26 +00:00
liuyi 54fc1197ad feat(server): introduce user friendly server errors (#7111) 2024-06-17 11:30:58 +08:00
forehalo 41bc683eed fix(server): should update stripe customer email if changed (#7181) 2024-06-08 15:52:23 +00:00
forehalo aff166a0ef feat(server): add administrator feature (#6995) 2024-05-27 11:17:21 +00:00
darkskygit 8e0a0a7f02 fix: wait activated event (#6814) 2024-05-07 09:44:38 +00:00
forehalo 7041991967 fix(server): allow promotion codes if no discount applied (#6810) 2024-05-07 07:44:41 +00:00
forehalo f566457dcf test(server): payment tests (#6737) 2024-04-30 06:59:54 +00:00
darkskygit 8bdd940ac8 fix: some event missing with multiple env webhook (#6705) 2024-04-26 02:56:09 +00:00
forehalo 2c228a35f8 fix(server): stripe webhook calls in random order (#6702) 2024-04-25 12:22:07 +00:00
forehalo 651a99a48e fix(server): avoid store unpaid subscriptions 2024-04-17 16:25:03 +08:00
liuyi 5b315bfc81 fix(server): only returns active subscriptions (#6590) 2024-04-17 16:19:34 +08:00
forehalo e1c292b8b5 feat(server): support registering ai early access users (#6565) 2024-04-16 13:54:08 +00:00
darkskygit 1b0864eb60 feat: check quota correctly (#6561) 2024-04-16 09:41:48 +00:00
liuyi edef9b2735 fix(server): only auto apply coupon in pro subscription (#6452) 2024-04-03 17:13:18 +08:00
Brooooooklyn 10af0ab48d feat(server): support ai plan (#6216) 2024-03-22 08:39:18 +00:00
Brooooooklyn aecc523663 fix(server): avoid error when other prices added but logic is not released (#6191) 2024-03-22 08:39:12 +00:00
liuyi fb3a0e7b8f refactor(server): auth (#5895)
Remove `next-auth` and implement our own Authorization/Authentication system from scratch.

## Server

- [x] tokens
  - [x] function
  - [x] encryption

- [x] AuthController
  - [x] /api/auth/sign-in
  - [x] /api/auth/sign-out
  - [x] /api/auth/session
  - [x] /api/auth/session (WE SUPPORT MULTI-ACCOUNT!)

- [x] OAuthPlugin
  - [x] OAuthController
  - [x] /oauth/login
  - [x] /oauth/callback
  - [x] Providers
    - [x] Google
    - [x] GitHub

## Client

- [x] useSession
- [x] cloudSignIn
- [x] cloudSignOut

## NOTE:

Tests will be adding in the future
2024-03-12 10:00:09 +00:00
liuyi 4d421a324f refactor(server): import prisma from @prisma/client (#5863) 2024-02-22 07:46:57 +00:00
liuyi e3b8d0dba4 feat(server): allow pass coupon to checkout session (#5749) 2024-01-31 21:34:22 +08:00
liuyi e516e0db23 refactor(server): plugin modules (#5630)
- [x] separates modules into `fundamental`, `core`, `plugins`
- [x] optional modules with `@OptionalModule` decorator to install modules with requirements met(`requires`, `if`)
- [x] `module.contributesTo` defines optional features that will be enabled if module registered
- [x] `AFFiNE.plugins.use('payment', {})` to enable a optional/plugin module
- [x] `PaymentModule` is the first plugin module
- [x] GraphQLSchema will not be generated for non-included modules
- [x] Frontend can use `ServerConfigType` query to detect which features are enabled
- [x] override existing provider globally
2024-01-22 07:40:28 +00:00