nus-mtp/attack-on-tutor

View on GitHub
models/avatar.js

Summary

Maintainability
A
0 mins
Test Coverage
"use strict";

var models = require('./');

module.exports = function (sequelize, DataTypes) {

    var Avatar = sequelize.define('Avatar', {
        id: {
            type: DataTypes.STRING,
            unique: true,
            primaryKey: true
        },
        name: { type: DataTypes.STRING },
        price: { type: DataTypes.INTEGER },
        url: { type: DataTypes.STRING }
    }, {
        classMethods: {
            associate: function (models) {
                Avatar.belongsToMany(models.User, {
                    through: 'userAvatar'
                });
            }
        }
    });

    return Avatar;

}