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));
|
.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> = {
|
const metadata: Partial<StorageFile> = {
|
||||||
pathname,
|
pathname,
|
||||||
|
|
@ -201,9 +201,11 @@ export class FileController extends Controller {
|
||||||
id,
|
id,
|
||||||
doc: {
|
doc: {
|
||||||
pathname: destination,
|
pathname: destination,
|
||||||
|
fileName: body.file,
|
||||||
updatedAt: new Date().toISOString(),
|
updatedAt: new Date().toISOString(),
|
||||||
updatedBy: request.user.preferred_username ?? "n/a",
|
updatedBy: request.user.preferred_username ?? "n/a",
|
||||||
},
|
},
|
||||||
|
refresh: "wait_for",
|
||||||
})
|
})
|
||||||
.then(() => minioClient.removeObject(DEFAULT_BUCKET!, pathname));
|
.then(() => minioClient.removeObject(DEFAULT_BUCKET!, pathname));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -230,6 +232,7 @@ export class FileController extends Controller {
|
||||||
updatedAt: new Date().toISOString(),
|
updatedAt: new Date().toISOString(),
|
||||||
updatedBy: request.user.preferred_username ?? "n/a",
|
updatedBy: request.user.preferred_username ?? "n/a",
|
||||||
},
|
},
|
||||||
|
refresh: "wait_for",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ export class SubFolderFileController extends Controller {
|
||||||
.catch((e) => console.error(e));
|
.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> = {
|
const metadata: Partial<StorageFile> = {
|
||||||
pathname,
|
pathname,
|
||||||
|
|
@ -205,9 +205,11 @@ export class SubFolderFileController extends Controller {
|
||||||
id,
|
id,
|
||||||
doc: {
|
doc: {
|
||||||
pathname: destination,
|
pathname: destination,
|
||||||
|
fileName: body.file,
|
||||||
updatedAt: new Date().toISOString(),
|
updatedAt: new Date().toISOString(),
|
||||||
updatedBy: request.user.preferred_username ?? "n/a",
|
updatedBy: request.user.preferred_username ?? "n/a",
|
||||||
},
|
},
|
||||||
|
refresh: "wait_for",
|
||||||
})
|
})
|
||||||
.then(() => minioClient.removeObject(DEFAULT_BUCKET!, pathname));
|
.then(() => minioClient.removeObject(DEFAULT_BUCKET!, pathname));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -234,6 +236,7 @@ export class SubFolderFileController extends Controller {
|
||||||
updatedAt: new Date().toISOString(),
|
updatedAt: new Date().toISOString(),
|
||||||
updatedBy: request.user.preferred_username ?? "n/a",
|
updatedBy: request.user.preferred_username ?? "n/a",
|
||||||
},
|
},
|
||||||
|
refresh: "wait_for",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -261,7 +264,7 @@ export class SubFolderFileController extends Controller {
|
||||||
) {
|
) {
|
||||||
await minioClient.removeObject(
|
await minioClient.removeObject(
|
||||||
DEFAULT_BUCKET!,
|
DEFAULT_BUCKET!,
|
||||||
`${cabinetName}/${drawerName}/${folderName}/${fileName}/${subFolderName}/`,
|
`${cabinetName}/${drawerName}/${folderName}/${subFolderName}/${fileName}`,
|
||||||
);
|
);
|
||||||
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue