fix: wording and small adjustment
This commit is contained in:
parent
7f440c40e9
commit
0f694ea777
4 changed files with 75 additions and 14 deletions
|
|
@ -108,7 +108,10 @@ async function listFolder(path: string[]) {
|
|||
const list = await new Promise<{ pathname: string; name: string }[]>((resolve, reject) => {
|
||||
const item: { pathname: string; name: string }[] = [];
|
||||
|
||||
const stream = minioClient.listObjectsV2(DEFAULT_BUCKET, path.join("/") + "/");
|
||||
const stream = minioClient.listObjectsV2(
|
||||
DEFAULT_BUCKET,
|
||||
path.length === 0 ? "" : path.join("/") + "/",
|
||||
);
|
||||
stream.on("data", (v) => {
|
||||
if (v && v.prefix)
|
||||
item.push({
|
||||
|
|
@ -388,7 +391,7 @@ export class StorageController extends Controller {
|
|||
@Post("file")
|
||||
@Tags("Storage File")
|
||||
@Security("bearerAuth", ["management-role", "admin"])
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
public async postFile(
|
||||
@Request() request: { user: { preferred_username: string } },
|
||||
@Body() body: FileBody,
|
||||
|
|
@ -441,7 +444,7 @@ export class StorageController extends Controller {
|
|||
}
|
||||
|
||||
await esClient.index({
|
||||
index: DEFAULT_INDEX!,
|
||||
index: DEFAULT_INDEX,
|
||||
document: metadata,
|
||||
refresh: "wait_for", // Must have or else it doesn't wait for updated index resulted in data not found on fetch
|
||||
});
|
||||
|
|
@ -450,6 +453,8 @@ export class StorageController extends Controller {
|
|||
|
||||
const presignedUrl = await minioClient.presignedPutObject(DEFAULT_BUCKET, metadata.pathname);
|
||||
|
||||
console.log(presignedUrl);
|
||||
|
||||
return { ...metadata, uploadUrl: presignedUrl };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue