S3 for other controolers

This commit is contained in:
2026-06-19 15:47:02 +03:30
parent c73027540a
commit e95883eb6a
32 changed files with 1073 additions and 650 deletions
+4 -1
View File
@@ -1,7 +1,10 @@
const mongoose = require('mongoose');
const s3Storage = require('../plugins/s3Storage');
function image(img) {
if (img) return '/uploads/images/links/' + img
if (!img) return null;
if (img.startsWith('http://') || img.startsWith('https://')) return img;
return s3Storage.getPublicUrl(`uploads/images/links/${img}`);
}
const LinksSchema = mongoose.Schema({