Skip to content

Commit

Permalink
refactor: naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Shaw committed Nov 8, 2023
1 parent 4ecb4a1 commit b373ac1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/upload-api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export type { RateLimitsStorage, RateLimit } from './types/rate-limits.js'
import { PlansStorage } from './types/plans.js'
export type { PlansStorage } from './types/plans.js'
import { SubscriptionsStorage } from './types/subscriptions.js'
export type { SubscriptionsStorage } from './types/subscriptions.js'
export type { SubscriptionsStorage }

export interface Service extends StorefrontService {
store: {
Expand Down
2 changes: 1 addition & 1 deletion packages/upload-api/src/types/subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import {

export interface SubscriptionsStorage {
list: (
account: AccountDID
customer: AccountDID
) => Promise<Result<SubscriptionListSuccess, SubscriptionListFailure>>
}
12 changes: 6 additions & 6 deletions packages/upload-api/test/storage/subscriptions-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ export class SubscriptionsStorage {
this.provisionsStore = provisions
}

/** @param {import('../types.js').AccountDID} account */
async list(account) {
/** @param {import('../types.js').AccountDID} customer */
async list(customer) {
/** @type {import('../types.js').SubscriptionListItem[]} */
const results = []
const entries = Object.entries(this.provisionsStore.provisions)
for (const [subscription, { customer, provider, consumer }] of entries) {
if (customer !== account) continue
for (const [subscription, provision] of entries) {
if (provision.customer !== customer) continue
results.push({
subscription,
provider,
consumers: [consumer]
provider: provision.provider,
consumers: [provision.consumer]
})
}
return { ok: { results } }
Expand Down

0 comments on commit b373ac1

Please sign in to comment.