Skip to content

Commit

Permalink
fix(data-store): replace typeOrm findOne queries including relations …
Browse files Browse the repository at this point in the history
…with find (#1400)
  • Loading branch information
S3bb1 authored Jul 4, 2024
1 parent 925fd81 commit 034afc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/data-store/src/data-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class DataStore implements IAgentPlugin {
}

async dataStoreGetMessage(args: IDataStoreGetMessageArgs): Promise<IMessage> {
const messageEntity = await (await getConnectedDb(this.dbConnection)).getRepository(Message).findOne({
const [messageEntity] = await (await getConnectedDb(this.dbConnection)).getRepository(Message).find({
where: { id: args.id },
relations: ['credentials', 'presentations'],
})
Expand All @@ -73,7 +73,7 @@ export class DataStore implements IAgentPlugin {
}

async dataStoreDeleteMessage(args: IDataStoreDeleteMessageArgs): Promise<boolean> {
const messageEntity = await (await getConnectedDb(this.dbConnection)).getRepository(Message).findOne({
const [messageEntity] = await (await getConnectedDb(this.dbConnection)).getRepository(Message).find({
where: { id: args.id },
relations: ['credentials', 'presentations'],
})
Expand Down
4 changes: 2 additions & 2 deletions packages/data-store/src/identifier/did-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class DIDStore extends AbstractDIDStore {
throw Error('[veramo:data-store:identifier-store] Get requires did or (alias and provider)')
}

const identifier = await (await getConnectedDb(this.dbConnection)).getRepository(Identifier).findOne({
const [identifier] = await (await getConnectedDb(this.dbConnection)).getRepository(Identifier).find({
where,
relations: ['keys', 'services'],
})
Expand Down Expand Up @@ -88,7 +88,7 @@ export class DIDStore extends AbstractDIDStore {
}

async deleteDID({ did }: { did: string }) {
const identifier = await (await getConnectedDb(this.dbConnection)).getRepository(Identifier).findOne({
const [identifier] = await (await getConnectedDb(this.dbConnection)).getRepository(Identifier).find({
where: { did },
relations: ['keys', 'services', 'issuedCredentials', 'issuedPresentations'],
})
Expand Down

0 comments on commit 034afc4

Please sign in to comment.