feat: additional field
This commit is contained in:
parent
2da9f91e4e
commit
ae2e0edfd2
5 changed files with 110 additions and 1 deletions
|
|
@ -3,6 +3,23 @@ import esClient from "../elasticsearch";
|
|||
import minioClient from "../minio";
|
||||
import * as io from "../lib/websocket";
|
||||
|
||||
// const MINIO_ERROR_MESSAGE = "เกิดข้อผิดพลาดกับระบบจัดการไฟล์";
|
||||
|
||||
// async function checkPathExist(bucket: string, path: string[]) {
|
||||
// if (path.filter(Boolean).length === 0) return true; // root does not contain any mark
|
||||
// return await checkFileExist(bucket, `${path.filter(Boolean).join("/")}/.keep`);
|
||||
// }
|
||||
//
|
||||
// async function checkFileExist(bucket: string, pathname: string) {
|
||||
// return Boolean(
|
||||
// await minioClient.statObject(bucket, stripLeadingSlash(pathname)).catch((e) => {
|
||||
// if (e.code === "NotFound") return false;
|
||||
// console.error(`Storage Error: ${e}`);
|
||||
// throw new Error(MINIO_ERROR_MESSAGE);
|
||||
// }),
|
||||
// );
|
||||
// }
|
||||
|
||||
const DEFAULT_INDEX = process.env.ELASTICSEARCH_INDEX;
|
||||
|
||||
if (!DEFAULT_INDEX) throw Error("Default ElasticSearch index must be specified.");
|
||||
|
|
@ -122,15 +139,17 @@ async function handleNotFoundRecord(
|
|||
fileType: stat.type,
|
||||
title: "",
|
||||
description: "",
|
||||
author: "",
|
||||
category: [],
|
||||
keyword: [],
|
||||
metadata: {},
|
||||
upload: true,
|
||||
hidden: false,
|
||||
createdAt: new Date().toISOString(),
|
||||
createdBy: "n/a",
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: "n/a",
|
||||
} satisfies Partial<StorageFile>;
|
||||
} satisfies StorageFile;
|
||||
|
||||
const result = await esClient
|
||||
.index({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue