This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const models = require('./models'); | |
| const User = models.User; | |
| const Company = models.Company; | |
| const WorkingDay = models.WorkingDay; | |
| // 1:1 | |
| // Get the company linked to a given User | |
| User.findOne({ | |
| where: {email: 'john-connor@domain.com'}, include: 'company' | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const models = require('./models'); | |
| const User = models.User; | |
| const Company = models.Company; | |
| const WorkingDay = models.WorkingDay; | |
| let currentDate = new Date(); | |
| WorkingDay.bulkCreate([ | |
| { | |
| weekDay: 'Monday', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const models = require('./models'); | |
| const User = models.User; | |
| const Company = models.Company; | |
| const WorkingDay = models.WorkingDay; | |
| let currentDate = new Date(); | |
| WorkingDay.bulkCreate([ | |
| { | |
| weekDay: 'Monday', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const models = require('./models'); | |
| const User = models.User; | |
| const Company = models.Company; | |
| const WorkingDay = models.WorkingDay; | |
| // // Get workingDays for a given User | |
| User.findByPk(1, {include: ['days']}) | |
| .then((user) => { | |
| console.log(user.get()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import axios from 'axios' | |
| export function fetchCategories(){ | |
| return async dispatch => { | |
| function onSuccess(response){ | |
| dispatch({type: 'FETCH_CATEGORIES', payload: response }) | |
| return response | |
| } | |
| function onError(error){ | |
| dispatch({type: 'ERROR_GENERATED', error }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs'); | |
| module.exports = { | |
| getFilesNames: (path='./uploads') => { | |
| let files = fs.readdirSync(path) | |
| return files | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Category.findByPk(req.params.id, { | |
| include: [ | |
| { | |
| model: Product, as: 'products', include: | |
| [ | |
| {model: Media, as: 'image'} | |
| ] | |
| } | |
| ] | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(process.env.NODE_ENV == 'production'){ | |
| app.use(express.static(path.join(__dirname, 'client'))); | |
| app.get('*', function(req, res) { | |
| res.sendFile(path.join(__dirname, 'client', 'index.html')); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ///////////////////// Exercice 1 /////////////////////// | |
| let num1 = 5; | |
| let num2 = 4; | |
| let i = 0; | |
| let result = 0; | |
| while(i < num1){ | |
| result = result + num2 | |
| i++; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "current": "0.1.6" | |
| } |