diff --git a/src/models/co-benefits/co-benefits.model.js b/src/models/co-benefits/co-benefits.model.js index 70b7da30..c0e3d03b 100644 --- a/src/models/co-benefits/co-benefits.model.js +++ b/src/models/co-benefits/co-benefits.model.js @@ -5,12 +5,7 @@ import { sequelize } from '../database'; import { Project } from '../projects'; class CoBenefit extends Model { - /** - * Helper method for defining associations. - * This method is not a part of Sequelize lifecycle. - * The `models/index` file will call this method automatically. - */ - static associate(models) { + static associate() { CoBenefit.belongsTo(Project); } } diff --git a/src/models/index.js b/src/models/index.js index 5ccef6f4..c128274c 100644 --- a/src/models/index.js +++ b/src/models/index.js @@ -1,3 +1,23 @@ +import { Project } from "./projects"; +import { CoBenefit } from "./co-benefits"; +import { ProjectLocation } from "./locations/index.js"; +import { Qualification } from "./qualifications/index.js"; +import { Rating } from "./ratings/index.js"; +import { RelatedProject } from "./related-projects/index.js"; +import { Staging } from "./staging/index.js"; +import { Unit } from "./units/index.js"; +import { Vintage } from "./vintages/index.js"; + +Project.associate(); +CoBenefit.associate(); +ProjectLocation.associate(); +Qualification.associate(); +Rating.associate(); +RelatedProject.associate(); +Staging.associate(); +Unit.associate(); +Vintage.associate(); + export * from './projects'; export * from './co-benefits'; export * from './locations'; diff --git a/src/models/locations/locations.model.js b/src/models/locations/locations.model.js index 06ddd990..91d802b1 100644 --- a/src/models/locations/locations.model.js +++ b/src/models/locations/locations.model.js @@ -5,12 +5,7 @@ import { sequelize } from '../database'; import { Project } from '../projects'; class ProjectLocation extends Model { - /** - * Helper method for defining associations. - * This method is not a part of Sequelize lifecycle. - * The `models/index` file will call this method automatically. - */ - static associate(models) { + static associate() { ProjectLocation.belongsTo(Project); } } diff --git a/src/models/projects/projects.model.js b/src/models/projects/projects.model.js index 3501502e..6e2a43aa 100644 --- a/src/models/projects/projects.model.js +++ b/src/models/projects/projects.model.js @@ -11,12 +11,7 @@ import { Rating } from './../ratings'; import { CoBenefit } from './../co-benefits'; class Project extends Model { - /** - * Helper method for defining associations. - * This method is not a part of Sequelize lifecycle. - * The `models/index` file will call this method automatically. - */ - static associate(models) { + static associate() { Project.hasMany(RelatedProject); Project.hasMany(Vintage); Project.hasMany(Qualification); diff --git a/src/models/qualifications/qualifications.model.js b/src/models/qualifications/qualifications.model.js index 9513eb28..494d270f 100644 --- a/src/models/qualifications/qualifications.model.js +++ b/src/models/qualifications/qualifications.model.js @@ -6,12 +6,7 @@ import { Project } from '../projects'; import { Unit } from '../units'; class Qualification extends Model { - /** - * Helper method for defining associations. - * This method is not a part of Sequelize lifecycle. - * The `models/index` file will call this method automatically. - */ - static associate(models) { + static associate() { Qualification.belongsTo(Project); Qualification.hasMany(Unit); } diff --git a/src/models/ratings/ratings.model.js b/src/models/ratings/ratings.model.js index aa345c99..06e283d4 100644 --- a/src/models/ratings/ratings.model.js +++ b/src/models/ratings/ratings.model.js @@ -5,12 +5,7 @@ import { sequelize } from '../database'; import { Project } from '../projects/index'; class Rating extends Model { - /** - * Helper method for defining associations. - * This method is not a part of Sequelize lifecycle. - * The `models/index` file will call this method automatically. - */ - static associate(models) { + static associate() { Rating.belongsTo(Project); } } diff --git a/src/models/related-projects/related-projects.model.js b/src/models/related-projects/related-projects.model.js index 3d6c8a8c..45501524 100644 --- a/src/models/related-projects/related-projects.model.js +++ b/src/models/related-projects/related-projects.model.js @@ -6,12 +6,7 @@ import { sequelize } from '../database'; import { Project } from '../projects'; class RelatedProject extends Model { - /** - * Helper method for defining associations. - * This method is not a part of Sequelize lifecycle. - * The `models/index` file will call this method automatically. - */ - static associate(models) { + static associate() { RelatedProject.belongsTo(Project); } } diff --git a/src/models/staging/staging.model.js b/src/models/staging/staging.model.js index 8e2d10f2..0cdd481e 100644 --- a/src/models/staging/staging.model.js +++ b/src/models/staging/staging.model.js @@ -4,12 +4,7 @@ const { Model } = Sequelize; import { sequelize } from '../database'; class Staging extends Model { - /** - * Helper method for defining associations. - * This method is not a part of Sequelize lifecycle. - * The `models/index` file will call this method automatically. - */ - static associate(models) { + static associate() { // define association here } } diff --git a/src/models/units/units.model.js b/src/models/units/units.model.js index b98df6c2..7be70864 100644 --- a/src/models/units/units.model.js +++ b/src/models/units/units.model.js @@ -5,12 +5,7 @@ import { sequelize } from '../database'; import { Project } from '../projects/index'; class Unit extends Model { - /** - * Helper method for defining associations. - * This method is not a part of Sequelize lifecycle. - * The `models/index` file will call this method automatically. - */ - static associate(models) { + static associate() { Unit.belongsTo(Project); } } diff --git a/src/models/vintages/vintages.model.js b/src/models/vintages/vintages.model.js index 43554262..655daad5 100644 --- a/src/models/vintages/vintages.model.js +++ b/src/models/vintages/vintages.model.js @@ -5,12 +5,7 @@ import { sequelize } from '../database'; import { Project } from '../projects/index'; class Vintage extends Model { - /** - * Helper method for defining associations. - * This method is not a part of Sequelize lifecycle. - * The `models/index` file will call this method automatically. - */ - static associate(models) { + static associate() { Vintage.belongsTo(Project); } }