From 86e4fa6107004e14370491ccbabbc71e07a2909f Mon Sep 17 00:00:00 2001 From: VictoriqueMoe Date: Sat, 16 Mar 2024 19:54:14 +0000 Subject: [PATCH] move to js file --- src/public/index.ejs | 2 +- src/services/socket/recordInfoSocket.ts | 4 ++-- src/utils/typeings.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/public/index.ejs b/src/public/index.ejs index c46e003..bd97dd0 100644 --- a/src/public/index.ejs +++ b/src/public/index.ejs @@ -618,7 +618,7 @@ public class Example { function loadSocket(){ socket.on("record", ({recordCount, recordSize}) => { - fileCountSpan.innerText = recordCount; + fileCountSpan.innerText = recordCount.toLocaleString(); totalFileSizeSpan.innerText = recordSize; }); } diff --git a/src/services/socket/recordInfoSocket.ts b/src/services/socket/recordInfoSocket.ts index 354aa23..2dac5f3 100644 --- a/src/services/socket/recordInfoSocket.ts +++ b/src/services/socket/recordInfoSocket.ts @@ -22,10 +22,10 @@ export class RecordInfoSocket { } private async getPayload(): Promise { - const records = await this.repo.getRecordCount(); + const recordCount = await this.repo.getRecordCount(); const size = (await this.repo.getTotalFileSize()) ?? 0; return { - recordCount: records.toLocaleString(), + recordCount, recordSize: ObjectUtils.sizeToHuman(size), }; } diff --git a/src/utils/typeings.ts b/src/utils/typeings.ts index 2544fda..5d9cebc 100644 --- a/src/utils/typeings.ts +++ b/src/utils/typeings.ts @@ -58,6 +58,6 @@ export type ProtectionLevel = "Encrypted" | "Password" | "None"; export type Awaitable = Promise | T; export type RecordInfoPayload = { - recordCount: string; + recordCount: number; recordSize: string; };