Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [{
- id: 1,
- name: 'route1',
- routes: [{
- id: 1,
- path: '/home'
- }]
- }]
- @Entity()
- export class Role {
- @PrimaryGeneratedColumn()
- public id: number
- ... some other columns
- @ManyToMany(type => Route, route => route.roles)
- public routes: Route[]
- }
- @Entity()
- @Tree('materialized-path')
- export class Route {
- @PrimaryGeneratedColumn()
- public id: number
- @TreeParent()
- public parent: Route
- @TreeChildren({ cascade: true })
- public children: Route[]
- @ManyToMany(type => Role, role => role.routes)
- @JoinTable()
- public roles: Role[]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement