{"id":51016625,"url":"https://github.com/batdimoiprint/kaagapay-backend","last_synced_at":"2026-06-21T11:30:58.566Z","repository":{"id":353416436,"uuid":"1219275080","full_name":"batdimoiprint/kaagapay-backend","owner":"batdimoiprint","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-14T12:56:51.000Z","size":208,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-08T18:17:51.399Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/batdimoiprint.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-23T17:57:00.000Z","updated_at":"2026-05-14T12:56:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/batdimoiprint/kaagapay-backend","commit_stats":null,"previous_names":["batdimoiprint/kaagapay-backend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/batdimoiprint/kaagapay-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batdimoiprint%2Fkaagapay-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batdimoiprint%2Fkaagapay-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batdimoiprint%2Fkaagapay-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batdimoiprint%2Fkaagapay-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/batdimoiprint","download_url":"https://codeload.github.com/batdimoiprint/kaagapay-backend/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batdimoiprint%2Fkaagapay-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34608892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-21T11:30:55.943Z","updated_at":"2026-06-21T11:30:58.558Z","avatar_url":"https://github.com/batdimoiprint.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kaagapay Backend: Technical Guide and Local Setup\n\nThis guide provides a technical overview of the Kaagapay Backend tech stack and instructions to run the application on your local machine.\n\n---\n\n## Tech Stack and Libraries\n\nThe Kaagapay backend is built with the following core technologies:\n\n### Core Frameworks\n\n- Language: Java 21\n- Framework: Spring Boot 3.2.5\n- Database: PostgreSQL\n- Security: Spring Security with JWT (JSON Web Tokens)\n- API Documentation: SpringDoc OpenAPI (Swagger UI)\n\n### Key Dependencies\n\n- Spring Data JPA: Handles database interactions and ORM.\n- io.jsonwebtoken (JJWT) 0.12.5: Manages secure authentication and token generation.\n- Cloudinary (cloudinary-http5): Manages media uploads and storage.\n- Pushy: Handles push notification services.\n- Spring Boot DevTools: Provides fast application restarts during development.\n\n---\n\n## Local Setup Instructions\n\nFollow these steps to run the backend.\n\n### 1. Prerequisites\n\nEnsure you have the following installed:\n\n- Java 21 JDK\n- Maven (or use the included ./mvnw wrapper)\n\n### 2. Build the Application\n\nOpen a terminal in the kaagapay-backend/ directory and run:\n\n```bash\n./mvnw clean install\n```\n\n### 3. Run the Backend\n\nStart the server using the Spring Boot Maven plugin:\n\n```bash\n./mvnw spring-boot:run\n```\n\nThe backend will be accessible at http://localhost:8081.\n\n---\n\n## API Documentation\n\nYou can view the interactive API documentation and test endpoints via Swagger UI:\n\nURL: http://localhost:8081/swagger-ui.html\n\n---\n\n## Complaint Severity Scoring\n\nNew complaints receive a server-generated `severityScore` and `severityLabel` before they are saved. The client should send the complaint details only; the backend computes the severity from `complaintType` and the incident flags below:\n\n- `complaintType`\n- `hasInjury`\n- `needsImmediateResponse`\n- `hasPropertyDamage`\n- `affectedPeopleCount`\n\nSeverity points are calculated using these rules:\n\n| Factor                                                                                                                                                                                                                                                                                                                     |         Points |\n| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------: |\n| `Fire Hazard / Open Burning`, `Electrical Hazard`, `Animal Bite / Attack`, `Missing Person (local report)`, `Harassment / Threats`                                                                                                                                                                                         |            +50 |\n| Injury reported                                                                                                                                                                                                                                                                                                            |            +35 |\n| `Domestic Conflict`, `Theft / Petty Crime`, `Suspicious Activity`, `Public Health Concern`, `Infrastructure Damage`, `Tree Obstruction / Fallen Tree`                                                                                                                                                                      |            +30 |\n| Needs immediate response                                                                                                                                                                                                                                                                                                   |            +25 |\n| Multiple people affected (`affectedPeopleCount \u003e 1`)                                                                                                                                                                                                                                                                       |            +20 |\n| Property damage                                                                                                                                                                                                                                                                                                            |            +15 |\n| `Vandalism / Property Damage`, `Trespassing`, `Water Leakage / Pipe Issue`, `Drainage / Flooding`, `Clogged Canal / Sewer`, `Road Damage / Potholes`, `Broken Streetlight`, `Illegal Construction`, `Building Code Violation`, `Pollution (air water noise)`, `Abandoned Vehicle`, `Illegal Vendor / Sidewalk Obstruction` |            +15 |\n| `Neighborhood Dispute`, `Noise Complaint`, `Public Disturbance`, `Illegal Parking / Obstruction`, `Waste / Garbage Issue`, `Sanitation Problem`, `Animal Concern`, `Stray Animals`, `Noise from Business`, `Curfew Violation`, `Ordinance Violation`, `Parking Dispute`, `Lost and Found`, `Other`                         |             +5 |\n| Has photo/video evidence                                                                                                                                                                                                                                                                                                   |             +5 |\n| Older unresolved report by incident date: 1+ days / 3+ days / 7+ days                                                                                                                                                                                                                                                      | +5 / +10 / +15 |\n\nSeverity labels are assigned by score range:\n\n| Score Range | Label    |\n| ----------: | -------- |\n|      0 - 24 | LOW      |\n|     25 - 49 | MODERATE |\n|     50 - 79 | HIGH     |\n|         80+ | CRITICAL |\n\n`GET /complaints` returns all reports sorted by highest `severityScore` first. The prioritization is handled in `ComplaintPriorityService` with an explicit brute-force O(n^2) nested-loop comparison. You can also request `GET /complaints?sort=CREATED` to sort by `dateOfIncident` instead.\n\n### Severity behavior notes\n\n- The backend does not expect the client to send `severityScore` or `severityLabel`.\n- `complaintType` should be one of the supported complaint categories listed above.\n- If a type is not recognized exactly, it falls back to no type-based points, but the boolean flags and media/date rules still apply.\n\n---\n\n## Project Structure\n\n- src/main/java/backend/controller: API Request handlers.\n- src/main/java/backend/service: Business logic and external service integration.\n- src/main/java/backend/repository: Database access layer.\n- src/main/java/backend/security: Authentication and authorization logic.\n- src/main/resources/application.properties: Centralized application settings.\n\n---\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatdimoiprint%2Fkaagapay-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbatdimoiprint%2Fkaagapay-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatdimoiprint%2Fkaagapay-backend/lists"}