ita-social-projects / Forum

Forum Repository for the development of Python project
MIT License
7 stars 3 forks source link

Implement Automatic Moderation Time Setting #666

Open VovaD199 opened 2 weeks ago

VovaD199 commented 2 weeks ago

Enhance the existing admin page to allow administrators to set the time for automatic moderation by adding a new field "Number of hours for automatic moderation". This field should accept an integer value within a specified range.

Acceptance Criteria:

  1. User identification as an Admin: 1.1. Given user has _isstaff characteristic in the DB When user logs in Then user must be navigated to the Admin screen AND user must be able to navigate to the regular website from the Admin screen

  2. Field Addition: Add a new field labeled "Кількість годин для автоматичної модерації" to the admin page at http://localhost:8080/customadmin/. 2.1. Default Value: 12 hours 2.2. Valid Value: integer in a range 1 - 48 hours

    • IF entered value <1, >48, empty THEN show the error message: 'Кількість годин має бути в діапазоні 1-48 години'

Documentation Update: Update the existing API documentation at http://localhost:8000/api/schema/docs/ to reflect the new field and its constraints.

Steps to Implement:

Database Schema Update:

Add a new column auto_moderation_hours in the relevant table to store the number of hours for automatic moderation.

Admin Page Enhancement:

Update the admin interface at http://localhost:8080/customadmin/ to include the new field. Ensure the field is labeled "Кількість годин для автоматичної модерації". Implement validation to restrict input to integers within the specified range.

Backend Validation:

Add backend validation to ensure that the value entered in the "Кількість годин для автоматичної модерації" field is an integer between the minimum and maximum values.

API Documentation:

Update the API documentation at http://localhost:8000/api/schema/docs/ to include the new field. Specify the validation rules (integer, minimum, and maximum values) in the documentation. Testing:

Test the admin page to ensure the new field is displayed correctly and validates input as expected. Test the automatic moderation feature to ensure it respects the number of hours set by the administrator.

Image