Skip to content

Comments

feat: add support for association methods#59

Open
jsindos wants to merge 10 commits intospinlud:masterfrom
jsindos:feat/associations
Open

feat: add support for association methods#59
jsindos wants to merge 10 commits intospinlud:masterfrom
jsindos:feat/associations

Conversation

@jsindos
Copy link

@jsindos jsindos commented Oct 30, 2024

This PR adds support for sequelize association methods, as per

For example, when providing the association csv, we will also get the following properties added (from the person <-> passport test data):

    declare getPassport: HasOneGetAssociationMixin<passport>;

    declare setPassport: HasOneSetAssociationMixin<passport, number>;

    declare createPassport: HasOneCreateAssociationMixin<passport>;

Note the following hasn't been added / run:

  • linting
    • I ran npm run lint but get the following output, wondering if I can get some help on how to run automatic eslint fix on my changes using the project configuration
> sequelize-typescript-generator@11.0.8 lint
> eslint --fix --ext .ts output/*.ts


Oops! Something went wrong! :(

ESLint: 8.57.0

No files matching the pattern "output/*.ts" were found.
Please check for typing mistakes in the pattern.
  • tests

    • I can run the tests and they all pass, but wasn't sure where to add testing for the new functionality. I looked into it('1:1', async () => { but it seems these tests are on the Sequelize models themselves, rather than the generated types.
  • import statements

    • The import statements for the new Mixins are always added, should these instead be added conditionally or will linting clean this up automatically?

@jsindos
Copy link
Author

jsindos commented Oct 30, 2024

It seems it also breaks when supplying -C arg

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant