Skip to content
Snippets Groups Projects
Commit c996d16c authored by ems19's avatar ems19
Browse files

[ADD] ALL ROUTE

parent fe245294
No related branches found
No related tags found
4 merge requests!377prd_version of simcaq,!373merge dev -> homologa,!370Dev migration,!369Postgres migration
......@@ -16,7 +16,6 @@ const origin_to_secret = {
'LDE': 'LDE'
};
// create OAuth 2.0 server
let aserver = oauth2orize.createServer()
......
......@@ -62,9 +62,7 @@ var Publication = db.define("Publication",{
allowNull: false,
defaultValue: false
}
},
{timestamps: false});
});
Publication.generateObjectId = function(){
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
......
......@@ -31,17 +31,12 @@ activityApp.get('/', async (req, res, next) => {
const page = parseInt(req.query.page) || 1;
const pageSize = parseInt(req.query.pageSize) || 5;
try {
const totalCount = await Activity.count({where: {
is_draft: false
}});
const totalCount = await Activity.count();
const offset = (page - 1) * pageSize;
const acts = await Activity.findAll({
offset,
limit: pageSize,
where: {
is_draft: false
},
order:[
['date', 'DESC']]
});
......
......@@ -33,17 +33,12 @@ pubApp.get('/', async (req, res, next) => {
const page = parseInt(req.query.page) || 1; // Current page number
const pageSize = parseInt(req.query.pageSize) || 5; // Number of items per page
try {
const totalCount = await Publication.count({ where: {
is_draft: false
}});
const totalCount = await Publication.count();
const offset = (page - 1) * pageSize;
const publis = await Publication.findAll({
offset,
limit: pageSize,
where: {
is_draft: false
}
});
res.json({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment