Add models/users data proxies
mykeels opened this issue ยท 0 comments
Please Read ๐
Don't be afraid ... It's 9 issues in one, and you don't have to handle more than one, but it'd be cool if you did.
A data proxy is an object that contains functions for accessing a data record using the CRUD model.
It contains getAll
, getById
, insert
, update
, and destroy
functions.
Each data proxy is a wrapper around an already existing sequelize model.
Take a look at the action-proxy which is a data proxy for models/users/actions.model as a guide for implementing data proxies.
It exports a function which takes in a sequelize
model, and EventEmitter
instance, and returns an object which is a data proxy for the sequelize model.
Events
Every action that mutates the state of the DB must raise an Event.
Sample Events have been given in action-proxy which are:
{
INSERT_SUCCESSFUL: 'db:action:insert:success',
INSERT_ERROR: 'db:action:insert:error',
UPDATE_SUCCESSFUL: 'db:action:update:success',
UPDATE_ERROR: 'db:action:update:error',
DELETE_SUCCESSFUL: 'db:action:delete:success',
DELETE_ERROR: 'db:action:delete:error'
}
This is to enable other modules to listen to these events and perform some action
Data Proxies Needed
- Phone-Number proxy for its model
- Role proxy for its model
- User-Type proxy for its model
- User proxy for its model
- Image proxy for its model
- Image-Type proxy for its model
- User-Has-Role proxy for its model
- User-Has-Type proxy for its model
- Role-Performs-Action proxy for its model
How to proceed
- First, assign yourself to this task
- Next, write a comment stating which proxy you indicate to help with
- I hope you've forked the repo at this point, but if you haven't do so
- Start ...
- If you have any issues, you can open an issue, and tag it in the comment you made