Skip to content

Commit

Permalink
feat: index upload table by root CID
Browse files Browse the repository at this point in the history
@dchoi27 needs to be able to figure out which space an upload went to, ie, he needs to be able to search space DIDs by upload CID

I'm not sure that we need `insertedAt` in here, but I do think it will be helpful to be able to see when a CID was uploaded to various spaces in the admin UI, so I'm including it in the projection. It would not be hard to convince me that we should leave it out...
  • Loading branch information
travis committed Aug 14, 2023
1 parent 1d7370f commit 8f9814b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions upload-api/tables/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export const uploadTableProps = {
},
// space + root must be unique to satisfy index constraint
primaryIndex: { partitionKey: 'space', sortKey: 'root' },
globalIndexes: {
cid: { partitionKey: 'root', projection: ['space', 'insertedAt'] }
}
}

/** @type TableProps */
Expand Down

0 comments on commit 8f9814b

Please sign in to comment.