Skip to content

Fix bug where users can repeatedly train models without reducing credits #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rohitdhakane6
Copy link
Contributor

This pull request includes significant changes to the backend application, particularly in handling webhooks and user credits. The most important changes include adding credit checks before AI model training, refactoring webhook routes, and updating database schema to add relations between User and UserCredit.

Enhancements to credit checks:

  • Added logic to check user credits before AI model training in apps/backend/index.ts.

Refactoring webhook routes:

  • Moved webhook routes for AI model training and image generation to apps/backend/routes/webhook.routes.ts and updated their URLs (apps/backend/models/FalAIModel.ts) [1] [2] [3].

Database schema updates:

  • Added a foreign key constraint to UserCredit to reference User and included the relation in the Prisma schema (packages/db/prisma/migrations/20250225175603_add_relation_usercredit_to_user/migration.sql, packages/db/prisma/schema.prisma) [1] [2] [3].

Code style improvements:

  • Fixed code formatting and added missing return statements in apps/backend/index.ts and apps/backend/routes/webhook.routes.ts [1] [2] [3].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant