fix: add missing SetupSurveyResponse model#22
Conversation
…CE_URL config (#10) * feat: onboarding survey backend — token, endpoint, user associations - setup_bootstrap_service.rb: generate one-time survey_token (Redis, 10 min TTL) and return it in bootstrap response - setup_controller.rb: add POST /setup/survey endpoint authenticated via X-Survey-Token header; falls back to authenticated endpoint after login - user.rb: add user_tours and setup_survey_response associations + setup_survey_completed? helper - serializers: expose setup_survey_completed and avatar_url on user payload - profiles_controller.rb: invalidate token cache on avatar update - avatarable.rb: add expires_in: 1.week to blob.url for cloud storage - cors.rb: allow all origins on /rails/active_storage/* (public media blobs) - development.rb: add docker service hostnames (evo-auth, evo-crm, etc.) - routes.rb: add /setup/survey, user_tours and setup_survey resources Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(EVO-976): fix avatar_url returning relative path — add AUTH_SERVICE_URL config Problem: avatarable.rb used rails_service_blob_proxy_path (relative path). The browser resolved the path against the frontend origin (localhost:5173), not the auth service (localhost:3001), causing consistent 404 on avatar load. Changes: - avatarable.rb: build absolute URL by prepending app_url config to the proxy path - environment_config.rb: read AUTH_SERVICE_URL from env (default: http://localhost:3001) and configure Rails.application.routes.default_url_options accordingly, matching the same pattern already used by evo-ai-crm-community via BACKEND_URL - development.rb: fix action_mailer.default_url_options port 3000 → 3001 (was incorrectly pointing to the CRM service) Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(EVO-976): address round 2 code review (H3, H4, L1) - avatarable.rb: extract AVATAR_URL_TTL constant (1.hour, was 1.week) so signed URLs that leak via logs/CDN/cache age out fast (H3 — info disclosure window 7d → 1h) - avatarable.rb: rescue StandardError now returns nil instead of '' so the frontend doesn't render <img src=""> (which makes a request against the current page per HTML spec) when the URL helper raises (H4) - avatarable.rb: also return nil (instead of '') when avatar is not attached — keeps return type consistent so serializers can null-check safely - environment_config.rb: validate URI scheme is http(s) and host is present before configuring routes.default_url_options (URI.parse accepts schemeless strings like "auth.example.com" without raising InvalidURIError, which would otherwise leave default_url_options[:protocol] = nil) (L1) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]> Co-authored-by: Davidson Gomes <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
User model declares has_one :setup_survey_response but the model file was missing, causing NameError on login. Added the model class to unblock authentication flow.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds the missing SetupSurveyResponse ActiveRecord model to match the existing User.has_one association and wire it to users via belongs_to. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…tion failure users_controller#create now rescues ActiveRecord::RecordInvalid and returns a 422 with structured error messages (password complexity rules). Previously bubbled up as unhandled 500.
|
@ 🚧 Pedido de split antes da review — escopo divergenteOlá @pastoriniMatheus, este PR carrega três entregas não relacionadas que precisam ser separadas antes da review substantiva. O título do PR cita só o hotfix do Conteúdo atual do PR (195+/18- em 15 arquivos)
O Por que isso bloqueia review
PedidoSeparar em 3 branches/PRs:
Mais detalhes e raciocínio completo no card Linear EVO-1063. Voltando o card para Todo até a separação. |
PR #22 fechada — splitada em 3 PRs dedicadasEsta PR misturava 3 escopos não relacionados em uma única branch, conforme apontado pelo Daniel no code review. Foi dividida em:
Cada PR agora tem escopo limpo, 1 commit, título correto e base develop. |
Summary
User model declares
has_one :setup_survey_responsebut the model file was missing, causingNameErroron login after setup wizard completion.Changes
app/models/setup_survey_response.rbwithbelongs_to :userTest plan
Summary by Sourcery
Add the missing SetupSurveyResponse ActiveRecord model to align with the existing user association.
New Features:
Bug Fixes: