You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(database): replace UserPasswordRepository Create with Set upsert (#292)
## Summary
Replaces `UserPasswordRepository.Create` with a `Set` upsert method so
password writes (initial set and change) are a single repository call
instead of delete-then-create.
- Renames `CreateUserPassword` → `SetUserPassword` and `Create` → `Set`
on the domain interface
- Implements PostgreSQL `INSERT ... ON CONFLICT (project_id, user_id) DO
UPDATE` in the repository, resetting `failed_attempts` and
`last_successful_check` on update
- Simplifies `SetPasswordUserAction` to one `Set` call (no
`DeleteByUserID` first)
- Updates flow `create_user` handler, bootstrap import, fakes,
repository tests, and password flow integration test
- All `Create` / `CreateUserPassword` references are now removed from
the codebase
## Validation
- `go build ./...` — passed
- `go test ./internal/domain/... ./internal/service/...
./internal/bootstrap/users/...` — passed
- `go test -tags postgres_integration
./internal/storage/database/repository/ -run TestUserPasswordRepository`
— not run (Docker unavailable in cloud agent VM)
## Release notes / changeset
No changeset — server-only Go change, no public npm package impact.
## Notes
`Delete` / `DeleteByUserID` remain on the interface for explicit removal
and CRUD tests. On upsert update the row `id` is preserved (unlike the
previous delete+insert pattern).
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Silvan <adlerhurst@users.noreply.github.com>
0 commit comments