mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-24 15:38:10 +02:00
feat: implement user authentication and management routes with multer file upload support
This commit is contained in:
1 parent
0eca57efab
commit
3122e162cc
2 files changed
+6
-23
No files matched your search
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"permissions": {
|
"permissions": {
|
||||||
"allow": [
|
"allow": [
|
||||||
"WebFetch(domain:pixabay.com)"
|
"WebFetch(domain:pixabay.com)",
|
||||||
|
"Bash(find /c/GIT/Socialflow/migrations -name \"*.sql\" -exec wc -l {} +)",
|
||||||
|
"Bash(xargs ls:*)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-22
@@ -609,18 +609,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
const user = req.user as User;
|
const user = req.user as User;
|
||||||
const userId = user.id;
|
const userId = user.id;
|
||||||
|
|
||||||
// Check if Cloudinary is configured (shared config used for all users)
|
// Upload using file path (streamed from disk)
|
||||||
const cloudinaryConfig = await storage.getCloudinaryConfig();
|
|
||||||
|
|
||||||
if (!cloudinaryConfig) {
|
|
||||||
// Nettoyer le fichier temporaire
|
|
||||||
await fs.promises.unlink(req.file.path).catch(console.error);
|
|
||||||
return res.status(400).json({
|
|
||||||
error: "Cloudinary not configured. Please ask an administrator to configure Cloudinary in Settings first."
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Upload to Cloudinary using file path (streamed from disk)
|
|
||||||
// req.file.path est disponible avec DiskStorage
|
// req.file.path est disponible avec DiskStorage
|
||||||
const uploadResult = await cloudinaryService.uploadMedia(
|
const uploadResult = await cloudinaryService.uploadMedia(
|
||||||
req.file.path,
|
req.file.path,
|
||||||
@@ -940,17 +929,9 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
// Convert to buffer
|
// Convert to buffer
|
||||||
const outputBuffer = await image.jpeg({ quality: 95 }).toBuffer();
|
const outputBuffer = await image.jpeg({ quality: 95 }).toBuffer();
|
||||||
|
|
||||||
console.log("✅ Overlays applied, uploading to Cloudinary...");
|
console.log("✅ Overlays applied, uploading to local storage...");
|
||||||
|
|
||||||
// Check if Cloudinary is configured (shared config used for all users)
|
// Upload to local storage
|
||||||
const cloudinaryConfig = await storage.getCloudinaryConfig();
|
|
||||||
if (!cloudinaryConfig) {
|
|
||||||
return res.status(400).json({
|
|
||||||
error: "Cloudinary not configured. Please ask an administrator to configure Cloudinary in Settings first."
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Upload to Cloudinary (service will use shared config internally)
|
|
||||||
const uploadResult = await cloudinaryService.uploadMedia(
|
const uploadResult = await cloudinaryService.uploadMedia(
|
||||||
outputBuffer,
|
outputBuffer,
|
||||||
`edited_${Date.now()}.jpg`,
|
`edited_${Date.now()}.jpg`,
|
||||||
|
|||||||
Reference in new issue
Block a user