|
@@ -256,12 +256,11 @@ const audioMessage = async (req, res, next) => {
|
|
|
const isChat = await ChatModel.getByField(id, userId);
|
|
|
const isCompanionChat = await ChatModel.getByField(userId, id);
|
|
|
const originalName = req.file.originalname;
|
|
|
- const fileName = req.file.fileName;
|
|
|
const newNameAudio = `${Math.round(Date.now() / 1000)}${originalName}`;
|
|
|
const fullType = req.file.mimetype;
|
|
|
await createFolderIsExist(path.join(DIR_IMAGES, userId));
|
|
|
await fs.rename(
|
|
|
- path.join(DIR_UPLOAD, fileName),
|
|
|
+ path.join(DIR_UPLOAD, originalName),
|
|
|
path.join(DIR_IMAGES, userId, newNameAudio)
|
|
|
);
|
|
|
const audioUrl = path.normalize(path.join(userId, newNameAudio));
|