docs: word and order
This commit is contained in:
parent
9b2bff6ba5
commit
d8cf568206
10 changed files with 322 additions and 284 deletions
|
|
@ -31,7 +31,7 @@ if (!DEFAULT_INDEX) throw Error("Default ElasticSearch index must be specified."
|
|||
@Route("cabinet")
|
||||
export class CabinetController extends Controller {
|
||||
@Get("/")
|
||||
@Tags("Cabinet")
|
||||
@Tags("ตู้เอกสาร")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
|
|
@ -48,7 +48,7 @@ export class CabinetController extends Controller {
|
|||
}
|
||||
|
||||
@Post("/")
|
||||
@Tags("Cabinet")
|
||||
@Tags("ตู้เอกสาร")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(HttpStatusCode.INTERNAL_SERVER_ERROR, "เกิดข้อผิดพลาดกับระบบจัดการไฟล์")
|
||||
@SuccessResponse(HttpStatusCode.CREATED, "สำเร็จ")
|
||||
|
|
@ -69,7 +69,7 @@ export class CabinetController extends Controller {
|
|||
}
|
||||
|
||||
@Put("/{cabinetName}")
|
||||
@Tags("Cabinet")
|
||||
@Tags("ตู้เอกสาร")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(HttpStatusCode.INTERNAL_SERVER_ERROR, "เกิดข้อผิดพลาดไม่สามารถย้ายไฟล์ได้")
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
|
|
@ -122,7 +122,7 @@ export class CabinetController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("/{cabinetName}")
|
||||
@Tags("Cabinet")
|
||||
@Tags("ตู้เอกสาร")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(HttpStatusCode.INTERNAL_SERVER_ERROR, "เกิดข้อผิดพลาด ไม่สามารถลบไฟล์ได้")
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ if (!DEFAULT_INDEX) throw Error("Default ElasticSearch index must be specified."
|
|||
@Route("/cabinet/{cabinetName}/drawer")
|
||||
export class DrawerController extends Controller {
|
||||
@Get("/")
|
||||
@Tags("Drawer")
|
||||
@Tags("ลิ้นชัก")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
|
|
@ -49,7 +49,7 @@ export class DrawerController extends Controller {
|
|||
}
|
||||
|
||||
@Post("/")
|
||||
@Tags("Drawer")
|
||||
@Tags("ลิ้นชัก")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(HttpStatusCode.NOT_FOUND, "ไม่พบลิ้นชัก")
|
||||
@Response(HttpStatusCode.INTERNAL_SERVER_ERROR, "เกิดข้อผิดพลาดกับระบบจัดการไฟล์")
|
||||
|
|
@ -85,7 +85,7 @@ export class DrawerController extends Controller {
|
|||
}
|
||||
|
||||
@Put("/{drawerName}")
|
||||
@Tags("Drawer")
|
||||
@Tags("ลิ้นชัก")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(HttpStatusCode.INTERNAL_SERVER_ERROR, "เกิดข้อผิดพลาดไม่สามารถย้ายไฟล์ได้")
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
|
|
@ -141,7 +141,7 @@ export class DrawerController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("/{drawerName}")
|
||||
@Tags("Drawer")
|
||||
@Tags("ลิ้นชัก")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
public async deleteDrawer(@Path() cabinetName: string, @Path() drawerName: string) {
|
||||
|
|
|
|||
|
|
@ -31,8 +31,39 @@ if (!DEFAULT_INDEX) throw Error("Default ElasticSearch index must be specified."
|
|||
|
||||
@Route("/cabinet/{cabinetName}/drawer/{drawerName}/folder/{folderName}/file")
|
||||
export class FileController extends Controller {
|
||||
@Get("/")
|
||||
@Tags("ไฟล์")
|
||||
@Security("bearerAuth")
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
public async getFile(
|
||||
@Path() cabinetName: string,
|
||||
@Path() drawerName: string,
|
||||
@Path() folderName: string,
|
||||
): Promise<EhrFile[]> {
|
||||
const search = await esClient.search<EhrFile & { attachment: Record<string, string> }>({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: {
|
||||
prefix: {
|
||||
pathname: `${cabinetName}/${drawerName}/${folderName}/`,
|
||||
},
|
||||
},
|
||||
size: 10000,
|
||||
});
|
||||
|
||||
const records = search.hits.hits
|
||||
.map((v) => {
|
||||
if (v._source) {
|
||||
const { attachment, ...rest } = v._source;
|
||||
return rest satisfies EhrFile;
|
||||
}
|
||||
})
|
||||
.filter((v: EhrFile | undefined): v is EhrFile => !!v);
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
@Post("/")
|
||||
@Tags("File")
|
||||
@Tags("ไฟล์")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
|
|
@ -112,39 +143,8 @@ export class FileController extends Controller {
|
|||
};
|
||||
}
|
||||
|
||||
@Get("/")
|
||||
@Tags("File")
|
||||
@Security("bearerAuth")
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
public async getFile(
|
||||
@Path() cabinetName: string,
|
||||
@Path() drawerName: string,
|
||||
@Path() folderName: string,
|
||||
): Promise<EhrFile[]> {
|
||||
const search = await esClient.search<EhrFile & { attachment: Record<string, string> }>({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: {
|
||||
prefix: {
|
||||
pathname: `${cabinetName}/${drawerName}/${folderName}/`,
|
||||
},
|
||||
},
|
||||
size: 10000,
|
||||
});
|
||||
|
||||
const records = search.hits.hits
|
||||
.map((v) => {
|
||||
if (v._source) {
|
||||
const { attachment, ...rest } = v._source;
|
||||
return rest satisfies EhrFile;
|
||||
}
|
||||
})
|
||||
.filter((v: EhrFile | undefined): v is EhrFile => !!v);
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
@Patch("/{fileName}")
|
||||
@Tags("File")
|
||||
@Tags("ไฟล์")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(HttpStatusCode.NOT_FOUND, "ไม่พบตำแหน่งที่ต้องการสร้างแฟ้ม")
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
|
|
@ -243,7 +243,7 @@ export class FileController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("/{fileName}")
|
||||
@Tags("File")
|
||||
@Tags("ไฟล์")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
public async deleteFile(
|
||||
|
|
@ -260,7 +260,7 @@ export class FileController extends Controller {
|
|||
}
|
||||
|
||||
@Get("/{fileName}")
|
||||
@Tags("Download")
|
||||
@Tags("ดาวน์โหลด")
|
||||
@Security("bearerAuth")
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
public async downloadFile(
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ if (!DEFAULT_INDEX) throw Error("Default ElasticSearch index must be specified."
|
|||
@Route("/cabinet/{cabinetName}/drawer/{drawerName}/folder")
|
||||
export class FolderController extends Controller {
|
||||
@Get("/")
|
||||
@Tags("Folder")
|
||||
@Tags("แฟ้ม")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
|
|
@ -51,7 +51,7 @@ export class FolderController extends Controller {
|
|||
}
|
||||
|
||||
@Post("/")
|
||||
@Tags("Folder")
|
||||
@Tags("แฟ้ม")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(HttpStatusCode.NOT_FOUND, "ไม่พบตำแหน่งที่ต้องการสร้างแฟ้ม")
|
||||
@Response(HttpStatusCode.INTERNAL_SERVER_ERROR, "เกิดข้อผิดพลาดกับระบบจัดการไฟล์")
|
||||
|
|
@ -88,7 +88,7 @@ export class FolderController extends Controller {
|
|||
}
|
||||
|
||||
@Put("/{folderName}")
|
||||
@Tags("Folder")
|
||||
@Tags("แฟ้ม")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(HttpStatusCode.INTERNAL_SERVER_ERROR, "เกิดข้อผิดพลาดไม่สามารถย้ายไฟล์ได้")
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
|
|
@ -145,7 +145,7 @@ export class FolderController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("/{folderName}")
|
||||
@Tags("Folder")
|
||||
@Tags("แฟ้ม")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
public async deleteFolder(
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if (!DEFAULT_INDEX) throw Error("Default ElasticSearch index must be specified."
|
|||
@Route("/search")
|
||||
export class SearchController extends Controller {
|
||||
@Post("/")
|
||||
@Tags("Search")
|
||||
@Tags("ค้นหา")
|
||||
@Security("bearerAuth")
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
public async searchFile(@Body() search: Search): Promise<EhrFile[]> {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ if (!DEFAULT_INDEX) throw Error("Default ElasticSearch index must be specified."
|
|||
@Route("/cabinet/{cabinetName}/drawer/{drawerName}/folder/{folderName}/subfolder")
|
||||
export class SubFolderController extends Controller {
|
||||
@Get("/")
|
||||
@Tags("SubFolder")
|
||||
@Tags("แฟ้มย่อย")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
|
|
@ -53,7 +53,7 @@ export class SubFolderController extends Controller {
|
|||
}
|
||||
|
||||
@Post("/")
|
||||
@Tags("SubFolder")
|
||||
@Tags("แฟ้มย่อย")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(HttpStatusCode.NOT_FOUND, "ไม่พบของแฟ้ม")
|
||||
@Response(HttpStatusCode.INTERNAL_SERVER_ERROR, "เกิดข้อผิดพลาดกับระบบจัดการไฟล์")
|
||||
|
|
@ -91,7 +91,7 @@ export class SubFolderController extends Controller {
|
|||
}
|
||||
|
||||
@Put("/{subFolderName}")
|
||||
@Tags("SubFolder")
|
||||
@Tags("แฟ้มย่อย")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(HttpStatusCode.INTERNAL_SERVER_ERROR, "เกิดข้อผิดพลาดไม่สามารถย้ายไฟล์ได้")
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
|
|
@ -149,7 +149,7 @@ export class SubFolderController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("/{subFolderName}")
|
||||
@Tags("SubFolder")
|
||||
@Tags("แฟ้มย่อย")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
public async deleteFolder(
|
||||
|
|
|
|||
|
|
@ -33,8 +33,40 @@ if (!DEFAULT_INDEX) throw Error("Default ElasticSearch index must be specified."
|
|||
"/cabinet/{cabinetName}/drawer/{drawerName}/folder/{folderName}/subfolder/{subFolderName}/file",
|
||||
)
|
||||
export class SubFolderFileController extends Controller {
|
||||
@Get("/")
|
||||
@Tags("ไฟล์")
|
||||
@Security("bearerAuth")
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
public async getFile(
|
||||
@Path() cabinetName: string,
|
||||
@Path() drawerName: string,
|
||||
@Path() folderName: string,
|
||||
@Path() subFolderName: string,
|
||||
): Promise<EhrFile[]> {
|
||||
const search = await esClient.search<EhrFile & { attachment: Record<string, string> }>({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: {
|
||||
prefix: {
|
||||
pathname: `${cabinetName}/${drawerName}/${folderName}/${subFolderName}`,
|
||||
},
|
||||
},
|
||||
size: 10000,
|
||||
});
|
||||
|
||||
const records = search.hits.hits
|
||||
.map((v) => {
|
||||
if (v._source) {
|
||||
const { attachment, ...rest } = v._source;
|
||||
return rest satisfies EhrFile;
|
||||
}
|
||||
})
|
||||
.filter((v: EhrFile | undefined): v is EhrFile => !!v);
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
@Post("/")
|
||||
@Tags("SubFolder File")
|
||||
@Tags("ไฟล์")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
|
|
@ -115,40 +147,8 @@ export class SubFolderFileController extends Controller {
|
|||
};
|
||||
}
|
||||
|
||||
@Get("/")
|
||||
@Tags("SubFolder File")
|
||||
@Security("bearerAuth")
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
public async getFile(
|
||||
@Path() cabinetName: string,
|
||||
@Path() drawerName: string,
|
||||
@Path() folderName: string,
|
||||
@Path() subFolderName: string,
|
||||
): Promise<EhrFile[]> {
|
||||
const search = await esClient.search<EhrFile & { attachment: Record<string, string> }>({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: {
|
||||
prefix: {
|
||||
pathname: `${cabinetName}/${drawerName}/${folderName}/${subFolderName}`,
|
||||
},
|
||||
},
|
||||
size: 10000,
|
||||
});
|
||||
|
||||
const records = search.hits.hits
|
||||
.map((v) => {
|
||||
if (v._source) {
|
||||
const { attachment, ...rest } = v._source;
|
||||
return rest satisfies EhrFile;
|
||||
}
|
||||
})
|
||||
.filter((v: EhrFile | undefined): v is EhrFile => !!v);
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
@Patch("/{fileName}")
|
||||
@Tags("SubFolder File")
|
||||
@Tags("ไฟล์")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@Response(HttpStatusCode.NOT_FOUND, "ไม่พบตำแหน่งที่ต้องการสร้างแฟ้ม")
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
|
|
@ -248,7 +248,7 @@ export class SubFolderFileController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("/{fileName}")
|
||||
@Tags("SubFolder File")
|
||||
@Tags("ไฟล์")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
public async deleteFile(
|
||||
|
|
@ -266,7 +266,8 @@ export class SubFolderFileController extends Controller {
|
|||
}
|
||||
|
||||
@Get("/{fileName}")
|
||||
@Tags("Download")
|
||||
@Tags("ดาวน์โหลด")
|
||||
@Security("bearerAuth")
|
||||
@SuccessResponse(HttpStatusCode.OK)
|
||||
public async downloadFile(
|
||||
@Path() cabinetName: string,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue