feat: add hash and thumbnail columns to file, sort column and order method to manifestattachment
This commit is contained in:
@@ -13,12 +13,12 @@ export default function getById(pool) {
|
||||
* @param {number} googleAuthId - The id of the Google auth user.
|
||||
* @param {number} manifestId - The manifest ID.
|
||||
* @param {number} id - The attachment ID or file ID.
|
||||
* @returns {Promise<{id: number, manifestId: number, fileId: number, mimetype: string, name: string, content: Buffer}>} The attachment record with binary content.
|
||||
* @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.
|
||||
* @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, mimetype, name, content }
|
||||
* // => { id, manifestId, fileId, sort, hash, mimetype, name, content, thumbavif, thumbx, thumby }
|
||||
*/
|
||||
return async (googleAuthId, manifestId, id) => {
|
||||
if (!Number.isFinite(id)) {
|
||||
@@ -42,9 +42,14 @@ export default function getById(pool) {
|
||||
id: row.id,
|
||||
manifestId: row.manifestId,
|
||||
fileId: row.fileId,
|
||||
sort: row.sort,
|
||||
hash: row.hash,
|
||||
mimetype: row.mimetype,
|
||||
name: row.name,
|
||||
content: row.content,
|
||||
thumbavif: row.thumbavif ?? null,
|
||||
thumbx: row.thumbx ?? null,
|
||||
thumby: row.thumby ?? null,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user