Daily backups and bug hunting#34
Merged
Merged
Conversation
/me and /{id} were missing
…ies for deployment
GET /api/consent List all my consents
POST /api/consent Grant consent to a provider
PUT /api/consent/{id}/revoke Revoke a consent
…le encryption key to be set when deploying
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR prepares the
secure-health-apifor production deployment on AWS by addressing previously missing endpoints, hardening security configurations, and introducing critical data management features required for a healthcare application.Key Features & Enhancements
1. Security & Configuration Hardening
CORSorigins,server.port,ddl-auto, andshow-sqlto application.properties (configurable via environment variables).@RestControllerAdvice. It now returns standardized JSON ErrorResponse objects forMethodArgumentNotValidException,AccessDeniedException, JWT validation errors, and custom expected business logic exceptions.@PreAuthorize("hasAuthority('ROLE')")annotations across all controllers.2. Completed API Endpoints
GET /api/auth/me): Added an endpoint to safely extract the authenticated user's profile from the JWT rather than relying on frontend local storage parsing.GET /{id}endpoints for Appointments,MedicalRecords,Prescriptions, andLabResults.GET /api/appointments/status/{status}andGET /api/appointments/statsfor robust dashboard reporting.3. Patient Consent Management
PATIENTusers to explicitly grant or revoke granular data access (MEDICAL_RECORDS,VITAL_SIGNS,ALL, etc.) to specific healthcare providers.4. Encrypted File Uploads
uploadUrlto MedicalRecord and created FileStorageService.APP_ENCRYPTION_KEY.5. Automated Data Archival & Backups
@Scheduledto execute compressedpg_dumpsnapshots. Supports auto-cleanup of old backups based on a configurable retention period.archived_userssnapshot table and marked inactive in the login table. Tracking is powered by a newlastLoginAttimestamp.6. Automated Admin Seeding & Health Checks
CommandLineRunnerthat executes on first boot to seed a default, environment-configurable ADMIN account if the table is empty.spring-boot-starter-actuatorto expose/actuator/health(for AWS ALB Health Checks) and/actuator/prometheus(for performance metrics scraping).Environment Variables Introduced
Ensure the following variables are injected into your deployment environment:
APP_ADMIN_EMAIL/APP_ADMIN_PASSWORD(Initial admin seeding)APP_ENCRYPTION_KEY(MUST BE 32-byte base64 encoded for AES-256)UPLOAD_DIR/BACKUP_DIRBACKUP_RETENTION/ARCHIVAL_INACTIVITY_DAYSCORS_ALLOWED_ORIGINSVerification
mvn clean compile).PostgreSQL.TRACEtoINFO).