不要怂,就是干,撸起袖子干!

Commit 72925cf7 by Marquitos Committed by GitHub

fix: add missing fields to 'FindOrCreateType' (#12338)

1 parent f3671912
Showing with 20 additions and 8 deletions
......@@ -685,12 +685,11 @@ export interface Hookable {
/**
* Options for Model.findOrCreate method
*/
export interface FindOrCreateOptions extends Logging, Transactionable {
export interface FindOrCreateOptions extends Filterable, Logging, Transactionable {
/**
* A hash of search attributes.
* The fields to insert / update. Defaults to all fields
*/
where: WhereOptions;
fields?: string[];
/**
* Default values to use if building a new instance
*/
......
......@@ -99,6 +99,20 @@ UserModel.findCreateFind({
})
/**
* Tests for findOrCreate() type.
*/
UserModel.findOrCreate({
fields: [ "jane.doe" ],
where: {
username: "jane.doe"
},
defaults: {
username: "jane.doe"
}
})
/**
* Test for primaryKeyAttributes.
*/
class TestModel extends Model {};
......@@ -116,12 +130,12 @@ someInstance.getOthers({
joinTableAttributes: { include: [ 'id' ] }
})
/**
/**
* Test for through options in creating a BelongsToMany association
*/
class Film extends Model {}
class Actor extends Model {}
class Actor extends Model {}
Film.belongsToMany(Actor, {
through: {
......@@ -135,4 +149,4 @@ Actor.belongsToMany(Film, {
model: 'FilmActors',
paranoid: true
}
})
\ No newline at end of file
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!