Created
March 29, 2019 14:07
-
-
Save Rowadz/1cb84aafe76060fc6632062d06eb9b78 to your computer and use it in GitHub Desktop.
a gist for https://medium.com/@mohammedalrowad/painless-file-upload-using-feathersjs-services-e994e4734e0c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Sequelize = require('sequelize'); | |
| const DataTypes = Sequelize.DataTypes; | |
| module.exports = function (app) { | |
| const sequelizeClient = app.get('sequelizeClient'); | |
| const uploads = sequelizeClient.define('uploads', { | |
| description: { | |
| type: DataTypes.TEXT, | |
| allowNull: false | |
| }, | |
| orignalName: { | |
| type: DataTypes.STRING, | |
| allowNull: false | |
| }, | |
| newNameWithPath: { | |
| type: DataTypes.STRING, | |
| allowNull: false | |
| } | |
| }, { | |
| hooks: { | |
| beforeCount(options) { | |
| options.raw = true; | |
| } | |
| } | |
| }); | |
| uploads.associate = function (models) { | |
| const { | |
| users | |
| } = models; | |
| uploads.belongsTo(users); | |
| }; | |
| return uploads; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment