Image entity with polymorphic association (food / exercise / workout plan), AWS S3 integration.SessionDetailScreen (past workout recap) and SessionCalendarScreen (monthly calendar view), plus the mediaService with image caching.| Day | Task | Start Date | Completion Date | Reference Material |
|---|---|---|---|---|
| 2 | - Build Image entity (module/media) + Fields: url (≤500), isThumbnail, food (@ManyToOne nullable), workoutPlan (@ManyToOne nullable), exercise (@ManyToOne nullable) + DB check constraint chk_image_exclusive: exactly ONE of food_id, workout_plan_id, exercise_id is non-null (exclusive polymorphic FK) + Write Flyway V3 migration: image table with exclusive FK constraint |
02/24/2026 | 02/24/2026 | |
| 3 | - Build ImageController (/api/images) + POST / — register image record (URL stored; file lives in S3) + GET /{id}, GET /food/{foodId}, GET /workout-plan/{workoutPlanId}, GET /exercise/{exerciseId} + PUT /{id}, DELETE /{id} |
02/25/2026 | 02/25/2026 | |
| 3 | - Configure AWS S3 integration (config/AwsS3Config.java) + AWS SDK v1: AmazonS3 bean configured with region ap-southeast-1 + Bucket name from env S3_BUCKET_NAME (default crawl.fitness) + Upload utility method for media files |
02/25/2026 | 02/25/2026 | https://docs.aws.amazon.com/sdk-for-java/ |
| 4 | - Build mediaService (Frontend) + getImageUrl(owner, id) — fetch image URL from GET /api/images/{owner}/{id} + In-memory URL cache + in-flight deduplication (prevents duplicate API calls for the same image) + Bulk helpers: getFoodImageUrlMap(ids[]), getWorkoutPlanImageUrlMap(ids[]), getExerciseImageUrlMap(ids[]) |
02/26/2026 | 02/26/2026 | |
| 5 | - Build SessionDetailScreen (Frontend) + Past workout recap: exercises grouped by exerciseId + Shows sets × reps × weight per exercise + Formatted date/time display with utils/date.ts |
02/27/2026 | 02/27/2026 | |
| 6 | - Build SessionCalendarScreen (Frontend) + Monthly calendar view with dot indicators on days that have sessions + Month navigation (prev/next chevrons) + Click a date to show session logs below the calendar + Vietnamese day/month labels (Thứ 2–CN, Tháng 1–12) |
02/28/2026 | 02/28/2026 |
image table — DB-level data integrity for polymorphic images.POST /api/images registers image URL records linked to food/exercise/plan.GET /api/images/exercise/{id} and similar endpoints return all images for a given entity.AmazonS3 bean configured locally (uses environment variables; real uploads tested with generate_s3_json.py tooling).SessionDetailScreen correctly groups workout logs by exercise and renders sets/reps/weight clearly.SessionCalendarScreen marks training days with dots; tap to reveal session details inline.mediaService caches fetched image URLs in memory — no duplicate API calls for images already loaded.Lab 22 — EC2 Cost Optimization with Lambda + EventBridge
ec2.stop_instances(InstanceIds=[...]) and ec2.start_instances(...). IAM role attached to Lambda must include ec2:StopInstances and ec2:StartInstances permissions on the target instance ARN.rate(1 hour) starts counting from the moment you create the rule, NOT from the top of the clock. If created at 2:37 PM it fires at 3:37 PM, 4:37 PM, etc.cron(0 * * * ? *) fires at exactly minute 0 of every hour regardless of when the rule was created — use this for predictable scheduling.rate(...) rule: approximately 1 rule-interval after creation.Lab 27 — Tags and Resource Groups
Environment: Production, Project: myFit). Each resource supports up to 50 tags.Self-study — ECS Core Concepts
minimumHealthyPercent / maximumPercent.ecs-agent) on each EC2 node.awsvpc mode: Each Task gets its own Elastic Network Interface (ENI) with a private IP. Security Groups are attached at the task level, not the EC2 instance level. This enables fine-grained traffic control per task in the same cluster.ip target type (not instance) for Fargate, because each task has its own IP via awsvpc. Health check path and thresholds must match the application’s actual health endpoint.cron versus rate timing semantics.awsvpc networking and ALB ip target-type requirements for reliable task-level routing.Food, Meal, MealFood, DailyNutrition entities with full CRUD and nutrition calculation.DietScreen with meal management, food search, and add-food-to-meal flow.