Skip to content

BACKEND: User shipping address - API support for saving and retrieving #10

@CherryCIC

Description

@CherryCIC

THIS IS THE BACKEND ISSUE FOR ISSUE 313:
Cherry-CIC/MVP#313

Why
As a buyer
I want my shipping address to be saved and automatically retrieved
So that I don’t have to enter it again each time I check out

Acceptance Criteria
• Given a logged-in user with a saved address
When the app requests the user profile
Then the response should include their saved shipping address
• Given a user submits an updated shipping address during checkout
When the API receives the data
Then the address should be validated and stored for future use
• Given a user submits an incomplete or invalid address
When the API processes it
Then a 400-level error should be returned with relevant error messages
• Given a user has no saved address
When the app requests the user profile
Then the response should omit or return an empty address object

Proposed Implementation
• Extend the User model with a shippingAddress field (or create a separate Address model with a foreign key to User)
• Implement API endpoints:
• GET /user/profile (or similar) to return user details including address
• PUT /user/address or POST /user/address to save/update address
• Enforce server-side validation rules:
• Required fields: name, line1, city, postcode, country
• Length and format constraints (e.g., UK postcode regex)
• Consider storing structured data for addresses to support future features (e.g., delivery regions, autofill)
• Ensure data is encrypted at rest if needed (based on privacy decisions)
• Support soft data retention (e.g., allow only the latest saved address for MVP)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions