Spaces:
Sleeping
Sleeping
Task Submission Service
Overview
Task Submission Service manages the lifecycle of task submissions within the Task Management System. It lets assignees upload their work for review, tracks submission status changes, and coordinates with the task catalog so approved work marks the underlying task as complete.
Architecture Summary
- Frameworks: Spring Boot 3, Spring Cloud OpenFeign, Spring Data MongoDB, Netflix Eureka client
- Database: MongoDB collection
taskSubmission - Remote Dependencies:
TASK-SERVICE(task metadata and status updates)USER-SERVICE(authenticated user profiles)
- Key Modules:
controllerβ REST endpoints for CRUD-style submission interactionsserviceβ domain rules, inter-service calls, validation, status transitionsrepositoryβ MongoDB access with compound indexes for fast lookupsubmissionModelβ persistence entities and DTOs for remote servicesexceptionβ typed errors plus consistent REST error responses
Setup Instructions
- Prerequisites
- Java 17+
- MongoDB running locally (
mongodb://localhost:27017/submissionsby default) - Optional: Eureka server on
http://localhost:8085/eurekafor service discovery
- Install dependencies
cd TaskSubmissionService ./gradlew clean build - Run the service
Environment may be configured via./gradlew bootRunsrc/main/resources/application.propertiesor external properties. - Run automated tests
./gradlew test
API Endpoints
| Method | Path | Description |
|---|---|---|
GET |
/submissions |
List all submissions (legacy UI compatibility) |
POST |
/api/submissions |
Create a submission for the authenticated user (expects { "taskId", "content" }) |
GET |
/api/submissions/{submissionId} |
Retrieve a specific submission |
GET |
/api/submissions |
List submissions (sortable newest first) |
GET |
/api/submissions/task/{taskId} |
List submissions for a given task |
PUT |
/api/submissions/{submissionId} |
Update status/content (admins may approve/reject, owners may edit content while pending) |
Responses are JSON objects using TaskSubmissionResponse, which surfaces id, taskId, userId, status, content, createdAt, and updatedAt (ISO timestamps). Status values are lower-case strings (pending, approved, rejected).
Changes Summary
- Replaced stubbed service layer with a fully implemented
SubServiceImpfeaturing validation, permission checks, remote task integration, and approval workflow. - Introduced DTOs (
TaskSubmissionRequest,TaskSubmissionResponse,SubmissionStatusUpdateRequest) and modernized controllers to return typed responses. - Hardened persistence model (
TaskSubmission) with auditing timestamps, compound indexes, enums (SubmissionStatus,TaskStatus), and utility helpers for status/content updates. - Added dedicated exceptions plus
RestExceptionHandlerto surface consistent HTTP errors for duplicates, invalid state, and authorization failures. - Enabled Mongo auditing, refined Feign clients to leverage Eureka discovery, and documented the service with setup instructions, endpoint catalogue, and test guidance.
- Created unit tests for core service behaviours, ensuring duplication safeguards, access control, and remote error handling remain covered.