@arolariu/website / lib/actions/scans/fetchScans / fetchScans
Function: fetchScans()
fetchScans(
input):FetchScansOutput
Defined in: lib/actions/scans/fetchScans.ts:89
Fetches all scans belonging to a user from Azure Blob Storage.
Parameters
input
FetchScansInput = {}
Fetch parameters
Returns
FetchScansOutput
Array of Scan entities sorted by upload date (newest first)
Remarks
Execution Context: Server-side only (Next.js server action).
Authentication: Automatically fetches user from auth service.
Performance:
- Lists blobs with prefix filter for efficiency
- Includes metadata in listing to avoid separate fetch per blob
- Returns newest scans first (sorted by uploadedAt DESC)
Filtering:
- By default, excludes archived scans
- Set
includeArchived: trueto include all scans
Side Effects: Emits OpenTelemetry spans for tracing.
Throws
When authentication fails
Throws
When Azure storage access fails
Example
const scans = await fetchScans({
includeArchived: false
});
// Update store with fetched scans
scansStore.setScans(scans.map(s => ({...s, cachedAt: new Date()})));