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

Make a generic record trait #7

Open
rien opened this issue Jul 27, 2020 · 0 comments
Open

Make a generic record trait #7

rien opened this issue Jul 27, 2020 · 0 comments
Labels
backend good final issue You'll probably stop contributing while solving this.

Comments

@rien
Copy link
Collaborator

rien commented Jul 27, 2020

So we can have an ActiveRecord-like interface for our model structs.

Basic methods:

  • An all, index method (with optional pagination parameters) to fetch all the records.
  • A create method which INSERTs a new record in the database..
  • An update method which UPDATEs an existing record.
  • An destroy method which DELETEs an existing record.

Some of these methods have already been implemented in the User model, so this is will come down to abstracting that functionality.

A more difficult extension to this trait is tracking which fields of the record have been changed so we can UPDATE only changed fields. This seems cleaner, but would require a lot of bookkeeping.

@rien rien added the backend label Jul 27, 2020
@rien rien mentioned this issue Aug 9, 2020
@ninewise ninewise added the good final issue You'll probably stop contributing while solving this. label Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend good final issue You'll probably stop contributing while solving this.
Projects
None yet
Development

No branches or pull requests

2 participants