diff --git a/express-main-example/src/sequelize/models/instrument.model.ts b/express-main-example/src/sequelize/models/instrument.model.ts index 29e7bf6..d654add 100644 --- a/express-main-example/src/sequelize/models/instrument.model.ts +++ b/express-main-example/src/sequelize/models/instrument.model.ts @@ -5,9 +5,15 @@ interface InstrumentAttributes { id: number; type: string; purchaseDate: Date; + + // We need to specify the 'orchestraId' field here, + // because it will automatically be defined later on + // when Sequelize applies the associations orchestraId: number; } +// we can omit the 'id' field, since we aren't required +// to set it manually when creating a new entry interface InstrumentCreationAttributes extends Omit {} diff --git a/express-main-example/src/sequelize/models/orchestra.model.ts b/express-main-example/src/sequelize/models/orchestra.model.ts index 9d41fe0..f3316e1 100644 --- a/express-main-example/src/sequelize/models/orchestra.model.ts +++ b/express-main-example/src/sequelize/models/orchestra.model.ts @@ -6,6 +6,8 @@ interface OrchestraAttributes { name: string; } +// we can omit the 'id' field, since we aren't required +// to set it manually when creating a new entry interface OrchestraCreationAttributes extends Omit {} export const Orchestra: ModelDefined< diff --git a/express-main-example/src/sequelize/models/user.model.ts b/express-main-example/src/sequelize/models/user.model.ts index 58d1409..7150222 100644 --- a/express-main-example/src/sequelize/models/user.model.ts +++ b/express-main-example/src/sequelize/models/user.model.ts @@ -6,6 +6,8 @@ interface UserAttributes { username: string; } +// we can omit the 'id' field, since we aren't required +// to set it manually when creating a new entry interface UserCreationAttributes extends Omit {} export const User: ModelDefined<