S3 : add news

This commit is contained in:
2026-06-19 12:11:18 +03:30
parent 1c40eb958b
commit 99a9f9ace5
11 changed files with 1002 additions and 247 deletions
+4 -2
View File
@@ -1,9 +1,11 @@
const mongoose = require('mongoose');
const mongoosePaginate = require('mongoose-paginate-v2');
const s3Storage = require('../plugins/s3Storage');
function image(img) {
if (img) return '/uploads/images/news/' + img
else return '/img/no-cover.jpg'
if (!img) return '/img/no-cover.jpg';
if (img.startsWith('http://') || img.startsWith('https://')) return img;
return s3Storage.getPublicUrl(`uploads/images/news/${img}`);
}
function file(file) {