Commit Graph

19 Commits

Author SHA1 Message Date
Giancarlo Buomprisco
6f9cf22fa8 EsLint v9 (#154)
* Upgrade ESLint and related configurations to version 9

- Update ESLint to version 9.19.0
- Migrate ESLint configurations to flat config format
- Remove deprecated ESLint config files
- Update package dependencies and configurations
- Simplify ESLint setup across packages
- Remove unnecessary ESLint config blocks from package.json files
- Improved CI caching with Turborepo tasks
- Removed duplicate styles
2025-02-07 11:38:29 +08:00
Giancarlo Buomprisco
fcdae7aa65 Improve reusability of the webhook handler to allow converting the route to a Pages Router API Route. (#110) 2025-02-04 09:46:52 +08:00
gbuomprisco
ff18a294ad Refactor Supabase client usage
Replaced various Supabase client imports with standardized admin and server clients across multiple files. This change ensures consistent and appropriate usage of admin and non-admin Supabase clients in server actions and services.
2024-08-14 13:43:53 +02:00
giancarlo
08de59a43a Update dependencies and improve type safety in webhook handling
This commit updates various dependencies across the project, including a version bump for 'lucide-react' and 'prettier'. Additionally, it improves type safety in the 'database-webhook-handler.service.ts' by making the 'DatabaseChangePayload' and 'handleEvent' function more type-safe.
2024-06-03 00:33:49 +07:00
giancarlo
6be43ef77c Remove console logs from webhook verifier
In the server service for verifying webhooks from the Postgres database, unnecessary console logs that were printing the header and secret were removed. This change aligns with the best practices for production code where debug logs are not expected.
2024-05-04 00:10:38 +07:00
giancarlo
65e8dab1b2 Update codebase to enhance debugging and improve user interface
The codebase has been updated throughout to improve debugging capabilities notably in the PostgresDatabaseWebhookVerifierService and create-reader modules. User interface has also been enhanced in the marketing layout and blog page. Minor reordering of entries in email-templates and adjustment of configurations in turbo.json has also been performed.
2024-05-02 01:16:50 +07:00
giancarlo
437935e492 Refactor webhook handling and router services
Webhook handling has been made more flexible with an optional custom event handler in the 'handleWebhook' function. A new 'DatabaseChangePayload' type has been created to define the payload for database change events, aiding custom webhook handling. The 'DatabaseWebhookRouterService' has been changed to a factory function. This transformation improves the service initialization, making it more readable and testing friendly. Some potential noisy logs in the default case are also removed.
2024-04-30 11:42:57 +07:00
giancarlo
14dee4f347 Refactor webhook handler service and update dependencies
Refactor to make database webhook handler service a function. This change introduces the function `getDatabaseWebhookHandlerService()` to return an instance of the service, allowing easier management of instances. Dependencies are updated as well, including bringing `react-i18next` to version 14.1.1(i18next@23.11.3) and `@react-email/components` to version 0.0.17 and others.
2024-04-30 02:36:48 +07:00
giancarlo
6814cc7089 Fix linting 2024-04-23 00:15:41 +08:00
giancarlo
17e0781581 Refactored classes according to new convention 2024-04-23 00:10:12 +08:00
giancarlo
4914a56460 Refactor webhook signature verification process
The signature verification process for webhooks has been abstracted. Instead of performing the check directly in the handleWebhook method, it has been moved to a separate service class: PostgresDatabaseWebhookVerifierService. This refactor improves modularity and enables extending or replacing the verification logic more comfortably. The WEBHOOK_SENDER_PROVIDER environment variable is used to determine which verifier service to use.
2024-04-18 21:03:36 +08:00
giancarlo
5adfb3edac Refactor account deletion process and improve invitation functionalities
The account deletion process has been refactored to send account deletion emails from the AccountWebhooksService instead of from the deletePersonalAccount service. This has resulted in the addition of the AccountWebhooksService and modification of the seeds.sql file to trigger a webhook after account deletion. Along with this, the account invitation functionalities within the accountInvitations service have been considerably enhanced, making it much clearer and easier to use.
2024-04-09 16:26:50 +08:00
giancarlo
9fca45c2de Replace Logger with getLogger and update next version
This commit replaces the use of Logger with getLogger in various parts of the code to handle logging. The Logger has been replaced with getLogger, which assists in getting logs in an asynchronous manner. In addition to this, it updates the next version in pnpm-lock.yaml from next@14.2.0-canary.61 to next@14.2.0-canary.62 and various other dependencies. Also made minor annotations and comments to the function 'isBrowser' and 'formatCurrency' in the 'utils.ts' file.
2024-04-08 12:23:15 +08:00
giancarlo
220a23e185 Implement updateSubscription feature and refactor billing services
This commit introduces the updateSubscription method to the BillingStrategyProviderService, ensuring that subscriptions can be updated within the billing core. Additionally, a refactor has been applied to the BillingGatewayFactoryService and stripe-billing-strategy.service to improve error handling and the robustness of subscription updates. Logging in the webhook route has been adjusted for clarity and the data model has been enhanced.
2024-04-04 20:15:12 +08:00
giancarlo
35ef90b4f8 Update Supabase dependency, delete cookie handling, create logger
Updated Supabase dependency across multiple packages from "^2.41.1" to "^2.42.0". Removed files handling sidebar state and theme cookies. Created a new Logger interface for managing log messages in the shared package. Enhanced the middleware to track accounts membership webhook payload. Minor adjustments were also made in multiple package.json files.
2024-04-03 23:59:41 +08:00
giancarlo
2dc2c6461e Implement error handling and adjust import paths
This commit introduces error handling in the 'database-webhook-handler.service.ts' to log and rethrow errors when processing webhooks. It also adjusts the import paths for ContentlayerClient and WordpressClient in 'create-cms-client.ts'. Method names in 'database-webhook-router.service.ts' have been updated for clarity.
2024-04-02 16:03:11 +08:00
giancarlo
aa12ecd5a2 Refactor API code and simplify billing display
The code in the webhook API has been refactored to move the DatabaseWebhookHandlerService instance out of the POST function scope. Furthermore, the display of renewal plan details on the billing page has been simplified and certain parts deemed superfluous have been removed. Numerous types and interfaces in the database.types.ts file have also been corrected and formatted for consistency and improved readability.
2024-03-31 15:13:44 +08:00
giancarlo
2c0c616a2d Rename component files and update code dependencies
Numerous component files have been renamed for better organization and readability. This includes changing 'app' to 'account-layout' in various instances and 'organization' to 'team' to ensure consistency across code. Additionally, dependencies within codes have been updated in line with the renaming. The pull request also includes a minor update to the pnpm-lock file, reflecting the latest version of Next.js.
2024-03-31 01:05:32 +08:00
giancarlo
e158ff28d8 Improve and update billing flow
This commit updates various components in the billing flow due to a new schema that supports multiple line items per plan. The added flexibility rendered 'line-items-mapper.ts' redundant, which has been removed. Additionally, webhooks have been created for handling account membership insertions and deletions, as well as handling subscription deletions when an account is deleted. This message also introduces a new service to handle sending out invitation emails. Lastly, the validation of the billing provider has been improved for increased security and stability.
2024-03-30 14:51:16 +08:00