Skip to content

Conversation

@mubbi
Copy link
Owner

@mubbi mubbi commented Jul 24, 2025

This pull request introduces functionality for retrieving categories and tags via new API endpoints. It includes the addition of controllers, resources, service methods, routes, and feature tests to support these endpoints.

New API Endpoints for Categories and Tags:

  • Controllers: Added GetCategoriesController and GetTagsController to handle requests for retrieving all categories and tags, respectively. Both controllers use the ArticleService to fetch data and return JSON responses. (app/Http/Controllers/Api/V1/Category/GetCategoriesController.php - [1] app/Http/Controllers/Api/V1/Tag/GetTagsController.php - [2]
  • Resources: Created CategoryResource and TagResource to transform category and tag models into API-friendly formats. (app/Http/Resources/Api/V1/Category/CategoryResource.php - [1] app/Http/Resources/Api/V1/Tag/TagResource.php - [2]
  • Service Methods: Added getAllCategories and getAllTags methods to ArticleService to query and return categories and tags. (app/Services/ArticleService.php - app/Services/ArticleService.phpR126-R145)
  • Routes: Registered new public routes for fetching categories (/api/v1/categories) and tags (/api/v1/tags). (routes/api_v1.php - routes/api_v1.phpR27-R32)

Feature Tests for API Endpoints:

@mubbi mubbi requested a review from Copilot July 24, 2025 16:56
@mubbi mubbi self-assigned this Jul 24, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces new public API endpoints for retrieving categories and tags, expanding the existing API functionality to support metadata retrieval for articles.

  • Added controller classes to handle GET requests for categories and tags endpoints
  • Created resource classes to standardize JSON transformation for category and tag models
  • Extended ArticleService with methods to fetch all categories and tags with specific field selection

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
app/Http/Controllers/Api/V1/Category/GetCategoriesController.php Implements controller for retrieving all categories with error handling
app/Http/Controllers/Api/V1/Tag/GetTagsController.php Implements controller for retrieving all tags with error handling
app/Http/Resources/Api/V1/Category/CategoryResource.php Defines JSON resource transformation for category models
app/Http/Resources/Api/V1/Tag/TagResource.php Defines JSON resource transformation for tag models
app/Services/ArticleService.php Adds service methods to query categories and tags with field selection
routes/api_v1.php Registers new public routes for categories and tags endpoints
tests/Feature/API/V1/Category/GetCategoriesControllerTest.php Feature tests for categories endpoint including success and error scenarios
tests/Feature/API/V1/Tag/GetTagsControllerTest.php Feature tests for tags endpoint including success and error scenarios

@mubbi mubbi merged commit 44347d5 into main Jul 24, 2025
1 check passed
@mubbi mubbi deleted the feature/tags-cateogries-apis branch July 24, 2025 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants