feat: add size, created, and modified columns to file table and manifestattachment APIs
This commit is contained in:
@@ -19,6 +19,9 @@ Attaches a file to an existing manifest.
|
||||
| `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. |
|
||||
@@ -26,7 +29,7 @@ Attaches a file to an existing manifest.
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, manifestId: number, fileId: number, sort: number, hash: string, mimetype: string, name: string, thumbavif: Buffer|null, thumbx: number|null, thumby: number|null}>` — The created attachment record.
|
||||
`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}>` — The created attachment record.
|
||||
|
||||
**Throws**
|
||||
|
||||
@@ -40,7 +43,7 @@ const attachment = await store.manifestattachment.add(42, 1, {
|
||||
name: 'invoice.pdf',
|
||||
content: fileBuffer,
|
||||
});
|
||||
// => { id, manifestId, fileId, sort, hash, mimetype, name, thumbavif, thumbx, thumby }
|
||||
// => { id, manifestId, fileId, sort, hash, mimetype, name, size, created, modified, thumbavif, thumbx, thumby }
|
||||
```
|
||||
|
||||
## `manifestattachment.getById`
|
||||
@@ -59,7 +62,7 @@ Gets an attachment for a manifest by its attachment ID or file ID, including ful
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, manifestId: number, fileId: number, sort: number, hash: string, mimetype: string, name: string, content: Buffer, thumbavif: Buffer|null, thumbx: number|null, thumby: number|null}>` — The attachment record with binary content.
|
||||
`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}>` — The attachment record with binary content.
|
||||
|
||||
**Throws**
|
||||
|
||||
@@ -69,7 +72,7 @@ Gets an attachment for a manifest by its attachment ID or file ID, including ful
|
||||
|
||||
```js
|
||||
const attachment = await store.manifestattachment.getById(42, 1, 5);
|
||||
// => { id, manifestId, fileId, sort, hash, mimetype, name, content, thumbavif, thumbx, thumby }
|
||||
// => { id, manifestId, fileId, sort, hash, mimetype, name, size, created, modified, content, thumbavif, thumbx, thumby }
|
||||
```
|
||||
|
||||
## `manifestattachment.listByManifestId`
|
||||
@@ -87,7 +90,7 @@ Lists all attachments for a given manifest, without loading their full binary co
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<Array<{id: number, manifestId: number, fileId: number, sort: number, hash: string, mimetype: string, name: string, size: number, thumbavif: Buffer|null, thumbx: number|null, thumby: number|null}>>` — A list of attachment metadata objects.
|
||||
`Promise<Array<{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}>>` — A list of attachment metadata objects.
|
||||
|
||||
**Throws**
|
||||
|
||||
@@ -97,7 +100,7 @@ Lists all attachments for a given manifest, without loading their full binary co
|
||||
|
||||
```js
|
||||
const attachments = await store.manifestattachment.listByManifestId(42, 1);
|
||||
// => [{ id, manifestId, fileId, sort, hash, mimetype, name, size, thumbavif, thumbx, thumby }]
|
||||
// => [{ id, manifestId, fileId, sort, hash, mimetype, name, size, created, modified, thumbavif, thumbx, thumby }]
|
||||
```
|
||||
|
||||
## `manifestattachment.order`
|
||||
|
||||
Reference in New Issue
Block a user