This issue is aimed to create accurate models for User and Post according to what we want in the OpenApi and make sure that the connection with the db is setup correctly in "domain".
The models will look as following.
User
This one does not have any need to be altered. It accurately represents the data we want in OpenApi and has a domain to perform actions.
Post
The current model of posts does not need to be altered but is missing in "domain". Changes here will be to add the following to domain -- post.js:
fromDB(post)
This will be added to make up the class that we get from the database.
fromJSON(json)
This should be used when we get JSON from the client, it should create a post object from JSON parameter.
toJSON()
This will return the object in JSON format.
This issue is aimed to create accurate models for User and Post according to what we want in the OpenApi and make sure that the connection with the db is setup correctly in "domain".
The models will look as following.
User This one does not have any need to be altered. It accurately represents the data we want in OpenApi and has a domain to perform actions.
Post The current model of posts does not need to be altered but is missing in "domain". Changes here will be to add the following to domain -- post.js:
fromDB(post)
This will be added to make up the class that we get from the database.fromJSON(json)
This should be used when we get JSON from the client, it should create a post object from JSON parameter.toJSON()
This will return the object in JSON format.