Data comes in 2 forms a DTO and a model type
A DTO is a data structure required to hydrate a model. So a UserDTO is data required to create a User. The User is the model type.
DTO’s are shared between frontend and backend models, while the model type is not shared. The frontend & backend model type contains additional methods that are different.
The frontend layer uses mobx keystone, and we use a optimistic cache first approach. We update the cache, then we call a GraphQL endpoint. The UI is synced to the cache only, the GraphQL results don’t affect our UI.
Takes external GraphQL data and hydrate the models. Usually put on an aggregate root.
This takes form data, does some mapping, then call Create and Save
Exists on each model to update existing cache
This takes in DTO data and create a model
This does an upsert, update if exists or add if not exists.