{"size": 847, "ext": "js", "max_stars_repo_path": "server/src/app/models/FinancialBox.js", "max_stars_repo_name": "Henrique-Hoi-Dev/rickotech-", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "server/src/app/models/FinancialBox.js", "max_issues_repo_name": "Henrique-Hoi-Dev/rickotech-", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "server/src/app/models/FinancialBox.js", "max_forks_repo_name": "Henrique-Hoi-Dev/rickotech-", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.3225806452, "max_line_length": 80, "alphanum_fraction": 0.6351829988}
import Sequelize, { Model } from 'sequelize';

class FinancialBox extends Model {
  static init(sequelize) {
    super.init(
      {
        user_id: Sequelize.INTEGER,
        open_caixa: Sequelize.DATEONLY,
        close_caixa: Sequelize.DATEONLY,
        status: Sequelize.BOOLEAN,
        value_open: Sequelize.DOUBLE,
        value_total_sales: Sequelize.DOUBLE,
        value_total_service: Sequelize.DOUBLE,
        value_total: Sequelize.DOUBLE,
      },
      {
        sequelize,
        timestamps: true,
      }
    );
    return this;
  }
  static associate(models) {
    this.belongsTo(models.User, { foreignKey: 'user_id', as: 'user' });
    this.hasMany(models.Order, { foreignKey: 'financial_id', as: 'order' });
    this.hasMany(models.Service, { foreignKey: 'financial_id', as: 'service' });
  }
}

export default FinancialBox;
