diff --git a/backend/models/Item.js b/backend/models/Item.js index 5203194..822670e 100644 --- a/backend/models/Item.js +++ b/backend/models/Item.js @@ -15,10 +15,6 @@ const Item = sequelize.define('Item', { type: DataTypes.TEXT, allowNull: false }, - tags: { - type: DataTypes.ARRAY(DataTypes.STRING), - defaultValue: [] - }, pickUpAvailable: { type: DataTypes.BOOLEAN, allowNull: false, diff --git a/backend/routes/items.js b/backend/routes/items.js index de6c372..1fdba04 100644 --- a/backend/routes/items.js +++ b/backend/routes/items.js @@ -7,7 +7,6 @@ const router = express.Router(); router.get('/', async (req, res) => { try { const { - tags, isPortable, minPrice, maxPrice, @@ -19,10 +18,6 @@ router.get('/', async (req, res) => { const where = {}; - if (tags) { - const tagsArray = Array.isArray(tags) ? tags : [tags]; - where.tags = { [Op.overlap]: tagsArray }; - } if (isPortable !== undefined) where.isPortable = isPortable === 'true'; if (minPrice || maxPrice) { where.pricePerDay = {}; @@ -65,14 +60,9 @@ router.get('/recommendations', authenticateToken, async (req, res) => { include: [{ model: Item, as: 'item' }] }); - const rentedTags = userRentals.reduce((tags, rental) => { - return [...tags, ...(rental.item.tags || [])]; - }, []); - const uniqueTags = [...new Set(rentedTags)]; - + // For now, just return random available items as recommendations const recommendations = await Item.findAll({ where: { - tags: { [Op.overlap]: uniqueTags }, availability: true }, limit: 10, diff --git a/frontend/src/pages/CreateItem.tsx b/frontend/src/pages/CreateItem.tsx index 9835d6c..081a7d5 100644 --- a/frontend/src/pages/CreateItem.tsx +++ b/frontend/src/pages/CreateItem.tsx @@ -7,7 +7,6 @@ import AvailabilityCalendar from "../components/AvailabilityCalendar"; interface ItemFormData { name: string; description: string; - tags: string[]; pickUpAvailable: boolean; localDeliveryAvailable: boolean; localDeliveryRadius?: number; @@ -45,7 +44,6 @@ const CreateItem: React.FC = () => { const [formData, setFormData] = useState({ name: "", description: "", - tags: [], pickUpAvailable: false, localDeliveryAvailable: false, localDeliveryRadius: 25, @@ -64,7 +62,6 @@ const CreateItem: React.FC = () => { needsTraining: false, unavailablePeriods: [], }); - const [tagInput, setTagInput] = useState(""); const [imageFiles, setImageFiles] = useState([]); const [imagePreviews, setImagePreviews] = useState([]); const [priceType, setPriceType] = useState<"hour" | "day">("day"); @@ -91,10 +88,10 @@ const CreateItem: React.FC = () => { formData.city, formData.state, formData.zipCode, - formData.country - ].filter(part => part && part.trim()); - - const location = locationParts.join(', '); + formData.country, + ].filter((part) => part && part.trim()); + + const location = locationParts.join(", "); const response = await api.post("/items", { ...formData, @@ -129,23 +126,6 @@ const CreateItem: React.FC = () => { } }; - const addTag = () => { - if (tagInput.trim() && !formData.tags.includes(tagInput.trim())) { - setFormData((prev) => ({ - ...prev, - tags: [...prev.tags, tagInput.trim()], - })); - setTagInput(""); - } - }; - - const removeTag = (tag: string) => { - setFormData((prev) => ({ - ...prev, - tags: prev.tags.filter((t) => t !== tag), - })); - }; - const handleImageChange = (e: React.ChangeEvent) => { const files = Array.from(e.target.files || []); @@ -186,429 +166,430 @@ const CreateItem: React.FC = () => { )}
-
- - = 5} - /> -
- Upload up to 5 images of your item -
+ {/* Images Card */} +
+
+
+ + = 5} + /> +
+ Upload up to 5 images of your item +
+
- {imagePreviews.length > 0 && ( -
- {imagePreviews.map((preview, index) => ( -
-
- {`Preview - + {imagePreviews.length > 0 && ( +
+ {imagePreviews.map((preview, index) => ( +
+
+ {`Preview + +
+
+ ))} +
+ )} +
+
+ + {/* Basic Information Card */} +
+
+
+ + +
+ +
+ +