Skip to content

nooschain v0.1.0


nooschain / api/routes/bucket/bucket-record-routes / registerBucketRecordRoutes

Function: registerBucketRecordRoutes()

registerBucketRecordRoutes(context, resolveActor): void

Defined in: api/routes/bucket/bucket-record-routes.ts:43

Registers API routes for managing bucket records, including searching for records within a bucket, retrieving individual records by ID, and fetching encrypted payloads for records. The routes enforce appropriate permissions based on the actor's access level to the bucket and whether they have permission to read encrypted data. The search route supports an optional query parameter to include encrypted payloads in the response if the actor has permission to access them. The individual record retrieval route returns metadata about the record and conditionally includes the encrypted payload based on permissions. The payload retrieval route checks permissions and availability of the encrypted payload before returning it.

Parameters

context

ApiRouteContext

The API route context containing the database instance and server.

resolveActor

(headers) => Promise<ApiAuthResult>

A function to resolve the actor making the API request based on the provided headers.

Returns

void

Audience-first NOOSChain documentation.