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

Implement DataServer #93

Open
otomn opened this issue Feb 24, 2021 · 0 comments
Open

Implement DataServer #93

otomn opened this issue Feb 24, 2021 · 0 comments
Assignees
Labels
area/database Schema design, migrations, etc. group/backend

Comments

@otomn
Copy link
Collaborator

otomn commented Feb 24, 2021

Implement DataServer
(There already exists a file called DataLoader, rename it to DataServer)

Attribute

Cache: contains a map from UID to any domain object

Functions

genericRead(obj: any, objClass: Function): any
  • Check to see if the object is in the cache
  • If not, try fetch it from the DatabaseManager and add it to the cache
  • Check the class is correct
  • No validation is needed, we will assume everything from the DataServer must be valid
genericDelete(obj any, objClass: Function): bool
  • Try a read, return false if failed
  • Delete the object from the cache
  • Delete the object form the database using DatabaseManager
genericCreate(obj any, objClass: Function): Error | null
  • Run validator to validate the object
  • Return error if validation fails
  • Create the object in the database using DatabaseManager
  • Load the object into the cache

Hookup

Update all backend controllers to call DataServer if possible
Update will be done with delete then create

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/database Schema design, migrations, etc. group/backend
Projects
None yet
Development

No branches or pull requests

3 participants