// See https://sequelize.org/master/manual/model-basics.html // for more of what you can do here. import { Sequelize, DataTypes, Model } from 'sequelize'; import { Application } from '../declarations'; import { HookReturn } from 'sequelize/types/hooks'; export default function (app: Application): typeof Model { const sequelizeClient: Sequelize = app.get('sequelizeClient'); const <%= camelName %> = sequelizeClient.define('<%= snakeName %>', { <% if(authentication.strategies.indexOf('local') !== -1) { %> email: { type: DataTypes.STRING, allowNull: false, unique: true }, password: { type: DataTypes.STRING, allowNull: false }, <% } %> <% authentication.oauthProviders.forEach(provider => { %> <%= provider %>Id: { type: DataTypes.STRING }, <% }); %> }, { hooks: { beforeCount(options: any): HookReturn { options.raw = true; } } }); // eslint-disable-next-line @typescript-eslint/no-unused-vars (<%= camelName %> as any).associate = function (models: any): void { // Define associations here // See https://sequelize.org/master/manual/assocs.html }; return <%= camelName %>; }