-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Options param in SequelizeRepository create methods issue #10278
Comments
I tested this one and it looks like you can pass an array of strings for the field names: const result = await this.certificatesRepository.create(
certificate,
{
fields: [ "a", "b", "c" ]
}
); The loopback-style syntax would require the "fields" to be remapped here: loopback-next/extensions/sequelize/src/sequelize/sequelize.repository.base.ts Lines 170 to 176 in 56201c5
For example (note that the existing buildSequelizeAttributeFilter has a Typescript interface conflict with the async create(entity: DataObject<T>, options?: AnyObject): Promise<T> {
const data = await this.sequelizeModel.create(
entity as MakeNullishOptional<T>,
{
...options,
fields: this.buildSequelizeAttributeFilter(options?.fields),
},
);
return new this.entityClass(data.toJSON()) as T;
} |
I believe that |
Describe the bug
options = {
fields: {
privateKey: false,
publicKey: false,
},
};
const result = await this.certificatesRepository.create(
certificate,
this.options,
);
when we pass this.option param in create method getting error options.attributes.map is not a function. But working for findById.
Logs
Additional information
No response
Reproduction
provided information is enough to understand the problem.
The text was updated successfully, but these errors were encountered: