Skip to content

Commit

Permalink
chore: debug session
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Feb 5, 2025
1 parent 237d52a commit 2a07c66
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/data-store/src/statusList/StatusListStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ export class StatusListStore implements IStatusListStore {
await this.getStatusListEntryRepo()
).findOne({
where: {
...(args.statusListId && { statusList: args.statusListId }),
statusList: args.statusListId,
...(args.correlationId && { correlationId: args.correlationId }),
statusListIndex: args.statusListIndex,
...(args.statusListIndex && { statusListIndex: args.statusListIndex }),
},
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export interface IStatusListEntryAvailableArgs {
}

export interface IGetStatusListEntryByIndexArgs {
statusListId?: string
statusListId: string
correlationId?: string
statusListIndex: number
statusListIndex?: number
errorOnNotFound?: boolean
}

Expand Down
15 changes: 10 additions & 5 deletions packages/vc-status-list-issuer-rest-api/src/api-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export function getStatusListCredentialIndexStatusEndpoint(router: Router, conte

const entityCorrelationId = request.query.entityCorrelationId?.toString()
let entry = await driver.getStatusListEntryByIndex({
statusListIndex,
...(entityCorrelationId ? { correlationId: entityCorrelationId } : { statusListId: details.id }),
statusListId: details.id,
...(entityCorrelationId ? { correlationId: entityCorrelationId } : { statusListIndex: statusListIndex }),
errorOnNotFound: false,
})
const type = details.type === StatusListType.StatusList2021 ? 'StatusList2021Entry' : details.type
Expand Down Expand Up @@ -197,10 +197,15 @@ export function updateStatusEndpoint(router: Router, context: IRequiredContext,
if (!updateRequest.statusListIndex || updateRequest.statusListIndex < 0) {
return sendErrorResponse(response, 400, 'Invalid statusListIndex supplied')
}
const driver = await getDriver({
...(statusListCorrelationId ? { statusListCorrelationId } : { id: buildStatusListId(request) }),
dbName: opts.dbName,
})
const details = await driver.getStatusList()

statusListEntry = await driver.getStatusListEntryByIndex({
statusListIndex: updateRequest.statusListIndex,
...(statusListId && { statusListId }),
...(!statusListId && { correlationId: statusListCorrelationId }), // Do not query for correlationId when we have statusListId
statusListId: details.id,
...(entryCorrelationId ? { correlationId: entryCorrelationId } : { statusListIndex: updateRequest.statusListIndex }),
errorOnNotFound: true,
})
}
Expand Down

0 comments on commit 2a07c66

Please sign in to comment.