Skip to content
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

Implement Loyalty Points and Referral System: Schema, Controllers, Middleware, and Routes #961

Closed
IkkiOcean opened this issue Nov 9, 2024 · 2 comments · Fixed by #968 or #969
Closed
Assignees

Comments

@IkkiOcean
Copy link
Contributor

Description:

We need to implement a loyalty point and referral system in the application. This will involve the following:

  1. Loyalty Points Schema: A schema to store loyalty points for each user. Points will be awarded based on actions such as purchases, referrals, etc.
  2. Referral Schema: A schema to store the referral system details, including referrer, referee, and referral status.
  3. Controllers: Logic to handle the awarding of points, referral creation, and any other business logic related to loyalty points and referrals.
  4. Middleware: Middleware to ensure only valid users can claim loyalty points or use referral codes.
  5. Routes: Define API routes to handle actions such as:
    • Awarding loyalty points to users
    • Creating and managing referrals
    • Fetching user loyalty point balances
    • Checking referral status

Tasks:

  • Schema Design:

    • Create a LoyaltyPoint schema with fields like userId, points, earnedBy (purchase, referral, etc.), and timestamp.
    • Create a Referral schema with fields like referrerId, refereeId, referralCode, status (pending, completed), and timestamp.
  • Controllers:

    • LoyaltyPointsController: Logic to award points, check balance, and view transaction history.
    • ReferralController: Logic to generate referral codes, check referral status, and process new referrals.
  • Middleware:

    • Validation middleware for referral codes.
    • Ensure users can only claim points once for each referral or purchase.
  • Routes:

    • POST /api/loyalty-points: To award points.
    • GET /api/loyalty-points: To fetch a user's loyalty points.
    • POST /api/referrals: To generate a referral code.
    • GET /api/referrals/:code: To check if a referral code is valid and has been used.
Copy link
Contributor

github-actions bot commented Nov 9, 2024

Thank you for creating this issue! 🎉 We'll look into it as soon as possible. In the meantime, please make sure to provide all the necessary details and context. If you have any questions or additional information, feel free to add them here. Your contributions are highly appreciated! 😊

You can also check our CONTRIBUTING.md for guidelines on contributing to this project.

Copy link
Contributor

Hello @IkkiOcean! Your issue #961 has been closed. Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment