|
|
|
@ -2024,6 +2024,7 @@ hadis_main_list_swagger = swagger_auto_schema( |
|
|
|
- Supports full-text search across titles, narrator titles, Arabic text, and translations |
|
|
|
- Filter by hadis status and category titles |
|
|
|
- Includes complete category and status metadata in the response |
|
|
|
- Supports pagination for large result sets |
|
|
|
- Translations are automatically provided based on the Accept-Language header |
|
|
|
|
|
|
|
**Search Functionality:** |
|
|
|
@ -2037,11 +2038,18 @@ hadis_main_list_swagger = swagger_auto_schema( |
|
|
|
- `status`: Filter by hadis status title (e.g., "authentic", "weak") |
|
|
|
- `category`: Filter by category title (e.g., "prayer", "faith") |
|
|
|
|
|
|
|
**Pagination:** |
|
|
|
- Use `page` parameter to navigate through pages (starts from 1) |
|
|
|
- Use `page_size` parameter to control items per page |
|
|
|
- Response includes `next` and `previous` URLs for navigation |
|
|
|
|
|
|
|
**Response Structure:** |
|
|
|
- `count`: Total number of hadis returned |
|
|
|
- `count`: Total number of hadis matching the criteria (not just current page) |
|
|
|
- `next`: URL for the next page (null if on last page) |
|
|
|
- `previous`: URL for the previous page (null if on first page) |
|
|
|
- `categories`: List of all available categories with localized titles |
|
|
|
- `statuses`: List of all available hadis statuses with localized titles |
|
|
|
- `results`: Array of hadis objects with full details including individual status |
|
|
|
- `results`: Array of hadis objects for the current page with full details including individual status |
|
|
|
""", |
|
|
|
operation_summary="List All Hadis with Search & Filters", |
|
|
|
tags=['Hadis'], |
|
|
|
@ -2078,6 +2086,22 @@ hadis_main_list_swagger = swagger_auto_schema( |
|
|
|
required=False, |
|
|
|
default='en', |
|
|
|
enum=['en', 'fa', 'ar', 'ur', 'ru'] |
|
|
|
), |
|
|
|
openapi.Parameter( |
|
|
|
'page', |
|
|
|
openapi.IN_QUERY, |
|
|
|
description="Page number for pagination. Starts from 1. If not provided, returns the first page.", |
|
|
|
type=openapi.TYPE_INTEGER, |
|
|
|
required=False, |
|
|
|
example=1 |
|
|
|
), |
|
|
|
openapi.Parameter( |
|
|
|
'page_size', |
|
|
|
openapi.IN_QUERY, |
|
|
|
description="Number of items per page. If not provided, uses the default page size.", |
|
|
|
type=openapi.TYPE_INTEGER, |
|
|
|
required=False, |
|
|
|
example=20 |
|
|
|
) |
|
|
|
], |
|
|
|
responses={ |
|
|
|
@ -2086,6 +2110,8 @@ hadis_main_list_swagger = swagger_auto_schema( |
|
|
|
examples={ |
|
|
|
"application/json": { |
|
|
|
"count": 150, |
|
|
|
"next": "http://example.com/api/hadis/arguments/?page=2", |
|
|
|
"previous": None, |
|
|
|
"categories": [ |
|
|
|
"Faith Fundamentals", |
|
|
|
"Prayer Rites", |
|
|
|
@ -2094,8 +2120,8 @@ hadis_main_list_swagger = swagger_auto_schema( |
|
|
|
], |
|
|
|
"statuses": [ |
|
|
|
"Authentic (Sahih)", |
|
|
|
"Good (Hasan)", |
|
|
|
"Weak (Da'if)" |
|
|
|
"Good (Hasan)", |
|
|
|
"Weak (Da'if)" |
|
|
|
], |
|
|
|
"results": [ |
|
|
|
{ |
|
|
|
|