Skip to content

Commit

Permalink
Merge pull request #1063 from filipedeschamps/app-size
Browse files Browse the repository at this point in the history
Diminuir tamanho do JavaScript inicial da página
  • Loading branch information
aprendendofelipe authored Dec 9, 2022
2 parents ec96bd2 + cbc53d3 commit 0800a64
Show file tree
Hide file tree
Showing 2 changed files with 389 additions and 16 deletions.
9 changes: 5 additions & 4 deletions models/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function findAll(values = {}, options = {}) {

const selectClause = buildSelectClause(values);
const whereClause = buildWhereClause(values?.where);
const orderByClause = buildOrderByClause(values?.order);
const orderByClause = buildOrderByClause(values);

query.text = `
WITH content_window AS (
Expand All @@ -47,6 +47,7 @@ async function findAll(values = {}, options = {}) {
${values.count ? 'LIMIT 1' : 'LIMIT $1 OFFSET $2'}
)
${selectClause}
${orderByClause}
;`;

if (values.where) {
Expand Down Expand Up @@ -197,12 +198,12 @@ async function findAll(values = {}, options = {}) {
}, '');
}

function buildOrderByClause(orderBy) {
if (!orderBy) {
function buildOrderByClause({ order, count }) {
if (!order || count) {
return '';
}

return `ORDER BY contents.${orderBy}`;
return `ORDER BY contents.${order}`;
}
}

Expand Down
Loading

1 comment on commit 0800a64

@vercel
Copy link

@vercel vercel bot commented on 0800a64 Dec 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

tabnews – ./

tabnews-tabnews.vercel.app
www.tabnews.com.br
tabnews-git-main-tabnews.vercel.app
tabnews.com.br

Please sign in to comment.