feat(categories & tags): added New APIs for categories and tags #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
GetCategoriesControllerandGetTagsControllerto handle requests for retrieving all categories and tags, respectively. Both controllers use theArticleServiceto fetch data and return JSON responses. (app/Http/Controllers/Api/V1/Category/GetCategoriesController.php- [1]app/Http/Controllers/Api/V1/Tag/GetTagsController.php- [2]CategoryResourceandTagResourceto 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]getAllCategoriesandgetAllTagsmethods toArticleServiceto query and return categories and tags. (app/Services/ArticleService.php- app/Services/ArticleService.phpR126-R145)/api/v1/categories) and tags (/api/v1/tags). (routes/api_v1.php- routes/api_v1.phpR27-R32)Feature Tests for API Endpoints:
GetCategoriesControllerto verify successful retrieval of categories and proper error handling when the service throws an exception. (tests/Feature/API/V1/Category/GetCategoriesControllerTest.php- tests/Feature/API/V1/Category/GetCategoriesControllerTest.phpR1-R45)GetTagsControllerto ensure the endpoint correctly retrieves tags and handles service exceptions. (tests/Feature/API/V1/Tag/GetTagsControllerTest.php- tests/Feature/API/V1/Tag/GetTagsControllerTest.phpR1-R45)