Persist signup city on the customer record (v1 users/sign_up + migration) - #3
Open
aaronsmulktis wants to merge 2 commits into
Open
Persist signup city on the customer record (v1 users/sign_up + migration)#3aaronsmulktis wants to merge 2 commits into
aaronsmulktis wants to merge 2 commits into
Conversation
…min into @aaron.smulktis/develop
1. add city column to spree_users (migration) 1. permit city in v1 UsersController#user_params (real signup path: POST /api/v1/users/sign_up) 1. return city in sign_up, sign_in, and profile responses + swagger docs
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.
Persists the signup city on the customer record, wired through the backend's real registration path.
What this does
citystring column tospree_users.cityinSpree::Api::V1::UsersController#user_params— this is the endpoint the app actually serves for registration:POST /api/v1/users/sign_up→Spree::User.new(user_params). Without this, Rails strong-params silently dropsuser[city].cityonsign_up,sign_in, andprofileresponses so it round-trips, plus Swagger docs for the new field.Why v1
users, not v2accountThe Spree 4.2.5 fork (
1instinct/spree@instinct-4.2.5) makes the v2 storefrontaccountresource show-only — there is noPOST/PATCH /api/v2/storefront/account. This app's real user create/auth lives in the customSpree::Api::V1::UsersController(sign_up/sign_in/profile/follow), so that's wherecityhas to be permitted. (first_name/last_nameare derived frombill_addressin this model;cityis a plain user column, matching the free-text city the wizard collects.)The frontend (
Beeper-Frontend) registers via the@spree/storefront-api-v2-sdk—spreeClient.account.create→POST /api/v2/storefront/account(JSONAPI). This backend doesn't serve that route (404) and speaks a custom{response_code, response_message, response_data}envelope on v1, not JSONAPI. So the two repos don't line up on the auth path yet. This PR enablescityon the v1 path that exists today; the frontend↔backend dialect needs a decision before signup (and thereforecity) flows end-to-end. Options in the issue thread.Verification
ruby -cclean on both files.instinct-4.2.5fork gems aren't checked out yet locally (bundle installpending), so no migrate/request-spec run. Traced against the actual fork source (routes, controllers,PermittedAttributes) + this app'sUsersController.Base intentionally
@aaron.smulktis/develop(the active 4.2 branch). Migration is additive/reversible.