Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryfan01234 committed Aug 29, 2024
1 parent 205eda7 commit bc2edc6
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Persistent cache store', () => {
defaultKV.key,
);
expect(kv).toEqual(expect.objectContaining(newKv));

const newKv2 = {
...defaultKV,
value: 'someOtherValue2',
Expand All @@ -56,11 +56,11 @@ describe('Persistent cache store', () => {
expect(kvs.length).toEqual(2);
expect(kvs).toEqual(expect.arrayContaining([
expect.objectContaining(defaultKV),
expect.objectContaining(defaultKV2)
expect.objectContaining(defaultKV2),
]));
});

it('Successfully finds a Wallet', async () => {
it('Successfully finds a kv pair', async () => {
await PersistentCacheTable.create(defaultKV);

const kv: PersistentCacheFromDatabase | undefined = await PersistentCacheTable.findById(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as Knex from "knex";

import * as Knex from 'knex';

export async function up(knex: Knex): Promise<void> {
return knex.schema.createTable('persistent_cache', (table) => {
Expand All @@ -8,9 +7,6 @@ export async function up(knex: Knex): Promise<void> {
});
}


export async function down(knex: Knex): Promise<void> {
return knex.schema.dropTable('persistent_cache');
}


Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ export default class PersistentCacheModel extends BaseModel {
key!: string;

value!: string;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PartialModelObject, QueryBuilder } from 'objection';
import { QueryBuilder } from 'objection';

import { DEFAULT_POSTGRES_OPTIONS } from '../constants';
import { setupBaseQuery, verifyAllRequiredFields } from '../helpers/stores-helpers';
Expand All @@ -13,7 +13,6 @@ import {
PersistentCacheCreateObject,
PersistentCacheFromDatabase,
PersistentCacheQueryConfig,
PersistentCacheUpdateObject,
} from '../types';

export async function findAll(
Expand Down Expand Up @@ -78,7 +77,7 @@ export async function upsert(
const kvs: PersistentCacheModel[] = await PersistentCacheModel.query(
Transaction.get(options.txId),
).upsert(kvToUpsert).returning('*');
// should only ever be one key value
// should only ever be one key value pair
return kvs[0];
}
export async function findById(
Expand Down
4 changes: 2 additions & 2 deletions indexer/packages/postgres/src/types/db-model-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ export interface LeaderboardPnlFromDatabase {
}

export interface PersistentCacheFromDatabase {
key: string;
value: string;
key: string,
value: string,
}

export type SubaccountAssetNetTransferMap = { [subaccountId: string]:
Expand Down
5 changes: 0 additions & 5 deletions indexer/packages/postgres/src/types/persistent-cache-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ export interface PersistentCacheCreateObject {
value: string,
}

export interface PersistentCacheUpdateObject {
key: string,
value: string,
}

export enum PersistentCacheColumns {
key = 'key',
value = 'value',
Expand Down
2 changes: 1 addition & 1 deletion indexer/packages/postgres/src/types/query-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,5 +326,5 @@ export interface LeaderboardPnlQueryConfig extends QueryConfig {
}

export interface PersistentCacheQueryConfig extends QueryConfig {
[QueryableField.KEY]?: string;
[QueryableField.KEY]?: string,
}

0 comments on commit bc2edc6

Please sign in to comment.