Move file date formatting to the server

This commit is contained in:
Lee 2022-11-17 08:16:17 +00:00
parent 4d728ed349
commit c907abeba3
No known key found for this signature in database
GPG Key ID: 6EA25896ECCB3121

@ -1,5 +1,6 @@
import ffprobe from "ffprobe"; import ffprobe from "ffprobe";
import ffprobeStatic from "ffprobe-static"; import ffprobeStatic from "ffprobe-static";
import moment from "moment/moment";
import path from "path"; import path from "path";
import UserModel from "src/models/UserModel"; import UserModel from "src/models/UserModel";
import { FILE_STORAGE_LOCATION } from "../../consts/filePaths"; import { FILE_STORAGE_LOCATION } from "../../consts/filePaths";
@ -52,6 +53,7 @@ export async function getFileInfo(fileId, isInternal = false) {
file.uploader = uploader; file.uploader = uploader;
file._id = undefined; file._id = undefined;
file.__v = undefined; file.__v = undefined;
file.uploadDate = moment(file.uploadDate).format("MMMM Do YYYY, h:mm:ss a");
file.isImage = file.contentType.includes("image"); file.isImage = file.contentType.includes("image");
file.isVideo = file.contentType.includes("video"); file.isVideo = file.contentType.includes("video");
file.fileUrl = file.fileUrl =