refactor: word
This commit is contained in:
parent
d8cf568206
commit
3820a05704
12 changed files with 56 additions and 56 deletions
|
|
@ -18,7 +18,7 @@ import esClient from "../elasticsearch";
|
|||
import minioClient from "../minio";
|
||||
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import { EhrFile } from "../interfaces/ehr-fs";
|
||||
import { StorageFile } from "../interfaces/storage-fs";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
|
||||
import { copyCond, pathExist } from "../utils/minio";
|
||||
|
|
@ -42,8 +42,8 @@ export class SubFolderFileController extends Controller {
|
|||
@Path() drawerName: string,
|
||||
@Path() folderName: string,
|
||||
@Path() subFolderName: string,
|
||||
): Promise<EhrFile[]> {
|
||||
const search = await esClient.search<EhrFile & { attachment: Record<string, string> }>({
|
||||
): Promise<StorageFile[]> {
|
||||
const search = await esClient.search<StorageFile & { attachment: Record<string, string> }>({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: {
|
||||
prefix: {
|
||||
|
|
@ -57,10 +57,10 @@ export class SubFolderFileController extends Controller {
|
|||
.map((v) => {
|
||||
if (v._source) {
|
||||
const { attachment, ...rest } = v._source;
|
||||
return rest satisfies EhrFile;
|
||||
return rest satisfies StorageFile;
|
||||
}
|
||||
})
|
||||
.filter((v: EhrFile | undefined): v is EhrFile => !!v);
|
||||
.filter((v: StorageFile | undefined): v is StorageFile => !!v);
|
||||
|
||||
return records;
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ export class SubFolderFileController extends Controller {
|
|||
}
|
||||
|
||||
const result = await esClient
|
||||
.search<EhrFile & { attachment?: Record<string, unknown> }>({
|
||||
.search<StorageFile & { attachment?: Record<string, unknown> }>({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: { match: { pathname } },
|
||||
})
|
||||
|
|
@ -116,7 +116,7 @@ export class SubFolderFileController extends Controller {
|
|||
|
||||
const rec = result ? result.hits.hits[0]._source : false;
|
||||
|
||||
const metadata: Partial<EhrFile> = {
|
||||
const metadata: Partial<StorageFile> = {
|
||||
pathname,
|
||||
fileName: body.file,
|
||||
fileSize: 0,
|
||||
|
|
@ -190,7 +190,7 @@ export class SubFolderFileController extends Controller {
|
|||
|
||||
if (copy) {
|
||||
const search = await esClient
|
||||
.search<EhrFile & { attachment?: Record<string, unknown> }>({
|
||||
.search<StorageFile & { attachment?: Record<string, unknown> }>({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: { match: { pathname } },
|
||||
})
|
||||
|
|
@ -215,7 +215,7 @@ export class SubFolderFileController extends Controller {
|
|||
}
|
||||
} else {
|
||||
const search = await esClient
|
||||
.search<EhrFile & { attachment?: Record<string, unknown> }>({
|
||||
.search<StorageFile & { attachment?: Record<string, unknown> }>({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: { match: { pathname } },
|
||||
})
|
||||
|
|
@ -276,7 +276,7 @@ export class SubFolderFileController extends Controller {
|
|||
@Path() subFolderName: string,
|
||||
@Path() fileName: string,
|
||||
) {
|
||||
const search = await esClient.search<EhrFile & { attachment: Record<string, string> }>({
|
||||
const search = await esClient.search<StorageFile & { attachment: Record<string, string> }>({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: {
|
||||
match: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue