Questions tagged as 'sequelize-js'

0
answers

How to do a SELECT with CONVERT or CAST in the WHERE clause using sequelize

I need to make the select below using sequelize. SELECT COUNT(*) AS 'Count' FROM Table WHERE CAST(DatetimeField AS DATE) = CAST(GETDATE() AS DATE) So far I've been able to do this using between but this is not the best way to do this...
asked by 22.09.2017 / 21:08
0
answers

How to run script npm in heroku in production?

I need to use the Sequelize migrations in a NodeJS application that is already in production in Heroku, but I do not know how to add the scripts in the package.json so that Database migrations always run, via npm script, by Heroku....
asked by 07.07.2017 / 23:07
1
answer

Json return error {"isFulfilled": false, "isRejected": false} + Node

I have the following code on the node: var express = require('express'); var app = express(); app.get('/api/events', function(req, res, next) { var events = repositorio.ListAll(); res.json(events);...
asked by 29.04.2017 / 18:12
1
answer

beforeupdate sequelize does not work

I'm trying to make the data update encrypt the user's password, but it simply does not work and does not give an error. Have the following sequelize model. import bcrypt from 'bcrypt'; export default (sequelize, DataType) => { c...
asked by 28.11.2016 / 06:36
1
answer

Query changing join - SequelizeJS

How could I do this query using Sequelize? SELECT t1.* FROM Table1 t1 inner join Table2 t2 on t1.id != t2.t1_id     
asked by 02.08.2016 / 02:27
1
answer

Sequelize Migrate - Error: TypeError: defineCall is not a function

Hi, I'm doing a simple championship API, I used Sequelize as ORM for my database. I created the Arbitrator table that had only the NAME field and did not have the CPF field in the table. I had to include the CPF field in the Arbitra...
asked by 20.05.2017 / 18:24
0
answers

How to change the connection to the database using Sequelize + MySql + Express depending on the parameter sent in the request?

For example, when you receive a parameter in the request equal to db1, in the precise controller that uses the db1 connection string When you start the NodeJS server, the config.json configuration with the connection data is already loaded....
asked by 19.12.2018 / 18:17
0
answers

Relationships hasOne and belongsTo in the same model sequelize

I'm using sequelize along with nodejs and I'm having difficulty with a relationship. I have 3 tables where (local, equipment, shed, area) where in one place I have 1 equipment, it is in a shed and belongs to an area. The temp...
asked by 18.10.2018 / 15:15
0
answers

Can I create a function that inserts the routes registered in the APP for SEED [SEQUELIZE-CLI]?

I have a function that takes all the routes registered in the express and registers these routes in the bank using Sequelize. app._router.stack.forEach(function(r){ // console.log(r.route.path) if (r.route && r....
asked by 15.10.2018 / 22:46
0
answers

afterFind sequelize hook

Considering all the Sequelize information working correctly, I have a model called MyModel and that has its attributes, so far this is correct. However, when I get a data from this model I want to transform the id of my table into a hash to show...
asked by 17.08.2018 / 19:55