fix: error undefined and waiting for index after update
This commit is contained in:
parent
4fa8ad3adf
commit
93f0ac3431
2 changed files with 9 additions and 3 deletions
|
|
@ -111,7 +111,7 @@ export class FileController extends Controller {
|
|||
.catch((e) => console.error(e));
|
||||
}
|
||||
|
||||
const rec = result ? result.hits.hits[0]._source : false;
|
||||
const rec = result && result.hits.hits.length > 0 ? result.hits.hits[0]._source : false;
|
||||
|
||||
const metadata: Partial<StorageFile> = {
|
||||
pathname,
|
||||
|
|
@ -201,9 +201,11 @@ export class FileController extends Controller {
|
|||
id,
|
||||
doc: {
|
||||
pathname: destination,
|
||||
fileName: body.file,
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username ?? "n/a",
|
||||
},
|
||||
refresh: "wait_for",
|
||||
})
|
||||
.then(() => minioClient.removeObject(DEFAULT_BUCKET!, pathname));
|
||||
} else {
|
||||
|
|
@ -230,6 +232,7 @@ export class FileController extends Controller {
|
|||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username ?? "n/a",
|
||||
},
|
||||
refresh: "wait_for",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ export class SubFolderFileController extends Controller {
|
|||
.catch((e) => console.error(e));
|
||||
}
|
||||
|
||||
const rec = result ? result.hits.hits[0]._source : false;
|
||||
const rec = result && result.hits.hits.length > 0 ? result.hits.hits[0]._source : false;
|
||||
|
||||
const metadata: Partial<StorageFile> = {
|
||||
pathname,
|
||||
|
|
@ -205,9 +205,11 @@ export class SubFolderFileController extends Controller {
|
|||
id,
|
||||
doc: {
|
||||
pathname: destination,
|
||||
fileName: body.file,
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username ?? "n/a",
|
||||
},
|
||||
refresh: "wait_for",
|
||||
})
|
||||
.then(() => minioClient.removeObject(DEFAULT_BUCKET!, pathname));
|
||||
} else {
|
||||
|
|
@ -234,6 +236,7 @@ export class SubFolderFileController extends Controller {
|
|||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username ?? "n/a",
|
||||
},
|
||||
refresh: "wait_for",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -261,7 +264,7 @@ export class SubFolderFileController extends Controller {
|
|||
) {
|
||||
await minioClient.removeObject(
|
||||
DEFAULT_BUCKET!,
|
||||
`${cabinetName}/${drawerName}/${folderName}/${fileName}/${subFolderName}/`,
|
||||
`${cabinetName}/${drawerName}/${folderName}/${subFolderName}/${fileName}`,
|
||||
);
|
||||
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue