parent
46001fc4e7
commit
09282698cf
@ -0,0 +1,21 @@ |
||||
### Synchronization quick ReadMe |
||||
|
||||
- Data class must extend BaseModel |
||||
- Admin classes must extend SyncedObjectAdmin to have updates saved in the BaseModel properties |
||||
- The SynchronizationApi defines a get and a post service to POST new data, and GET updates. When performing an operation on a data, a ModelLog instance is created with the related information. When performing a GET, we retrieve the list of ModelLogs to sent the new data to the user. |
||||
- routing.py defines the URL of the websocket where messages are sent when updates are made. URL is by user. |
||||
|
||||
|
||||
### Sharing |
||||
|
||||
- Data can be shared between users. To do that, a new DataAccess object can be created to define the owner, the authorized user, and the object id. |
||||
- By default, the whole hierarchy of objects are shared, from the data parents to all its children. |
||||
- Special data path can be specified for a class by defining a setting |
||||
|
||||
example: |
||||
SYNC_MODEL_CHILDREN_SHARING = { |
||||
'Match': ['team_scores', 'team_registration', 'player_registrations'] |
||||
} |
||||
Here when sharing a Match, we also share objects accessed through the names of the properties to get TeamScore, TeamRegistration and PlayerRegistration. |
||||
|
||||
- It's also possible to exclude a class from being sharable by setting sharable = False in its definition. In PadelClub, Club is the top entity that links all data together, so we don't want the automatic data scanning to share clubs. |
||||
Loading…
Reference in new issue