Skip to content

Commit

Permalink
style: apply prettier fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored and jlongster committed Aug 30, 2022
1 parent a5e1e38 commit 80a2b34
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
8 changes: 4 additions & 4 deletions app-plaid.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ app.post(
'Content-Type': 'application/json',
'User-Agent': 'Actual Budget'
}
}).then(res => res.json());
}).then((res) => res.json());

await req.runQuery(
'INSERT INTO access_tokens (item_id, user_id, access_token) VALUES ($1, $2, $3)',
Expand Down Expand Up @@ -233,7 +233,7 @@ app.post(
'Content-Type': 'application/json',
'User-Agent': 'Actual Budget'
}
}).then(res => res.json());
}).then((res) => res.json());

if (resData.removed !== true) {
console.log('[Error] Item not removed: ' + access_token.slice(0, 3));
Expand Down Expand Up @@ -286,7 +286,7 @@ app.post(
'Content-Type': 'application/json',
'User-Agent': 'Actual Budget'
}
}).then(res => res.json());
}).then((res) => res.json());

res.send(
JSON.stringify({
Expand Down Expand Up @@ -342,7 +342,7 @@ app.post(
'Content-Type': 'application/json',
'User-Agent': 'Actual Budget'
}
}).then(res => res.json());
}).then((res) => res.json());

res.send(
JSON.stringify({
Expand Down
4 changes: 2 additions & 2 deletions app-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ app.post('/sync', async (req, res) => {
let responsePb = new SyncPb.SyncResponse();
responsePb.setMerkle(JSON.stringify(trie));

newMessages.forEach(msg => responsePb.addMessages(msg));
newMessages.forEach((msg) => responsePb.addMessages(msg));

res.set('Content-Type', 'application/actual-sync');
res.send(Buffer.from(responsePb.serializeBinary()));
Expand Down Expand Up @@ -376,7 +376,7 @@ app.get('/list-user-files', (req, res) => {
res.send(
JSON.stringify({
status: 'ok',
data: rows.map(row => ({
data: rows.map((row) => ({
deleted: row.deleted,
fileId: row.id,
groupId: row.group_id,
Expand Down
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const syncApp = require('./app-sync');

const app = express();

process.on('unhandledRejection', reason => {
process.on('unhandledRejection', (reason) => {
console.log('Rejection:', reason);
});

Expand Down Expand Up @@ -59,7 +59,7 @@ async function run() {
app.listen(config.port, config.hostname);
}

run().catch(err => {
run().catch((err) => {
console.log('Error starting app:', err);
process.exit(1);
});
8 changes: 4 additions & 4 deletions migrations/1632571489012_remove_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
true
);
db.transaction(() => {
budget.map(monthBudget => {
budget.map((monthBudget) => {
let match = monthBudget.name.match(
/^(budget-report|budget)(\d+)!budget-(.+)$/
);
Expand Down Expand Up @@ -84,7 +84,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
true
);
db.transaction(() => {
buffers.map(buffer => {
buffers.map((buffer) => {
let match = buffer.name.match(/^budget(\d+)!buffered$/);
if (match) {
let month = match[1].slice(0, 4) + '-' + match[1].slice(4);
Expand All @@ -108,7 +108,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
true
);

let parseNote = str => {
let parseNote = (str) => {
try {
let value = JSON.parse(str);
return value && value !== '' ? value : null;
Expand All @@ -118,7 +118,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
};

db.transaction(() => {
notes.forEach(note => {
notes.forEach((note) => {
let parsed = parseNote(getValue(note));
if (parsed) {
let [, id] = note.name.split('!');
Expand Down
9 changes: 6 additions & 3 deletions sync-full.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const sync = sequential(async function syncAPI(messages, since, fileId) {
await actual.internal.send('load-budget', { id: fileId });
}

messages = messages.map(envPb => {
messages = messages.map((envPb) => {
let timestamp = envPb.getTimestamp();
let msg = SyncPb.Message.deserializeBinary(envPb.getContent());
return {
Expand All @@ -27,11 +27,14 @@ const sync = sequential(async function syncAPI(messages, since, fileId) {
};
});

const newMessages = await actual.internal.syncAndReceiveMessages(messages, since);
const newMessages = await actual.internal.syncAndReceiveMessages(
messages,
since
);

return {
trie: actual.internal.timestamp.getClock().merkle,
newMessages: newMessages.map(msg => {
newMessages: newMessages.map((msg) => {
const envelopePb = new SyncPb.MessageEnvelope();

const messagePb = new SyncPb.Message();
Expand Down
2 changes: 1 addition & 1 deletion sync-simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function sync(messages, since, fileId) {
`SELECT * FROM messages_binary
WHERE timestamp > ?
ORDER BY timestamp`,
[since],
[since]
);

let trie = addMessages(db, messages);
Expand Down
4 changes: 2 additions & 2 deletions util/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ function sequential(fn) {
sequenceState.running = fn(...args);

sequenceState.running.then(
val => {
(val) => {
pump();
resolve(val);
},
err => {
(err) => {
pump();
reject(err);
}
Expand Down
6 changes: 3 additions & 3 deletions util/handle-error.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
function handleError(func) {
return (req, res) => {
func(req, res).catch(err => {
console.log('Error', req.originalUrl, err);
func(req, res).catch((err) => {
console.log('Error', req.originalUrl, err);
res.status(500);
res.send({ status: 'error', reason: 'internal-error' });
});
};
}

module.exports = { handleError }
module.exports = { handleError };

0 comments on commit 80a2b34

Please sign in to comment.