Files
dashlibstorage/API.manifestattachment.md
2026-09-24 23:26:25 +02:00

2.7 KiB

manifestattachment

This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.

manifestattachment.getById

Source: src/store/manifestattachment/getById.js

Gets an attachment for a manifest by its attachment ID or file ID, including full file content.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
manifestId number The manifest ID.
id number The attachment ID or file ID.
[tx] object Optional transaction.

Returns

Promise<{id: number, manifestId: number, fileId: number, sort: number, hash: string, mimetype: string, name: string, size: number, created: Date, modified: Date, content: Buffer, thumbavif: Buffer|null, thumbx: number|null, thumby: number|null, meta: object|null}> — The attachment record with binary content.

Throws

Error — If the manifest or attachment is not found, or user is not authorized.

Example

const attachment = await store.manifestattachment.getById(42, 1, 5);
// => { id, manifestId, fileId, sort, hash, mimetype, name, size, created, modified, content, thumbavif, thumbx, thumby }

manifestattachment.listByManifestId

Source: src/store/manifestattachment/listByManifestId.js

Parse the file.meta JSON text column into an object (string key/value).

manifestattachment.order

Source: src/store/manifestattachment/order.js

Reorders the attachments of a manifest.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
manifestId number The manifest ID.
input `object Array`
[input.ids] Array<number> The attachment ids in their new order.
[tx] object Optional transaction to run within.

Returns

Promise<{ids: Array<number>}> — The applied order.

Throws

Error — If the order is invalid.

Example

const result = await store.manifestattachment.order(42, 1, { ids: [12, 10, 15] });
// => { ids: [12, 10, 15] }

manifestattachment.remove

Source: src/store/manifestattachment/remove.js

Removes a file attachment from a manifest and deletes the underlying file.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
manifestId number The manifest ID.
id number The attachment ID or file ID to remove.
[tx] object Optional transaction.

Returns

Promise<void>

Throws

Error — If the manifest or attachment is not found, or user is not authorized.

Example

await store.manifestattachment.remove(42, 1, 5);