Skip to content

Feature: Implement Ratings API for Tasks #2

@Prathyushanuthi-hub

Description

@Prathyushanuthi-hub

Feature Request

Summary

Implement a /ratings API endpoint to allow users to rate tasks in the Task Manager Application.

Description

Users should be able to rate tasks to provide feedback on task completion quality, difficulty, or satisfaction. This feature will enhance task management by adding a rating dimension to completed tasks.

Proposed API Endpoints

Method Endpoint Description
POST /ratings Create a new rating for a task
GET /ratings Get all ratings (with optional filters)
GET /ratings/:id Get a specific rating by ID
GET /ratings/task/:taskId Get all ratings for a specific task
PUT /ratings/:id Update an existing rating
DELETE /ratings/:id Delete a rating

Data Model

Rating:
- id: integer (auto-generated)
- task_id: integer (required, foreign key to Task)
- score: integer (required, 1-5)
- comment: string (optional, max 500 chars)
- created_at: datetime (auto-generated)
- updated_at: datetime (auto-generated)

Acceptance Criteria

  • Create Rating model with SQLAlchemy
  • Create Pydantic schemas for request/response validation
  • Implement POST /ratings endpoint with task_id validation
  • Implement GET /ratings endpoint with filtering by task_id
  • Implement GET /ratings/:id endpoint
  • Implement PUT /ratings/:id endpoint
  • Implement DELETE /ratings/:id endpoint
  • Add input validation (score must be 1-5)
  • Add proper error handling (400, 404, 500 status codes)
  • Add foreign key relationship to Task model
  • Update API documentation

Technical Considerations

  • Follow existing MVC architecture pattern
  • Use SQLAlchemy ORM for database operations
  • Use Pydantic for input validation and sanitization
  • Ensure rating score is validated (1-5 range)
  • Task must exist before rating can be created
  • Consider average rating calculation for tasks

Priority

Medium

Labels

enhancement, api, feature-request

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions