Skip to content

Commit

Permalink
fix: unlist deleted pin requests (#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandra Stoica authored Jan 25, 2022
1 parent 9f5df56 commit a378c0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,7 @@ export class DBClient {
.from(psaPinRequestTableName)
.select(pinRequestSelect)
.eq('auth_key_id', authKey)
.is('deleted_at', null)
.order('inserted_at', { ascending: false })

if (opts.status) {
Expand Down
10 changes: 9 additions & 1 deletion packages/db/test/pinning.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ describe('Pin Request', () => {
name: '',
date: [2020, 9, 1]
}, {
name: 'Bear',
name: 'toBeDeleted',
date: [2020, 10, 1]
}
]
Expand Down Expand Up @@ -382,6 +382,14 @@ describe('Pin Request', () => {

assert.strictEqual(pins.length, 11)
})

it('unlists deleted pins', async () => {
const { results: prs } = await client.listPsaPinRequests(authKeyPinList, { limit: 20 })
assert.strictEqual(prs.length, 11)
await client.deletePsaPinRequest(createdPinningRequests[10]._id, authKeyPinList)
const { results: res } = await client.listPsaPinRequests(authKeyPinList)
assert.strictEqual(res.length, 10)
})
})

describe('Delete Pin', () => {
Expand Down

0 comments on commit a378c0d

Please sign in to comment.