Skip to content

Commit

Permalink
fix: debug monitoring session dataTable
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamensuli committed Nov 3, 2023
1 parent 2d0085c commit 8f71504
Showing 1 changed file with 15 additions and 6 deletions.
@@ -1,3 +1,7 @@
const {

Op
} = nodefony.Sequelize;
module.exports = {
Query: {
// provides all functions for each API endpoint
Expand Down Expand Up @@ -29,10 +33,10 @@ module.exports = {
if (query && query.type && query.type === "dataTable") {
// console.log(query);
let index = query.startIndex || 1;
let page = query.page || 1;
index = parseInt(index, 10);
page = parseInt(page, 10);
options.offset = page ? page - 1 : index - 1;
let page = query.page || index;
page = parseInt(page, 10) - 1;
options.offset = page * query.itemsPerPage;
options.limit = parseInt(query.itemsPerPage, 10);
if (query.sortBy && query.sortBy.length) {
options.order = [];
Expand All @@ -52,12 +56,17 @@ module.exports = {
}
}
if (query.search) {
options.where = {
username: query.search
options.include[0].required = true;
options.include[0].where = {
// options.where = {
username: {
[Op.startsWith]: query.search
}
};
}
if (username) {
options.where = {
options.include[0].required = true;
options.include[0].where = {
username
};
}
Expand Down

0 comments on commit 8f71504

Please sign in to comment.