Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

style(mail-ingest): wrap the repository lines the way prettier does

Maurice5f600cf263e5
diff --git a/server/src/db/repositories/MailIngestCandidates.repository.ts b/server/src/db/repositories/MailIngestCandidates.repository.ts
index d9373197c..74f392f4b 100644
--- a/server/src/db/repositories/MailIngestCandidates.repository.ts
+++ b/server/src/db/repositories/MailIngestCandidates.repository.ts
@@ -151,7 +151,11 @@ export class MailIngestCandidatesRepository extends TrekRepository<MailIngestCan
}
async findById(id: number): Promise<MailIngestCandidateRow | null> {
- const row = await this.db().selectFrom('mail_ingest_candidates').selectAll().where('id', '=', id).executeTakeFirst();
+ const row = await this.db()
+ .selectFrom('mail_ingest_candidates')
+ .selectAll()
+ .where('id', '=', id)
+ .executeTakeFirst();
return row ?? null;
}
@@ -208,7 +212,7 @@ export class MailIngestCandidatesRepository extends TrekRepository<MailIngestCan
return Number(row.n);
}
- /** Whether a booking of this content was added to the trip from a mail and undone: it is not added on its own again. */
+ /** Whether a booking of this content went into the trip from a mail and was undone: never added again on its own. */
async wasUndoneInTrip(tripId: number, contentHash: string): Promise<boolean> {
const row = await this.db()
.selectFrom('mail_ingest_candidates')
@@ -328,7 +332,11 @@ export class MailIngestCandidatesRepository extends TrekRepository<MailIngestCan
if (confirmation) either.push(eb('confirmation_number', '=', confirmation));
if (startFrom && startTo) {
either.push(
- eb.and([eb('type', '=', type), eb('reservation_time', '>=', startFrom), eb('reservation_time', '<=', startTo)]),
+ eb.and([
+ eb('type', '=', type),
+ eb('reservation_time', '>=', startFrom),
+ eb('reservation_time', '<=', startTo),
+ ]),
);
}
// An empty list reads as false: a probe with neither names nothing.
diff --git a/server/src/db/repositories/MailIngestPrefs.repository.ts b/server/src/db/repositories/MailIngestPrefs.repository.ts
index aafd86c93..f942a2a64 100644
--- a/server/src/db/repositories/MailIngestPrefs.repository.ts
+++ b/server/src/db/repositories/MailIngestPrefs.repository.ts
@@ -30,7 +30,11 @@ export class MailIngestPrefsRepository extends TrekRepository<MailIngestPrefs> {
}
async findForUser(userId: number): Promise<MailIngestPrefsRow | null> {
- const row = await this.db().selectFrom('mail_ingest_prefs').selectAll().where('user_id', '=', userId).executeTakeFirst();
+ const row = await this.db()
+ .selectFrom('mail_ingest_prefs')
+ .selectAll()
+ .where('user_id', '=', userId)
+ .executeTakeFirst();
return row ?? null;
}
diff --git a/server/tests/unit/db/repositories/MailIngestAddresses.repository.test.ts b/server/tests/unit/db/repositories/MailIngestAddresses.repository.test.ts
index 85d4f4b71..d8e8ab550 100644
--- a/server/tests/unit/db/repositories/MailIngestAddresses.repository.test.ts
+++ b/server/tests/unit/db/repositories/MailIngestAddresses.repository.test.ts
@@ -62,7 +62,13 @@ describe('MailIngestAddressesRepository', () => {
it('revokes the live address of one scope only, and still finds a revoked token', async () => {
const { user } = await makeUser(t);
const trip = await makeTrip(t, user.id);
- const own = await addresses.insertAddress({ userId: user.id, tripId: null, tokenHash: 'a', tokenEnc: 'x', createdAt: AT });
+ const own = await addresses.insertAddress({
+ userId: user.id,
+ tripId: null,
+ tokenHash: 'a',
+ tokenEnc: 'x',
+ createdAt: AT,
+ });
await addresses.insertAddress({ userId: user.id, tripId: trip.id, tokenHash: 'b', tokenEnc: 'y', createdAt: AT });
expect(await addresses.revokeLive(user.id, null, LATER)).toBe(1);
@@ -77,7 +83,13 @@ describe('MailIngestAddressesRepository', () => {
it('notes when a mail came in', async () => {
const { user } = await makeUser(t);
- const id = await addresses.insertAddress({ userId: user.id, tripId: null, tokenHash: 'c', tokenEnc: 'z', createdAt: AT });
+ const id = await addresses.insertAddress({
+ userId: user.id,
+ tripId: null,
+ tokenHash: 'c',
+ tokenEnc: 'z',
+ createdAt: AT,
+ });
await addresses.touchUsed(id, LATER);
expect((await addresses.findById(id))?.last_used_at).toBe(LATER);
});
diff --git a/server/tests/unit/db/repositories/MailIngestCandidates.repository.test.ts b/server/tests/unit/db/repositories/MailIngestCandidates.repository.test.ts
index 9765b591a..4c4802f97 100644
--- a/server/tests/unit/db/repositories/MailIngestCandidates.repository.test.ts
+++ b/server/tests/unit/db/repositories/MailIngestCandidates.repository.test.ts
@@ -203,7 +203,12 @@ describe('MailIngestCandidatesRepository: what it reads of the trips', () => {
it('reads the person a mail is for', async () => {
const { user } = await makeUser(t, { username: 'mia', email: '[email protected]' });
- expect(await candidates.findPerson(user.id)).toEqual({ id: user.id, username: 'mia', email: '[email protected]', role: 'user' });
+ expect(await candidates.findPerson(user.id)).toEqual({
+ id: user.id,
+ username: 'mia',
+ email: '[email protected]',
+ role: 'user',
+ });
expect(await candidates.findPerson(user.id + 100)).toBeNull();
});
@@ -218,8 +223,9 @@ describe('MailIngestCandidatesRepository: what it reads of the trips', () => {
external_id: 'ABC123|flight|2027-03-01|hnd-itm',
});
- expect(await candidates.tripHasExternal(trip.id, ['import', 'mail'], 'ABC123|flight|2027-03-01|hnd-itm')).toBe(true);
- expect(await candidates.tripHasExternal(trip.id, ['import'], 'ABC123|flight|2027-03-01|hnd-itm')).toBe(false);
+ const key = 'ABC123|flight|2027-03-01|hnd-itm';
+ expect(await candidates.tripHasExternal(trip.id, ['import', 'mail'], key)).toBe(true);
+ expect(await candidates.tripHasExternal(trip.id, ['import'], key)).toBe(false);
const none = { type: 'flight', startFrom: null, startTo: null, confirmation: null };
expect(await candidates.tripHasSimilar(trip.id, none)).toBe(false);
diff --git a/server/tests/unit/db/repositories/MailIngestMessages.repository.test.ts b/server/tests/unit/db/repositories/MailIngestMessages.repository.test.ts
index d56a7ae11..549c83f49 100644
--- a/server/tests/unit/db/repositories/MailIngestMessages.repository.test.ts
+++ b/server/tests/unit/db/repositories/MailIngestMessages.repository.test.ts
@@ -125,7 +125,12 @@ describe('MailIngestMessagesRepository', () => {
expect(await messages.claimDue(at('2026-11-01T12:00:00Z'), lease, 3)).toEqual([id]);
await messages.finish(id!, DONE);
- expect(await messages.findById(id!)).toMatchObject({ status: 'processed', ai_used: 1, from_verified: 1, lease_until: null });
+ expect(await messages.findById(id!)).toMatchObject({
+ status: 'processed',
+ ai_used: 1,
+ from_verified: 1,
+ lease_until: null,
+ });
});
it('purges a mail once it is done and nothing waits on it, and always after the hard limit', async () => {