hngprojects / hng_boilerplate_nestjs

Description
Apache License 2.0
181 stars 105 forks source link

[FEAT] Implement API Endpoints for Creating Subscription Plans #55

Closed davidolanrewaju closed 1 week ago

davidolanrewaju commented 1 month ago

Description

Develop backend support to create subscription plans. This feature will enable admin to create various plans.

Acceptance Criteria

Error Handling:

Security Measures:

Purpose

To provide admin with the ability to create different subscription plans.

Requirements

Expected Outcome

  1. The backend should handle subscription plan creation efficiently.
  2. The system should log responses and errors properly

DB Schema

349881877-9cdff051-4898-4951-ba4e-118c1de3d29c

Endpoints

{ "status": 403, "error": "User is not authorized to create subscription plans." }


- #### Error Response: Subscription Plan already exists

HTTP/1.1 400 Subscription plan already exists Content-Type: application/json

{ "status": 400, "error": "subscription plan already exists." }



### Tasks
- [ ] Create an endpoint (HTTP POST /api/v1/plans) to create new subscription plans.
- [ ] Write unit tests for the endpoint.
- [ ] Write integration tests for the plan creation process.

### Testing
- Write unit tests for authorization and fetching products.
- Write integration tests for the end-to-end process.
- Perform security testing to ensure data protection and compliance.
markessien commented 1 month ago

fetching products is not a super admin matter, and so called top products is just a filter

davidolanrewaju commented 1 month ago

@buka4rill

davidolanrewaju commented 1 month ago

Team members working on this issue include:

P.S: I couldn't assign them directly to the repo since they don't have access to the repo. Also, the names signify their slack ids

Shullyd7 commented 1 month ago

Specify status codes in all the response payload

thenoblet commented 1 month ago

Hello everyone @markessien, @buka4rill, @davidolanrewaju

I’ve created a new issue Implement API Endpoints for READ/GET and DELETE Subscription Plans that complements this issue. While this issue focuses on creating subscription plans, my issue addresses the endpoints required for reading, getting, and deleting those subscription plans.

The goal is to complete the suite of CRUD operations for subscription plans, ensuring a comprehensive API that covers all necessary interactions with subscription data. Please refer to the new issue #231 for details on the additional endpoints needed.