hngprojects / hng_boilerplate_nestjs

Description
Apache License 2.0
182 stars 105 forks source link

[FEAT]: HELP CENTER - DELETE TOPIC #111

Closed Daniel-Ojo-Williams closed 2 weeks ago

Daniel-Ojo-Williams commented 1 month ago

Description

The help center contains topics that provide users with advice and assistance from the support team. This endpoint permanently deletes outdated or invalid topics (help guides) from the database.

Acceptance Criteria

Purpose

To delete a topic previously created

Requirements

Endpoints

[DELETE] /api/v1/help-center/topics/:id

Deletes a topic

  1. Endpoint Flow

Request

[DELETE] /api/v1/help-center/topics/:id

Successful Response

Status Code: 200

Description: Deleted successfully

{
    "success": true,
    "message": Topic deleted successfully,
    "status_code": 200
}

Error Response

Status Code: 403

Description: Forbidden, Only SuperAdmins can access this endpoint.

{
    "success": false,
    "message": Access denied,
    "status_code": 403
}

Status Code: 404

Description: No topic ID matches the ID param provided.

{
    "success": false,
    "message": Topic not found, please check and try again,
    "status_code": 404
}

Status Code: 500

Description: Internal Server error

{
    "success": false,
    "message": Something went wrong, please try again later or contact support it persists,
    "status_code": 500
}

Validations

Dependencies

Database Schema

Table name: help_center_topics

id:

title:

content:

author:

createdAt:

updatedAt:

Database diagram

database diagram

Testing

  1. Unit Tests
Daniel-Ojo-Williams commented 1 month ago

As requested by Mark here, this article has been separated to this functionality.

markessien commented 1 month ago

unclear what articles or topics are

Daniel-Ojo-Williams commented 1 month ago

Updated for consistent naming (topic) and hint on what topics are as about Help Center.

Daniel-Ojo-Williams commented 1 month ago

I've updated the description to include an explanation of what topics are in the context of the Help Center and what the endpoint does to manage them.

markessien commented 1 month ago

A "topic" is not clearly part of "help". Fix your route

Daniel-Ojo-Williams commented 1 month ago

Updated the route to /api/v1/help-center/topics/:id to provide clearer context and reflect how topics are nested under the help center page, explicitly showing that topics are part of the help center.

highb33kay commented 1 month ago

Update Message Responses

"message": String,

highb33kay commented 1 month ago

any dependencies on other tasks or systems.

highb33kay commented 1 month ago

Validations?

Daniel-Ojo-Williams commented 1 month ago

Message responses have been updated, and necessary dependencies and validations have been included as requested.