u
This commit is contained in:
@@ -2,51 +2,6 @@
|
||||
|
||||
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
||||
|
||||
## `manifestattachment.add`
|
||||
|
||||
*Source: `src/store/manifestattachment/add.js`*
|
||||
|
||||
Attaches a file to an existing manifest.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `manifestId` | `number` | The id of the manifest. |
|
||||
| `input` | `object` | The file data. |
|
||||
| `input.mimetype` | `string` | The MIME type of the file (e.g. `'application/pdf'`). |
|
||||
| `input.name` | `string` | The file name. |
|
||||
| `input.content` | `Buffer` | The file content. |
|
||||
| `[input.sort]` | `number` | Optional display sort order. |
|
||||
| `[input.size]` | `number` | Optional file size in bytes (defaults to content length). |
|
||||
| `[input.created]` | `Date|string` | Optional creation timestamp (defaults to current date). |
|
||||
| `[input.modified]` | `Date|string` | Optional modified timestamp (defaults to created date). |
|
||||
| `[input.hash]` | `string` | The file hash (auto-computed SHA-256 if omitted). |
|
||||
| `[input.thumbavif]` | `Buffer` | Optional AVIF thumbnail buffer. |
|
||||
| `[input.thumbx]` | `number` | Optional thumbnail width. |
|
||||
| `[input.thumby]` | `number` | Optional thumbnail height. |
|
||||
| `[input.meta]` | `object` | Optional string key/value metadata stored on the file row. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, manifestId: number, fileId: number, sort: number, hash: string, mimetype: string, name: string, size: number, created: Date, modified: Date, thumbavif: Buffer|null, thumbx: number|null, thumby: number|null, meta: object|null}>` — The created attachment record.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the manifest is not found or file input is invalid.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const attachment = await store.manifestattachment.add(42, 1, {
|
||||
mimetype: 'application/pdf',
|
||||
name: 'invoice.pdf',
|
||||
content: fileBuffer,
|
||||
});
|
||||
// => { id, manifestId, fileId, sort, hash, mimetype, name, size, created, modified, thumbavif, thumbx, thumby }
|
||||
```
|
||||
|
||||
## `manifestattachment.getById`
|
||||
|
||||
*Source: `src/store/manifestattachment/getById.js`*
|
||||
@@ -60,6 +15,7 @@ Gets an attachment for a manifest by its attachment ID or file ID, including ful
|
||||
| `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**
|
||||
|
||||
@@ -96,6 +52,7 @@ Reorders the attachments of a manifest.
|
||||
| `manifestId` | `number` | The manifest ID. |
|
||||
| `input` | `object|Array<number>` | The reorder input or array of IDs. |
|
||||
| `[input.ids]` | `Array<number>` | The attachment ids in their new order. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
@@ -125,6 +82,7 @@ Removes a file attachment from a manifest and deletes the underlying file.
|
||||
| `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**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user