Production Deploy#77
Conversation
Syncing main to development
Feat/infra housekeeping
Feat/middleware-wiring-webhook-setup
* added user calibration endpoints and schema"
- Added user_calibration migration
- Added sqlc queries for calibration CRUD operations
- added /api/users/me/calibration endpoints: GET, POST, DELETE
- me endpoint now fetches user from clerk id using middleware, enhancing security
- removed GET methods for user (GET /{id}, GET /)
* Fixed line endings
* Fixed time formatting in handler
* Added NOT NULL constrain to updated_at, created_at in db table
switch go dev container port to correct mapping (8080)
fixed variable typo in middleware_auth.go
---------
Co-authored-by: NicolaSavino <nick.savino@arcurve.com>
Co-authored-by: NicolaSavino <nick.savino@arcurve.com>
* Implemented workout and calibration schema with included sqlc queries. Updated makefile and seeding files * Regenerated SQLC to match new queries and models (workout type + workout session) * Added workout session service * Added Workout Handler Endpoint * Addressed PR comments - fixed syntax error in makefile - Fixed migration schema - fixed seeding script - added /service/helps/helpers.util file - renamed Dtos to match go standards, (Id -> ID) * Updated API endpoints * updated dtos to match casing convention. updated workout_session logic * Added functionality for workout sets and reps. (services, handlers, migrations, queries) * Addressed PR comments * Addressed PR comments --------- Co-authored-by: NicolaSavino <nick.savino@arcurve.com>
* fix: added clerk webhook secret * updated CRLF line endings to LF
* fix: added clerk webhook secret * updated CRLF line endings to LF * fix
…pment # Conflicts: # scripts/ci/deploy_via_ssm.sh
* Prod fix (#67) * Small changes to dev tooling (docker/make/compose * Server: minor variable rename * Auth middleware + clerk webhook handler * Added WithTransaction to store * Removed debug logging message exposing userid * Removed docker-compose changes not relevant to PR * Renamed users.go to users.handler.go in handlers * Added documentation explaining dev bypass * Feat/calibration-endpoints (#57) * added user calibration endpoints and schema" - Added user_calibration migration - Added sqlc queries for calibration CRUD operations - added /api/users/me/calibration endpoints: GET, POST, DELETE - me endpoint now fetches user from clerk id using middleware, enhancing security - removed GET methods for user (GET /{id}, GET /) * Fixed line endings * Fixed time formatting in handler * Added NOT NULL constrain to updated_at, created_at in db table switch go dev container port to correct mapping (8080) fixed variable typo in middleware_auth.go --------- Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * Fixed syntax error on migration (#58) Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * Feat/workouts api (#59) * Implemented workout and calibration schema with included sqlc queries. Updated makefile and seeding files * Regenerated SQLC to match new queries and models (workout type + workout session) * Added workout session service * Added Workout Handler Endpoint * Addressed PR comments - fixed syntax error in makefile - Fixed migration schema - fixed seeding script - added /service/helps/helpers.util file - renamed Dtos to match go standards, (Id -> ID) * Updated API endpoints * updated dtos to match casing convention. updated workout_session logic * Added functionality for workout sets and reps. (services, handlers, migrations, queries) * Addressed PR comments * Addressed PR comments --------- Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * fix: added clerk webhook secret (#62) * Fix/add clerkwebhook secret (#64) * fix: added clerk webhook secret * updated CRLF line endings to LF * Fix/add clerkwebhook secret (#66) * fix: added clerk webhook secret * updated CRLF line endings to LF * fix --------- Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * fix: wipe data on seed --------- Co-authored-by: Nicola Savino <77707655+NickSavino@users.noreply.github.com> Co-authored-by: NicolaSavino <nick.savino@arcurve.com>
* feat: setup AWS Cloudwatch resource and updated deploy script to attach to logging
* Increaed EC2 Tier and added elastic ip * added newline to EOF
* Added Logging Middleware to increase observability * small rename * Refactored user handler logic to be executed in service * Updated logging.go to adress bot comments * Updated logging middleware to forward optional http.ResponseWriter interfaces
ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan Review Summary by QodoRefactor user service, add logging middleware, and enhance infrastructure
WalkthroughsDescription• Refactored user service with DTOs and calibration endpoints • Added user deletion webhook handler for Clerk integration • Enhanced workout session history with aggregated sets/reps counts • Implemented HTTP request logging middleware for observability • Added CloudWatch logging infrastructure and database reset workflow • Fixed line endings and formatting across infrastructure files Diagramflowchart LR
A["User Service"] -->|DTOs| B["Handler Layer"]
C["Clerk Webhook"] -->|user.deleted| D["Delete User Handler"]
E["Workout Session"] -->|Aggregation| F["History with Stats"]
G["HTTP Requests"] -->|LoggingMiddleware| H["CloudWatch Logs"]
I["Infrastructure"] -->|Logs Module| J["CloudWatch Log Group"]
File Changes1. internal/core/service/user.service.go
|
Code Review by Qodo
1. Wrong created_at mapping
|
| func dtoFromUserRow(row sqlc.User) UserProfileDTO { | ||
| created := "" | ||
| if row.UpdatedAt.Valid { | ||
| created = row.UpdatedAt.Time.Format(time.RFC3339) | ||
| } | ||
|
|
||
| updated := "" | ||
| if row.UpdatedAt.Valid { | ||
| updated = row.UpdatedAt.Time.Format(time.RFC3339) | ||
| } |
There was a problem hiding this comment.
1. Wrong created_at mapping 🐞 Bug ✓ Correctness
dtoFromUserRow sets UserProfileDTO.CreatedAt from row.UpdatedAt and only when UpdatedAt.Valid, so the /me response can return an empty or incorrect created_at (often mirroring updated_at).
Agent Prompt
### Issue description
`dtoFromUserRow` populates the `created_at` DTO field from `UpdatedAt`, which returns incorrect timestamps to clients and may produce an empty `created_at` value.
### Issue Context
The sqlc-generated `User` model includes both `CreatedAt` and `UpdatedAt`.
### Fix Focus Areas
- internal/core/service/user.service.go[59-78]
- internal/db/models.go[11-20]
### Suggested fix
- Change the `created` calculation to use `row.CreatedAt` (and `row.CreatedAt.Valid`) instead of `row.UpdatedAt`.
- Keep `updated` derived from `row.UpdatedAt`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
No description provided.