Skip to content

Instantly share code, notes, and snippets.

@hc3
Created November 20, 2016 07:03
Show Gist options
  • Save hc3/566138ea25fbb0902ccf01fdaae5de9f to your computer and use it in GitHub Desktop.
Save hc3/566138ea25fbb0902ccf01fdaae5de9f to your computer and use it in GitHub Desktop.
const Models = require('../../models/')
const MODEL_NAME = __dirname.split('modules')[1].slice(1)
const PREFIX = 'cal_'
const PRIMARY_KEY = PREFIX + 'cod'
const ACTIONS_PATH = '../../actions/'
let offset = 0
let limit = 10
let attributes = [
PRIMARY_KEY,
PREFIX + 'datacalibracao'
]
const options = { offset, limit, attributes }
const findAll = require(ACTIONS_PATH + 'findAll')(Models, MODEL_NAME,options)
const findById = require(ACTIONS_PATH + 'findById')(Models, MODEL_NAME, options)
const findAllByPage = require(ACTIONS_PATH + 'findAllByPage')(Models, MODEL_NAME, options)
const create = require(ACTIONS_PATH + 'create')(Models, MODEL_NAME)
const update = require(ACTIONS_PATH + 'update')(Models, MODEL_NAME, PRIMARY_KEY)
let include = [{model: Models['calibracao_item']}]
<<<<<<< HEAD
let includeInst = [{model: Models['instrumento']}]
//options.include = include
const findAllJoin = require(ACTIONS_PATH + 'findAllJoin')(Models, MODEL_NAME, options,include)
const findAllJoinInstrumentos = require(ACTIONS_PATH + 'findAllJoinInstrumentos')(Models, MODEL_NAME, options,includeInst)
=======
const findAllJoin = require(ACTIONS_PATH + 'findAllJoin')(Models, MODEL_NAME, options, include)
>>>>>>> 2936f247729636a926e85e675976a2b1aa9f086c
module.exports = {
findAll,
findAllJoin,
findAllJoinInstrumentos,
findById,
findAllByPage,
create,
update,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment