newmax-utils
Version:
Utils & Libs for Newmax Tech
13 lines (12 loc) • 494 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLastDataTimestamp = void 0;
const sequelize_1 = require("sequelize");
async function getLastDataTimestamp(Model, // i can try
condition = {}) {
return await Model.findOne({
attributes: [[sequelize_1.Sequelize.fn('max', sequelize_1.Sequelize.col('fk_date_id')), 'max']],
where: condition,
}).then((res) => +res.dataValues.max);
}
exports.getLastDataTimestamp = getLastDataTimestamp;