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

[Improvement]: Persistence Changes Experiment #129

Open
2 tasks
azooz2003-bit opened this issue Dec 15, 2024 · 0 comments
Open
2 tasks

[Improvement]: Persistence Changes Experiment #129

azooz2003-bit opened this issue Dec 15, 2024 · 0 comments
Labels
enhancement improving existing capabilities

Comments

@azooz2003-bit
Copy link
Contributor

Description

I realized from looking at the open-source Canvas iOS repo, that there's a simpler way of implementing decoding, saving, etc. into one function:

  1. For each model, we create a DTO struct. So for Quiz we have QuizDTO. This will be used to seamlessly decode from an API response. We'll also have a DTO associated type.
  2. We'll have a flush (or save) method in each model which takes in the corresponding DTO. It will find the associated @Model entry and return it. It effectively handles merging and inserting into a specific model context. The model context will probably be per user, flush shouldn't decide.
  3. Because of the above, I'll remove the Codable conformance from Cacheable. We'll also remove the merge functions since above handles it.
  4. We'll experiment with @Relationship types, but parentId approach still works really well. I'm unsure about making parentId an array, I'll think about use cases for that before deciding. Otherwise it's redundant.

Relevant Resources

(Feature Owner, Developer) Attach links to resources such as Figma files, technical documentation, etc.

Child Issues

(Developer) Add child issues (technical or high level) that will help you modularize your implementation this feature.

  • Task 1 ...
  • Task 2 ...

When beginning work on a task, click on the ... button to the right of the task and click on Convert to Issue to create a child issue linked to this parent issue.

Implementation Plan (optional)

(Developer) Write an implementation plan here, or attach a link to a document containing it.

@azooz2003-bit azooz2003-bit added the enhancement improving existing capabilities label Dec 15, 2024
@azooz2003-bit azooz2003-bit changed the title [Improvement]: Persistence Changes [Improvement]: Persistence Changes Experiment Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improving existing capabilities
Projects
None yet
Development

No branches or pull requests

1 participant