File tree 3 files changed +10
-0
lines changed
express-main-example/src/sequelize/models 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,15 @@ interface InstrumentAttributes {
5
5
id : number ;
6
6
type : string ;
7
7
purchaseDate : Date ;
8
+
9
+ // We need to specify the 'orchestraId' field here,
10
+ // because it will automatically be defined later on
11
+ // when Sequelize applies the associations
8
12
orchestraId : number ;
9
13
}
10
14
15
+ // we can omit the 'id' field, since we aren't required
16
+ // to set it manually when creating a new entry
11
17
interface InstrumentCreationAttributes
12
18
extends Omit < InstrumentAttributes , "id" > { }
13
19
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ interface OrchestraAttributes {
6
6
name : string ;
7
7
}
8
8
9
+ // we can omit the 'id' field, since we aren't required
10
+ // to set it manually when creating a new entry
9
11
interface OrchestraCreationAttributes extends Omit < OrchestraAttributes , "id" > { }
10
12
11
13
export const Orchestra : ModelDefined <
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ interface UserAttributes {
6
6
username : string ;
7
7
}
8
8
9
+ // we can omit the 'id' field, since we aren't required
10
+ // to set it manually when creating a new entry
9
11
interface UserCreationAttributes extends Omit < UserAttributes , "id" > { }
10
12
11
13
export const User : ModelDefined <
You can’t perform that action at this time.
0 commit comments