Git Product home page Git Product logo

challenge-sequelize-template's Introduction

Challenge-Sequelize

Description

In this challenge we will be building basic ORM functionallity base on Sequelize using mysql2


Main Goal

Implementing the next functions:

  • Insert ()

  • BulkInsert ()

  • FindAll ()

  • FindOne ()

  • FindByPk ()

  • Update ()

  • soft/hard Destroy ()

  • Restore ()


First Steps

  1. Clone template repository

  2. Run $npm i

  3. 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.

sql connection


Starting The Challenge

If you are not famillier with Sequelize syntax:

Insert

Model.Insert({... the object containing the value you want to insert})

Bulk Insert

Model.BulkInsert([... array with the objects you want to insert])

FindAll

Model.findAll({ ... the object containing the select query condition you want to apply})

FindOne

Model.FindOne({... the object containing the select query condition you want to apply})

FindByPK

Model.FindByPk(Priority Key)

Update

Model.Update({... the object containing the where condition, that you want to update})

Soft/Hard Destroy

Model.Destroy ({... the object containing the conditions for the rows that you want to delete, to hard delete add force:true})

Restore

Model.Restore ({... the object containing the conditions for the rows that you want to restore}, without object restor all)


General

Files and Folders:

Use The Template!

  • main class MySequelize in index.js, which located in the main folder

Operations:

  • folder called 'Op'. inside the folder you must have the file 'OpSymbols.js' (rest of the files is for your decision)

Op folder

  • 'OpSymbols.js' should export the object 'Op', as in the picture

Op export

  • so we can require it as follow in the test

Op require

  • and use it this way (like in sequelize...)

Op use

Include:

  • 'include' statment recieves the folowwing parameters:

Include params

  • 'include' statment should return nested array inside the original object, with key equel to the table name

  • [TextRow] is a playlist object

Include params


Submiting The Challenge

  1. The repository must be public and the solution must be in master/main branch

  2. Copy the relative url of the repository and paste in the submiting form.


Usefull Links

challenge-sequelize-template's People

Contributors

gghajwuwu avatar ofirsimhi1612 avatar royshnitzel avatar mrmoshkovitz avatar

Watchers

James Cloos avatar  avatar

challenge-sequelize-template's Issues

Broken links

links 2 and 4 (SQL INSERT Query Reference) lead to 404 page

Typos in the require section

The first line requires mySequlize from "mySequlize", while the file name is "index".
The third line requires Op from "OpsSymbols", while the file name is "OpSymbols" (notice the missing s)
Nice chalenge though!

const { MySequelize } = require("./mySequelize");
const mysql = require("mysql2/promise");
const { Op } = require('./Op/OpsSymbols')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.