fremail / sequelize-nested-set

Library to store and manage nested set trees using Sequelize
MIT License
39 stars 10 forks source link

how to use for sequelize-typescript? #21

Closed SolidZORO closed 3 years ago

SolidZORO commented 3 years ago

sequelize-typescript https://github.com/RobinBuschmann/sequelize-typescript

fremail commented 3 years ago

@SolidZORO thank you for the question, but I don't know because I see sequelize-typescript first time :) If you have ideas, please feel free to post them here and do a PR.

SolidZORO commented 3 years ago

Hi, I'm also trying now, and I'll update here or PR if I have results.

SolidZORO commented 3 years ago

e.g. Nest.js + sequelize-typescript

// category.service.ts

import nestedSet from 'sequelize-nested-set';

@Injectable()
export class CategoryService {
  constructor(
    @InjectModel(Category) private readonly categoryRepo: typeof Category,
    @InjectConnection() private sequelizeConnection: any,
  ) {
    this.categoryRepo = nestedSet(this.categoryRepo, this.sequelizeConnection);
  }
}

After completing it I found that I couldn't recursively classify it. https://github.com/fremail/sequelize-nested-set/issues/13 Just gave up using it. 😭