hngprojects / hng_boilerplate_nestjs

Description
Apache License 2.0
182 stars 105 forks source link

[FEAT] Implement API Endpoint to DELETE Subscription Plans: By Admin #231

Closed thenoblet closed 2 weeks ago

thenoblet commented 1 month ago

Description

Implement the endpoint to delete a specific plan. This feature will enable administrators to manage existing subscription plans by allowing them to delete plans as necessary.

Purpose

Acceptance Criteria

Delete Plan

Requirements

Delete Plan

Expected Outcome

Checklist

  1. Delete Plan

    • [ ] Implement DELETE /api/v1/plans/{id} endpoint
    • [ ] Validate plan ID
    • [ ] Secure endpoint with authentication and authorization for administrators.
    • [ ] Handle and return errors

Testing

Documentation

Endpoint

Delete Plan

Description: Delete a specific plan.
Endpoint: DELETE /api/v1/plans/{id}
Authentication: Required
Authorization: Administrators only
Response (Success):

{
  "message": "Plan deleted successfully.",
  "status_code": 200
}

Response (Error: General Failure):

{
  "message": "Failed to delete plan.",
  "status_code": 500
}

Response (Error: Plan Not Found):

{
  "message": "Plan not found.",
  "status_code": 404
}
thenoblet commented 1 month ago

Hello Mentors, this issue complements the existing issue [FEAT] Implement API Endpoints for Creating Subscription Plans. and [FEAT]: Organization Billing Plans - Retrieve Plans for Super Admin and Owners. While the existing issues focuses on CREATING and RETRIEVING subscription plans, my issue addresses the endpoint required for 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.

phurhard commented 1 month ago

Update your response to follow the given criteria

thenoblet commented 1 month ago

Update your response to follow the given criteria

@phurhard I have updated it. Using the snake_case now.

highb33kay commented 1 month ago

This is 3 endpoints? @phurhard

I think this should be separated into three tickets to allow better tracking

@thenoblet

thenoblet commented 1 month ago

This is 3 endpoints? @phurhard

I think this should be separated into three tickets to allow better tracking

@thenoblet

@phurhard, 2 endpoints please. To retrieve and delete a subscription plan. Do I need to break them into separate endpoints? @highb33kay

highb33kay commented 1 month ago

Yes, you do. Two tickets for easier tracking by PMS

highb33kay commented 1 month ago

Please create and attach second ticket here

thenoblet commented 1 month ago

@highb33kay and @phurhard, I found out that there is an issue for RETRIEVE already. So I edited this endpoint to handle the DELETE operation only.

Existing issue for RETRIEVE: [FEAT]: Organization Billing Plans - Retrieve Plans for Super Admin and Owners