Skip to content

Feat/product tags v2#313

Closed
Aharshi3614 wants to merge 10 commits into
niharika-mente:mainfrom
Aharshi3614:feat/product-tags-v2
Closed

Feat/product tags v2#313
Aharshi3614 wants to merge 10 commits into
niharika-mente:mainfrom
Aharshi3614:feat/product-tags-v2

Conversation

@Aharshi3614

@Aharshi3614 Aharshi3614 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Added product tags feature:

  • Backend: tags field in product schema
  • Frontend: tags display and input with validation
  • Max 5 tags per product, 2-30 chars each

Closes #258

@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

@Aharshi3614 is attempting to deploy a commit to the niharika-mente's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Aamod-Dev Aamod-Dev added sssoc 36 enhancement New feature or request backend For changes related to the Express server, API routes, or MongoDB models frontend For any changes in the React UI, components, or Vite setup Medium labels Jun 20, 2026

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff has severe code structure issues that will break the application:

  1. Duplicate function exports: updateProduct, deleteProduct, and searchProducts are exported twice with conflicting implementations.
  2. Corrupted code structure: Function bodies are split across sections. JS will throw SyntaxError for duplicate declarations.
  3. Model fields after export default: New tags field added to schema but existing fields appear after export default Product, making them unreachable.

Fix: Rebase on main, ensure only one copy of each exported function, verify with
ode --check.

@Aharshi3614 Aharshi3614 force-pushed the feat/product-tags-v2 branch from d86ff19 to c6232e2 Compare June 20, 2026 04:36

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request Changes

Corrupted merge — two updateProduct and two searchProducts declarations. First updateProduct references product before its definition. deleteProduct re-exported as hard-delete after soft-delete exists. product.model.js has mongoose.model(...) and export default inserted mid-schema before schema is complete. Needs a clean rebase.

@Aamod-Dev

Copy link
Copy Markdown
Collaborator

Corrupted merge, needs clean rebase

@Aamod-Dev Aamod-Dev closed this Jun 20, 2026
@Aamod-Dev Aamod-Dev reopened this Jun 20, 2026

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed the latest changes pushed to this PR.

Backend Issues

Corrupted Code Structure (BACKEND/models/product.model.js)

  • Severity: Critical. The issue's severity is absolute as the server will fail to start in any environment.
  • Issue: The schema definition is duplicated and structurally corrupted. The first model definition correctly ends and exports on line 53 (export default Product;). Immediately following the export, schema fields (like description: { ... }) are written directly into the global scope. This results in an immediate SyntaxError upon compilation.

Corrupted Code Structure (BACKEND/controllers/product.controller.js)

  • Severity: Critical. The issue's severity is absolute as the server will fail to start in any environment.
  • Issue: The file contains severe structural corruption, likely from a broken merge. It includes:
    • Duplicate declarations for updateProduct and searchProducts.
    • Unclosed try blocks (e.g., at line 177) that lack closing braces or catch blocks.
    • export statements nested inside other function bodies (e.g., getProductById is nested inside searchProducts).
    • Missing function bodies (e.g., deleteProduct is declared but immediately followed by another function declaration getProductBundle).

ReferenceError in updateProduct (BACKEND/controllers/product.controller.js)

  • Severity: High. If the syntax errors are resolved, this bug will arise whenever a user attempts to update a product, leading to a crash on this endpoint.
  • Issue: At line 162, the code references product.name, product.price, and product.image, but the product variable is never defined or extracted from req.body or the database. new Product(product) is subsequently called with this undefined variable.

Frontend Issues

Tags Limit Ignored (FRONTEND/src/pages/CreatePage.jsx)

  • Severity: Medium. When a user creates a product and inputs more than 5 tags, the frontend will fail to restrict the tag count. This may lead to unexpected backend validation errors if the backend correctly enforces the 5-tag limit.
  • Issue: In the tags input onChange handler, setNewProduct is called twice consecutively:
    setNewProduct({ ...newProduct, tags: tagsArray.slice(0, 5) });
    setNewProduct({ ...newProduct, tags: tagsArray });
    The second call completely overwrites the first, rendering the tagsArray.slice(0, 5) truncation logic ineffective.

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, approved!

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs changes: There are merge conflicts. Please resolve them.

@Aamod-Dev Aamod-Dev removed the Medium label Jun 22, 2026
@Aamod-Dev

Copy link
Copy Markdown
Collaborator

Closing in favor of clean replacement PR with only product-tags changes, extracted from corrupted merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend For changes related to the Express server, API routes, or MongoDB models enhancement New feature or request frontend For any changes in the React UI, components, or Vite setup Hard SSoC26

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add Product Tags for Better Search and Filtering

2 participants