Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AuthenticatedUser to Bike association #4

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

aokj4ck
Copy link
Collaborator

@aokj4ck aokj4ck commented Oct 7, 2024

Description

  • Add Bike.owner: User? relationship
    • Add User.bikes: [Bike]
  • Add Bike.authenticatedOwner: AuthenticatedUser? relationship
    • Add AuthenticatedUser.bikes: [Bike]
  • Add AuthenticatedUser.bikes assignment for already-known bikes in ContentModel.fetchProfile

TODO:

  • Add AuthenticatedUser.bikes assignment in ContentModel.fetchBikes.

aokj4ck added 30 commits October 6, 2024 17:48
… appropriate relationships (1:many).

- Add bike_ids field to AuthenticatedUserResponse to aid in constructing an AuthenticatedUser SwiftData model with linked Bikes
- Add Bike -> owner: User? relationship
- Add AuthenticatedUser -> bikes: [Bike] relationship for owned-bikes
…s type

- 1. Fetch profiles on launch. Return early and display error if any occur.
- 2. Fetch profile's bikes on launch. Return early and display error if any occur.
…icatedUser before proceeding

- AuthenticatedUser contains a User
- Only one authenticated user can operate the app at a time.
- In the future multiple user records could be fetched for support in Organizations and app-originated (aka non-webview) Bike searches
    - These features do not exist yet but this seems the best architecture to build toward those: AuthUser and User separate, AuthUser singular, and keep that approach.
…etchBikes()

- Asserts and guards that only one AuthenticatedUser model is found
…r instead of a fixed init(bike: Bike) var
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant