Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
habdelra committed Mar 28, 2024
1 parent 5f61be5 commit d6e8936
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/host/tests/helpers/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ type TestIndexRow =
// 2. provide a card instance for each row in the indexed_cards table
// 3. provide an object { card, data } where the card instance is used for each
// row in the indexed_cards table, as well as any additional fields that you
// will to set from the `data` object.
// wish to set from the `data` object.
//
// the realm version table will default to version 1 of the testRealmURL if no
// value is supplied
Expand Down
11 changes: 1 addition & 10 deletions packages/host/tests/unit/query-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ import { testRealmURL, setupIndex, serializeCard } from '../helpers';

let cardApi: typeof import('https://cardstack.com/base/card-api');
let string: typeof import('https://cardstack.com/base/string');
// let number: typeof import('https://cardstack.com/base/number');
// let date: typeof import('https://cardstack.com/base/date');
// let datetime: typeof import('https://cardstack.com/base/datetime');
// let boolean: typeof import('https://cardstack.com/base/boolean');
// let queryableValue: typeof queryableValueType;
let { sqlSchema, resolvedBaseRealmURL } = ENV;

module('Unit | query', function (hooks) {
Expand All @@ -38,11 +33,6 @@ module('Unit | query', function (hooks) {

cardApi = await loader.import(`${baseRealm.url}card-api`);
string = await loader.import(`${baseRealm.url}string`);
// number = await loader.import(`${baseRealm.url}number`);
// date = await loader.import(`${baseRealm.url}date`);
// datetime = await loader.import(`${baseRealm.url}datetime`);
// boolean = await loader.import(`${baseRealm.url}boolean`);
// queryableValue = cardApi.queryableValue;

let { field, contains, CardDef } = cardApi;
let { default: StringField } = string;
Expand Down Expand Up @@ -148,4 +138,5 @@ module('Unit | query', function (hooks) {
});

skip(`can filter using 'eq' thru nested fields`);
skip(`can leverage queryableValue hook in card definition`);
});
6 changes: 4 additions & 2 deletions packages/runtime-common/indexer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,14 @@ export class IndexerDBClient {

let on = filter.on ?? onRef;

// TODO: any, every, not, eq, contains, range

if ('eq' in filter) {
return this.eqCondition(filter, on);
}

// TODO handle filters for: any, every, not, contains, and range
// refer to hub v2 for a good reference:
// https://github.dev/cardstack/cardstack/blob/d36e6d114272a9107a7315d95d2f0f415e06bf5c/packages/hub/pgsearch/pgclient.ts

throw new Error(`Unknown filter: ${JSON.stringify(filter)}`);
}

Expand Down

0 comments on commit d6e8936

Please sign in to comment.