Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atualiza todas as dependências possíveis #1622

Merged
merged 7 commits into from
Feb 10, 2024
2 changes: 1 addition & 1 deletion infra/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async function checkForTooManyConnections(client) {

async function getConnectionLimits() {
const [maxConnectionsResult, reservedConnectionResult] = await client.query(
'SHOW max_connections; SHOW superuser_reserved_connections;'
'SHOW max_connections; SHOW superuser_reserved_connections;',
);
return [
maxConnectionsResult.rows[0].max_connections,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ exports.up = async (pgm) => {

RETURN total_balance;
END;
`
`,
);
};

Expand Down
4 changes: 2 additions & 2 deletions infra/scripts/wait-for-db-connection-ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const healthCheckDB = async () => {
async (bail, tries) => {
if (tries > 25) {
console.log(
`> Trying to connect to Database #${tries}. Are you running the postgres container? Run npm run services:up to start database service`
`> Trying to connect to Database #${tries}. Are you running the postgres container? Run npm run services:up to start database service`,
);
}

Expand All @@ -38,7 +38,7 @@ const healthCheckDB = async () => {
minTimeout: 3000,
maxTimeout: 3000,
factor: 1.1,
}
},
);
};

Expand Down
4 changes: 2 additions & 2 deletions infra/webserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const isProduction = process.env.NEXT_PUBLIC_VERCEL_ENV === 'production';
const host = isProduction
? `https://${process.env.NEXT_PUBLIC_WEBSERVER_HOST}`
: isServerlessRuntime
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
: `http://${process.env.NEXT_PUBLIC_WEBSERVER_HOST}:${process.env.NEXT_PUBLIC_WEBSERVER_PORT}`;
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
: `http://${process.env.NEXT_PUBLIC_WEBSERVER_HOST}:${process.env.NEXT_PUBLIC_WEBSERVER_PORT}`;

export default Object.freeze({
host,
Expand Down
2 changes: 1 addition & 1 deletion models/activation.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ async function activateUserByUserId(userId, options = {}) {
'update:content',
'update:user',
],
options
options,
);
}

Expand Down
16 changes: 8 additions & 8 deletions models/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ async function create(postedContent, options = {}) {
},
{
transaction: options.transaction,
}
},
);

return newContent;
Expand Down Expand Up @@ -423,7 +423,7 @@ async function checkIfParentIdExists(content, options) {
id: content.parent_id,
},
},
options
options,
);

if (!existingContent) {
Expand Down Expand Up @@ -544,7 +544,7 @@ async function creditOrDebitTabCoins(oldContent, newContent, options = {}) {
},
{
transaction: options.transaction,
}
},
);
return;
}
Expand Down Expand Up @@ -576,7 +576,7 @@ async function creditOrDebitTabCoins(oldContent, newContent, options = {}) {
id: newContent.parent_id,
},
},
options
options,
);

// We should not credit if the parent content is from the same user.
Expand All @@ -599,7 +599,7 @@ async function creditOrDebitTabCoins(oldContent, newContent, options = {}) {
},
{
transaction: options.transaction,
}
},
);
}

Expand All @@ -614,7 +614,7 @@ async function creditOrDebitTabCoins(oldContent, newContent, options = {}) {
},
{
transaction: options.transaction,
}
},
);
}
}
Expand All @@ -628,7 +628,7 @@ async function update(contentId, postedContent, options = {}) {
id: contentId,
},
},
options
options,
);

const newContent = { ...oldContent, ...validPostedContent };
Expand Down Expand Up @@ -663,7 +663,7 @@ async function update(contentId, postedContent, options = {}) {
},
{
transaction: options.transaction,
}
},
);

return updatedContent;
Expand Down
2 changes: 1 addition & 1 deletion models/email-confirmation.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async function updateUserEmail(userId, newEmail) {
},
{
skipEmailConfirmation: true,
}
},
);
}

Expand Down
2 changes: 1 addition & 1 deletion models/health.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function checkDatabaseDependency() {
try {
const firstQueryTimer = performance.now();
const [maxConnectionsResult, superuserReservedConnectionsResult] = await database.query(
'SHOW max_connections; SHOW superuser_reserved_connections;'
'SHOW max_connections; SHOW superuser_reserved_connections;',
);
const maxConnectionsValue = maxConnectionsResult.rows[0].max_connections;
const superuserReservedConnectionsValue = superuserReservedConnectionsResult.rows[0].superuser_reserved_connections;
Expand Down
2 changes: 2 additions & 0 deletions models/ip.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ function extractFromRequest(request) {
if (!realIp) {
// local development
realIp = request.socket?.remoteAddress || '127.0.0.1';
}

if (!webserver.isServerlessRuntime) {
// Localhost loopback in IPv6
if (realIp === '::1') {
realIp = '127.0.0.1';
Expand Down
6 changes: 3 additions & 3 deletions models/prestige.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ async function getByContentId(contentId, { transaction, database = db } = {}) {
text: query.byContentId,
values: [contentId],
},
{ transaction }
{ transaction },
);

let initialTabcoins = 0;
Expand All @@ -34,14 +34,14 @@ async function getByUserId(
limit = 20,
transaction,
database = db,
} = {}
} = {},
) {
const result = await database.query(
{
text: query.byUserId,
values: [userId, timeOffset, isRoot, limit, offset],
},
{ transaction }
{ transaction },
);

const mean = calcTabcoinsAverage(result.rows);
Expand Down
2 changes: 1 addition & 1 deletion models/remove-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default function removeMarkdown(md, options) {
if (options.trim) {
output = output.replace(
/^(\s|\p{C}|\u2800|\u034f|\u115f|\u1160|\u17b4|\u17b5|\u3164|\uffa0)+|(\s|\p{C}|\u2800|\u034f|\u115f|\u1160|\u17b4|\u17b5|\u3164|\uffa0)+$|\u0000/gsu,
''
'',
);
}
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions models/reward.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async function saveReward(request, reward, { transaction }) {
amount: reward,
},
},
{ transaction }
{ transaction },
);

await balance.create(
Expand All @@ -106,7 +106,7 @@ async function saveReward(request, reward, { transaction }) {
originatorType: 'event',
originatorId: currentEvent.id,
},
{ transaction }
{ transaction },
);
}

Expand Down
2 changes: 1 addition & 1 deletion models/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async function findOneValidByToken(sessionToken) {
},
{
session_id: 'required',
}
},
);

const query = {
Expand Down
4 changes: 2 additions & 2 deletions models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,14 @@ async function update(username, postedUserData, options = {}) {
balanceType: 'user:tabcoin',
recipientId: updatedUser.id,
},
options
options,
);
updatedUser.tabcash = await balance.getTotal(
{
balanceType: 'user:tabcash',
recipientId: updatedUser.id,
},
options
options,
);

return updatedUser;
Expand Down
4 changes: 2 additions & 2 deletions models/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ const schemas = {
title: Joi.string()
.replace(
/^(\s|\p{C}|\u2800|\u034f|\u115f|\u1160|\u17b4|\u17b5|\u3164|\uffa0)+|(\s|\p{C}|\u2800|\u034f|\u115f|\u1160|\u17b4|\u17b5|\u3164|\uffa0)+$|\u0000/gu,
''
'',
)
.allow(null)
.min(1)
Expand Down Expand Up @@ -687,7 +687,7 @@ const schemas = {
'firewall:block_contents:text_root',
'firewall:block_contents:text_child',
'reward:user:tabcoins',
'system:update:tabcoins'
'system:update:tabcoins',
)
.messages({
'any.required': `"type" é um campo obrigatório.`,
Expand Down
Loading
Loading