Skip to content

Commit

Permalink
Move postgres pool client to users service
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejearley committed Jul 3, 2023
1 parent 204e0ae commit 852bd9b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion common/data/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import operatorStore from './mock/operator.store.json'
import validatorStore from './mock/validator.store.json'
import accountStore from './mock/account.store.json'
import userStore from './mock/user.store.json'
import { Postgres } from './providers/postgres'
import { Postgres } from '../../../services/users/src/providers/postgres'
import { JsonType, GlueType, PostgresType, Schema } from './providers/schema'
import { JsonSchema } from './interfaces/JsonSchema'

Expand Down
2 changes: 1 addition & 1 deletion services/users/src/providers/db.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Postgres } from '@casimir/data'
import { Postgres } from './postgres'
import { camelCase } from '@casimir/helpers'
import { Account, RemoveAccountOptions, User, UserAddedSuccess } from '@casimir/types'
import useEthers from './ethers'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export class Postgres {
*/
constructor(config?: PoolConfig) {
this.pool = new Pool(config)
process.on('SIGINT', () => this.close())
}

/**
Expand All @@ -35,8 +34,8 @@ export class Postgres {
async query(text: string, params: any[] = []) { // Todo - use union of stricter @casimir/types for params
const client = await this.pool.connect()
const res = await client.query(text, params)
const { rows } = res
client.release()
const { rows } = res
return rows
}

Expand Down

0 comments on commit 852bd9b

Please sign in to comment.