Skip to content

[FIX] - Product Created Without Category and Variant #1250

@BigLens

Description

@BigLens

Bug Description

When a product is created, the product category and product variant entities exist in the system but are not linked to the product. This happens because the Many-to-One relationship between Product → ProductCategory and Product → ProductVariant is missing. As a result, products are created without any associated category or variant, leading to data inconsistency.

Steps to Reproduce

  1. Create a new product via the API or UI.
  2. Check the product details in the database or API response.
  3. Observe that the product is created successfully.
  4. Check the ProductCategory and ProductVariant tables – they exist but are not linked to the product.

Expected Behavior

A product should always have an associated category and variant.
The Many-to-One relationship should ensure that a product is correctly linked to its category and variant.
The system should prevent creating a product if it is not associated with a category and variant.

Current Behavior

The product is created, but its category and variant are not attached.
The category and variant exist as standalone entities with no relationship to the product.
The missing relation causes data inconsistencies and affects filtering, retrieval, and product management.

Possible Solution

Define proper Many-To-One relationships between Product, ProductCategory, and ProductVariant in the ORM..
Modify the product creation logic to require a category and variant when creating a new product.

Additional Context

This issue affects data integrity and product filtering functionalities.

Metadata

Metadata

Assignees

Labels

In-progressThis issue is being worked onbugSomething isn't working

Type

No type

Projects

Status

Mentors Approved

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions