Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor type definitions to export SequelizeBone, complete spell type definitions and fix index hints logic #337

Merged
merged 3 commits into from
Aug 30, 2022

Conversation

JimmyDaddy
Copy link
Collaborator

@JimmyDaddy JimmyDaddy commented Aug 27, 2022

  • refactor type definitions to export SequelizeBone for sequelize adaptor
  • complete spell and hints definitions, fix hints logic
  • virtual column should not be added to unset in case of custom getter cannot be serialize
class User {
 @Column()
 id: bigint;
 
 // custom will be ignored when toObject()/toJSON() execute, so make it a VIRTUAL column
 get custom(): string {
    return 'v';
 }
}

@JimmyDaddy JimmyDaddy force-pushed the refactor/type_define_sequelize_adaptor branch from 9220259 to 41b94d6 Compare August 28, 2022 12:35
const { columnName } = attributes[name];
if (!(columnName in row)) {
const attribute = attributes[name];
if (!(attribute.columnName in row) && !attribute.virtual) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

virtual column should not be added to unset in case of custom getter cannot be serialize

class User {
 @Column()
 id: bigint;
 
 // custom will be ignored when toObject()/toJSON() execute, so make it a VIRTUAL column
 get custom(): string {
    return 'v';
 }
}

@@ -37,7 +37,7 @@ function findType(tsType) {
}
}

export function Column(options?: ColumnOption | DATA_TYPE<DataType>) {
export function Column(options?: ColumnOption | DATA_TYPE<DataType> | DataType) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class User {
 // types invokable should work
 @Column(DataTypes.STRING(12))
 id: bigint;
}

src/types/bone.d.ts Outdated Show resolved Hide resolved
src/types/bone.d.ts Outdated Show resolved Hide resolved
@cyjake cyjake merged commit 44a1f39 into master Aug 30, 2022
@cyjake cyjake deleted the refactor/type_define_sequelize_adaptor branch August 30, 2022 05:55
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.

2 participants