Comments (5)
can you try with the following
@TreeParent()
@JoinColumn({ name: "parent_category_id" })
parent_category: Relation<ProductCategory> | null
// Typeorm also keeps track of the category's parent at all times.
@Column()
parent_category_id: string | null
@TreeChildren({ cascade: true })
category_children: Relation<ProductCategory>[]
from medusa.
Thank you it worked
from medusa.
Glad to ear :D
from medusa.
You need to redefine the parent category as it rely on product category as well.
from medusa.
Tried both ways below still same issue.
models/product-category.ts
import { Column, Entity, Relation, Tree } from "typeorm"
import {
// alias the core entity to not cause a naming conflict
ProductCategory as MedusaProductCategory,
} from "@medusajs/medusa"
@Entity()
@Tree("materialized-path")
export class ProductCategory extends MedusaProductCategory {
@Column()
is_primary: boolean
parent_category: Relation<ProductCategory> | null;
}
import { Column, Entity, Relation, Tree } from "typeorm"
import {
// alias the core entity to not cause a naming conflict
ProductCategory as MedusaProductCategory,
} from "@medusajs/medusa"
@Entity()
@Tree("materialized-path")
export class ProductCategory extends MedusaProductCategory {
@Column()
is_primary: boolean
@Column({ type: 'character varying', nullable: true })
parent_category: Relation<ProductCategory> | null;
}
from medusa.
Related Issues (20)
- JwtStrategy requires a secret or key HOT 4
- BUG: Could not resolve 'fileModuleService'. HOT 3
- Repo's findAndCount only returns one result HOT 13
- Discount Generator plugin not working
- Error when notifications are triggered HOT 1
- Column deleted_at does not exist on database when fetching with product module
- Error 400 when create new cart
- Price is not calculated correctly after customer logs in HOT 1
- Create Medusa app with nextjs storefront fails with invalid github url error HOT 1
- JS Client returns empty list when searching by Tag Values
- curl /store always returns no matter what cors settings
- Metadata not included with Order query
- Need to create custom module in admin panel
- UI Docs Issue in the title & description of Alert component HOT 2
- Docs(Code Issue): Code Issue in /development/workflows HOT 1
- ProductCategory image cant be set
- Inconsistency in calculation of tax_total on cart versus order HOT 2
- bug: migrations run yet app startup fails with error "Could not resolve module: orderOrderSalesChannelSalesChannelLink" (possibly related to specifying CA root cert) HOT 3
- The customer's in the admin panel is not displaying. HOT 1
- Duplicate Identifier 'id' Error in Generated SDK
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from medusa.