Fixed a lot of stuff

This commit is contained in:
2025-11-03 13:39:34 -06:00
parent b4edcd8da6
commit 3a7e0bba3c
6 changed files with 42 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
import {Router} from 'express';
import { createCommunity, getCommunityById, getAllCommunities, deleteCommunity, editCommunity } from '../functions/communityFunctions.js';
import { createNewCommunity, getCommunityById, getAllCommunities, deleteCommunity, editCommunity } from '../functions/communityFunctions.js';
const router = Router();
// Validate create community payload
@@ -11,8 +11,10 @@ const validateCommunityPayload = (req, res, next) => {
next();
};
router.post('/', validateCommunityPayload, createCommunity);
router.post('/', validateCommunityPayload, createNewCommunity);
router.get('/', getAllCommunities);
router.get('/:id_comunidad', getCommunityById);
router.put('/:id_comunidad', validateCommunityPayload, editCommunity);
router.delete('/:id_comunidad', deleteCommunity);
router.delete('/:id_comunidad', deleteCommunity);
export default router;

View File

@@ -1,4 +1,10 @@
import { Router } from "express";
import path from 'path';
import multer from 'multer';
import fs from 'fs/promises';
import sharp from 'sharp';
import crypto from 'crypto';
import { fileTypeFromBuffer } from 'file-type';
import { createNewOffer, getOfferById, deleteOffer, getAllOffers, getOffersByUserId, editOffer } from "../functions/offerFunctions.js";
const router = Router();
@@ -78,4 +84,6 @@ router.get('/', getAllOffers);
router.get('/:id_oferta', getOfferById);
router.put('/:id_oferta', upload.single('imagen'), validateOfferPayload, processUploadedImage, editOffer);
router.delete('/:id_oferta', deleteOffer);
router.get('/user/:id_usuario', getOffersByUserId);
router.get('/user/:id_usuario', getOffersByUserId);
export default router;