{"size": 556, "ext": "js", "max_stars_repo_path": "__backend__v2/src/app/models/Movie.js", "max_stars_repo_name": "JoanPedro/AngularSQL-Teste", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "__backend__v2/src/app/models/Movie.js", "max_issues_repo_name": "JoanPedro/AngularSQL-Teste", "max_issues_repo_issues_event_min_datetime": "2021-05-11T15:31:12.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T05:35:36.000Z", "max_forks_repo_path": "__backend__v2/src/app/models/Movie.js", "max_forks_repo_name": "JoanPedro/AngularSQL-Teste", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 18.5333333333, "max_line_length": 69, "alphanum_fraction": 0.5665467626}
import Sequelize, { Model } from 'sequelize';

class Movie extends Model {
  static init(sequelize) {
    super.init(
      {
        name: Sequelize.STRING,
        sinopse: Sequelize.STRING,
        deleted_at: Sequelize.DATE,
      },
      {
        sequelize,
      }
    );

    return this;
  }

  static associate(models) {

    this.belongsTo(models.File, { foreignKey: 'img_id', as: 'img' });
    this.belongsToMany(models.Actor, { 
      through: 'pivot',
      as: 'actors',
      foreignKey: 'movie_id',    
    })
  }
}

export default Movie;