Skip to content

[FEAT] Fetch All Subscribers to Newsletter (Paginated)Β #411

Open
@Qazim-tec

Description

@Qazim-tec

[FEAT] Fetch All Subscribers to Newsletter (Paginated)

πŸ“ Description

Develop an endpoint to retrieve all active newsletter subscribers. The endpoint should support pagination, allowing clients to specify the page number and limit per request.


βœ… Acceptance Criteria

  • Fetches all active newsletter subscribers.
  • Supports pagination with configurable page size.
  • Returns the appropriate response and status code.

πŸ“Œ Requirements

Endpoint:

  • Method: GET
  • URL: /api/v1/pages/newsletter/subscribers
  • Headers: Content-Type: application/json

Query Parameters:

Parameter Type Required Default Description
page Integer ❌ No 1 The page number to retrieve.
limit Integer ❌ No 10 The number of subscribers per page.

πŸ”Ή Responses

βœ… Successful Response

{
    "success": true,
    "status_code": 200,
    "message": "Subscribers retrieved successfully",
    "data": [
        {
            "id": 1,
            "email": "[email protected]"
        },
        {
            "id": 2,
            "email": "[email protected]"
        }
    ],
    "pagination": {
        "page": 1,
        "limit": 10,
        "total": 100
    }
}

❌ Error Response (No Subscribers Found)

{
    "success": false,
    "status_code": 404,
    "message": "No subscribers found"
}

❌ Error Response (Invalid Pagination Parameters)

{
    "success": false,
    "status_code": 400,
    "message": "Invalid pagination parameters"
}

πŸ§ͺ Unit Tests

-βœ… Ensure only active subscribers are retrieved.
-βœ… Validate pagination functionality (correct number of records per page).
-βœ… Verify the response structure and status codes.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions