feat: quality of life sweep from the feature discussions

Small requests from the discussions, each built end to end: planner and
map (cycling mode, date first headings, clear a day, stay times per day,
off-route stops, map lock, compact unplanned markers, pending stays,
cable car, transit quick picks), places (location filter, category from
OSM, open in maps, geo: link, image from an attachment, enrichment on
file import, places near a pin, place name language, Amap first in
China), lists and costs (packed counter, inherited sharing, Markdown
to-dos, payment notes, bookings CSV, my plan PDF), sharing (unplanned
places, travel only, without photos), journey (photo zoom, drafts,
photo order, trip suggestion, day jump), atlas (region counter, region
bucket list, places per country), vacay half company holidays, studio
copy and paste plus the book's own layouts, and RESTORE_FROM_BACKUP for
a first start restore.
This commit is contained in:
Maurice
2026-09-30 23:00:12 +02:00
parent 91dfab3f4b
commit 8fd46c4c18
691 changed files with 9491 additions and 927 deletions
+34
View File
@@ -155,6 +155,40 @@ describe('Assignments e2e (real auth guard + temp SQLite)', () => {
expect(reconcileTripSkeletons).toHaveBeenCalledWith(5, undefined);
});
it('200 clear day removes every place of the day and keeps the day (#2470)', async () => {
reconcileTripSkeletons.mockClear();
const first = seedAssignment(3, 2, 0);
const second = seedAssignment(3, 2, 1);
const elsewhere = seedAssignment(4, 2, 0);
const res = await request(server).delete('/api/trips/5/days/3/assignments').set('Cookie', sessionCookie(1));
expect(res.status).toBe(200);
expect(res.body.success).toBe(true);
expect([...res.body.removedIds].sort()).toEqual([first, second].sort());
expect(db.prepare('SELECT COUNT(*) AS n FROM day_assignments WHERE day_id = 3').get()).toEqual({ n: 0 });
expect(db.prepare('SELECT id FROM day_assignments WHERE id = ?').get(elsewhere)).toEqual({ id: elsewhere });
expect(reconcileTripSkeletons).toHaveBeenCalledWith(5, undefined);
});
it('403 clear day without day_edit, 404 for a foreign day', async () => {
seedAssignment();
checkPermission.mockReturnValue(false);
expect((await request(server).delete('/api/trips/5/days/3/assignments').set('Cookie', sessionCookie(1))).status).toBe(403);
checkPermission.mockReturnValue(true);
const miss = await request(server).delete('/api/trips/5/days/999/assignments').set('Cookie', sessionCookie(1));
expect(miss.status).toBe(404);
expect(miss.body).toEqual({ error: 'Day not found' });
});
it('200 route exclude roundtrip, 400 without a boolean (#2532)', async () => {
const id = seedAssignment();
const res = await request(server).put(`/api/trips/5/assignments/${id}/route`).set('Cookie', sessionCookie(1)).send({ excluded: true });
expect(res.status).toBe(200);
expect(res.body.assignment).toMatchObject({ id, route_excluded: true });
const list = await request(server).get('/api/trips/5/days/3/assignments').set('Cookie', sessionCookie(1));
expect(list.body.assignments[0].route_excluded).toBe(true);
expect((await request(server).put(`/api/trips/5/assignments/${id}/route`).set('Cookie', sessionCookie(1)).send({ excluded: 'yes' })).status).toBe(400);
});
it('200 move assignment reconciles journey skeletons', async () => {
reconcileTripSkeletons.mockClear();
const id = seedAssignment();
+10
View File
@@ -147,6 +147,16 @@ describe('Atlas e2e (real auth guard + real service + temp SQLite)', () => {
expect(row).toEqual({ name: 'Kyoto', user_id: userId });
});
it('keeps a wished-for region, and refuses one outside the item country (#1901)', async () => {
const ok = await request(server).post('/api/addons/atlas/bucket-list').set('Cookie', sessionCookie(userId))
.send({ name: 'Bayern', country_code: 'DE', region_code: 'DE-BY' });
expect(ok.status).toBe(201);
expect(ok.body.item.region_code).toBe('DE-BY');
const bad = await request(server).post('/api/addons/atlas/bucket-list').set('Cookie', sessionCookie(userId))
.send({ name: 'Berlin', country_code: 'FR', region_code: 'DE-BE' });
expect(bad.status).toBe(400);
});
it('404 on delete of a missing bucket item', async () => {
const res = await request(server).delete('/api/addons/atlas/bucket-list/999').set('Cookie', sessionCookie(userId));
expect(res.status).toBe(404);
+17
View File
@@ -293,6 +293,23 @@ describe('Budget e2e (real auth guard + temp SQLite, real budget SQL)', () => {
expect(row).toEqual({ settled_at: null });
});
it('keeps a note on a settlement, leaves it alone when omitted and clears it on blank (#2340)', async () => {
const created = await request(server)
.post(`/api/trips/${tripId}/budget/settlements`)
.set('Cookie', sessionCookie(1))
.send({ from_user_id: 2, to_user_id: 1, amount: 10, note: ' Cash at the airport ' });
expect(created.status).toBe(201);
expect(created.body.settlement.note).toBe('Cash at the airport');
const url = `/api/trips/${tripId}/budget/settlements/${created.body.settlement.id}`;
const kept = await request(server).put(url).set('Cookie', sessionCookie(1)).send({ from_user_id: 2, to_user_id: 1, amount: 12 });
expect(kept.body.settlement.note).toBe('Cash at the airport');
const cleared = await request(server).put(url).set('Cookie', sessionCookie(1)).send({ from_user_id: 2, to_user_id: 1, amount: 12, note: ' ' });
expect(cleared.body.settlement.note).toBeNull();
const tooLong = await request(server).put(url).set('Cookie', sessionCookie(1)).send({ from_user_id: 2, to_user_id: 1, amount: 12, note: 'x'.repeat(501) });
expect(tooLong.status).toBe(400);
});
it('404 on settlement update when it does not exist', async () => {
const res = await request(server)
.put(`/api/trips/${tripId}/budget/settlements/424242`)
+14
View File
@@ -57,6 +57,7 @@ describe('Maps e2e (real auth guard + temp SQLite)', () => {
const maps = app.get(MapsService);
vi.spyOn(maps, 'searchPlaces').mockResolvedValue({ places: [{ name: 'Berlin' }], source: 'osm' });
vi.spyOn(maps, 'reverseGeocode').mockResolvedValue({ name: 'Spot', address: 'Street 1' });
vi.spyOn(maps, 'nearbyPlaces').mockResolvedValue({ places: [{ name: 'Cafe', distance_m: 40 }], source: 'trek-places' });
});
afterAll(async () => {
@@ -84,6 +85,19 @@ describe('Maps e2e (real auth guard + temp SQLite)', () => {
expect(res.body).toEqual({ places: [{ name: 'Berlin' }], source: 'osm' });
});
it('200 with the places near a point (POST stays 200, not 201)', async () => {
const res = await request(server).post('/api/maps/nearby?lang=de').set('Cookie', sessionCookie(1)).send({ lat: 52.5, lng: 13.4 });
expect(res.status).toBe(200);
expect(res.body).toEqual({ places: [{ name: 'Cafe', distance_m: 40 }], source: 'trek-places' });
});
it('400 on nearby with a circle wider than the contract allows, 401 without a session', async () => {
const wide = await request(server).post('/api/maps/nearby').set('Cookie', sessionCookie(1)).send({ lat: 52.5, lng: 13.4, radius: 9000 });
expect(wide.status).toBe(400);
const anon = await request(server).post('/api/maps/nearby').send({ lat: 52.5, lng: 13.4 });
expect(anon.status).toBe(401);
});
it('200 on reverse geocode', async () => {
const res = await request(server).get('/api/maps/reverse').set('Cookie', sessionCookie(1)).query({ lat: '52.5', lng: '13.4' });
expect(res.status).toBe(200);
+12
View File
@@ -353,6 +353,18 @@ describe('Packing e2e (real auth guard + real SQL over temp SQLite)', () => {
expect(res.body.item.checked).toBe(1);
});
it('counts packed pieces and ticks the item once the count is full (#2296)', async () => {
const id = insertItem(tripId, 'Shirts');
await request(server).put(`/api/trips/${tripId}/packing/${id}`).set('Cookie', sessionCookie(1)).send({ quantity: 3 });
const partial = await request(server).put(`/api/trips/${tripId}/packing/${id}`).set('Cookie', sessionCookie(1)).send({ packed_quantity: 2 });
expect(partial.status).toBe(200);
expect(partial.body.item).toMatchObject({ packed_quantity: 2, checked: 0 });
const full = await request(server).put(`/api/trips/${tripId}/packing/${id}`).set('Cookie', sessionCookie(1)).send({ packed_quantity: 3 });
expect(full.body.item).toMatchObject({ packed_quantity: null, checked: 1 });
const negative = await request(server).put(`/api/trips/${tripId}/packing/${id}`).set('Cookie', sessionCookie(1)).send({ packed_quantity: -1 });
expect(negative.status).toBe(400);
});
it('whitespace-only bag name still gets the bespoke 400', async () => {
const res = await request(server).post(`/api/trips/${tripId}/packing/bags`).set('Cookie', sessionCookie(1)).send({ name: ' ' });
expect(res.status).toBe(400);
+12
View File
@@ -151,6 +151,18 @@ describe('Share-link e2e (real auth guard + real SQL over temp SQLite)', () => {
expect(after.body).toEqual({ token: null });
});
it('carries the narrowing options through to the public read (#1712)', async () => {
const created = await request(server).post(`/api/trips/${tripId}/share-link`).set('Cookie', sessionCookie(1))
.send({ share_travel_only: true, share_hide_images: true });
const info = await request(server).get(`/api/trips/${tripId}/share-link`).set('Cookie', sessionCookie(1));
expect(info.body).toEqual(expect.objectContaining({ share_travel_only: true, share_hide_images: true }));
const res = await request(server).get(`/api/shared/${created.body.token}`);
expect(res.body.permissions).toEqual(expect.objectContaining({ share_travel_only: true, share_hide_images: true }));
expect(res.body.dayNotes).toEqual({});
const bad = await request(server).post(`/api/trips/${tripId}/share-link`).set('Cookie', sessionCookie(1)).send({ share_hide_images: 'yes' });
expect(bad.status).toBe(400);
});
it('public shared read is unguarded (200, no cookie)', async () => {
const created = await request(server).post(`/api/trips/${tripId}/share-link`).set('Cookie', sessionCookie(1)).send({});
const res = await request(server).get(`/api/shared/${created.body.token}`);