In this challenge we will be building basic ORM functionallity base on Sequelize using mysql2
Implementing the next functions:
-
Insert ()
-
BulkInsert ()
-
FindAll ()
-
FindOne ()
-
FindByPk ()
-
Update ()
-
soft/hard Destroy ()
-
Restore ()
-
Clone template repository
-
Run
$npm i
-
If you want to run the tests locally, connect to your MySql in the test connection statment, which is located in the
beforeAll()
in the main test. Enter you password and create empty DB called db_test in your machine.
Model.Insert({... the object containing the value you want to insert})
Model.BulkInsert([... array with the objects you want to insert])
Model.findAll({
... the object containing the select query condition you want to apply})
Model.FindOne({... the object containing the select query condition you want to apply})
Model.FindByPk(Priority Key)
Model.Update({... the object containing the where condition, that you want to update})
Model.Destroy ({... the object containing the conditions for the rows that you want to delete, to hard delete add force:true})
Model.Restore ({... the object containing the conditions for the rows that you want to restore}, without object restor all)
- main class MySequelize in index.js, which located in the main folder
- folder called 'Op'. inside the folder you must have the file 'OpSymbols.js' (rest of the files is for your decision)
- 'OpSymbols.js' should export the object 'Op', as in the picture
- so we can require it as follow in the test
- and use it this way (like in sequelize...)
- 'include' statment recieves the folowwing parameters:
-
'include' statment should return nested array inside the original object, with key equel to the table name
-
[TextRow]
is a playlist object
-
The repository must be public and the solution must be in master/main branch
-
Copy the relative url of the repository and paste in the submiting form.