hngprojects / hng_boilerplate_expressjs

74 stars 83 forks source link

[FEAT]: API Endpoint for Retrieving a Single Organization by Super Admin #201

Open Xcoder03 opened 2 months ago

Xcoder03 commented 2 months ago

Description

Implement an API endpoint to retrieve a single organization by its ID. This endpoint will be accessible only to users with the role of SUPER_ADMIN.

Endpoint Feature

Acceptance Criteria

Request Example:

GET /api/v1/organisation/:id

Response Example

On successful retrieval of the organization, the API should return a 200 OK status code. The response body should contain the details of the organization: JSON

{
  "status": "success",
  "status_code": 200,
  "data": {
    "id": 1,
    "name": "Organization Name",
    "email": "org@example.com",
    "industry": "Industry",
    "type": "Type",
    "country": "Country",
    "address": "Address",
    "state": "State"
  }
}

If the organization is not found, the API should return a 404 Not Found status code with an appropriate message: JSON

{
  "status": "unsuccessful",
  "status_code": 404,
  "message": "Organization not found."
}

Data Validation

Input Validation:

{
  "status": "unsuccessful",
  "status_code": 400,
  "message": "Invalid organization ID."
}

Output Validation:

{
  "status": "unsuccessful",
  "status_code": 500,
  "message": "Failed to retrieve organization. Please try again later."
}

Error Handling

Error Responses:

Edge Cases

Performance and Security

Performance Considerations:

Security Concerns:

Documentation

API Documentation:

Technical Notes

Testing Requirements

Unit Tests:

Integration Tests:

Dependencies and Impact

Dependencies:

Impact Analysis:

PreciousIfeaka commented 2 months ago

You didn't format your markdown well.

Xcoder03 commented 2 months ago

oh okay, please can I know what was wrong let me change it