mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 16:10:07 +00:00
feat(places): read every place of the trips and lists in one view
A read-only overview of every place a user can reach: the saved places of
their lists and the places of their trips, viewer trips included, with tours,
tracks and the stops of a drive left out. A saved place and a trip place are
one entry only when the saved place came from that trip place, the trip is
still open to the user, and both agree (a provider id, or the same name at the
same spot); anything else stays apart. Every entry names where it comes from
and whether it may be changed there.
- GET /api/addons/collections/library/places: paged by cursor, search,
category, kind, list, trip and status filters, counts per kind.
- GET /api/addons/collections/library/places/{trip|list}/🆔 one entry with
what each origin keeps on its own (notes after the existing rights, labels,
ratings, a trip's planned days, whether a stay or booking uses it).
- MCP tools list_all_places and get_library_place.
Nothing is written and nothing migrates; the rights are the existing list and
trip checks, read on every call.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
castIntegerKysely,
|
||||
concatKysely,
|
||||
containsIgnoringCaseKysely,
|
||||
currentTimestampKysely,
|
||||
integerTextEqualsKysely,
|
||||
nowPlusSecondsKysely,
|
||||
@@ -276,6 +277,28 @@ describe('kysely-functions (postgres)', () => {
|
||||
expect(now.parameters).toEqual([]);
|
||||
});
|
||||
|
||||
it('SQLFPG-026: containsIgnoringCaseKysely is strpos over both sides lowered, the needle cast to text', () => {
|
||||
const compiled = db
|
||||
.selectFrom('users')
|
||||
.select((eb) => containsIgnoringCaseKysely(pg, eb, 'username', '50%').as('v'))
|
||||
.compile();
|
||||
expect(compiled.sql).toBe('select strpos(lower("username"), lower(cast($1 as text))) > 0 as "v" from "users"');
|
||||
expect(compiled.parameters).toEqual(['50%']);
|
||||
|
||||
// The same statement spelled for SQLite, rendered by this compiler: only the function differs.
|
||||
const onSqlite = db
|
||||
.selectFrom('users')
|
||||
.select((eb) => containsIgnoringCaseKysely(new SqlitePlatform(), eb, 'username', 'x').as('v'))
|
||||
.compile();
|
||||
expect(onSqlite.sql).toBe('select instr(lower("username"), lower(cast($1 as text))) > 0 as "v" from "users"');
|
||||
|
||||
class FakePlatform extends Platform {}
|
||||
const eb = expressionBuilder<ProbeDB, 'users'>();
|
||||
expect(() => containsIgnoringCaseKysely(new FakePlatform(), eb, 'username', 'x')).toThrow(
|
||||
/no implementation for platform FakePlatform/,
|
||||
);
|
||||
});
|
||||
|
||||
it('SQLFPG-025: an unknown platform still fails closed in the Kysely twins', () => {
|
||||
class FakePlatform extends Platform {}
|
||||
const foreign = new FakePlatform();
|
||||
|
||||
Reference in New Issue
Block a user