add file name

master
shoaibalmasi 4 years ago
parent c6b0168757
commit 6992ab47b4
  1. 15
      migrations/20210315204118-change-codeMelli-type.js
  2. 18
      migrations/20210315204918-add-filename-column.js
  3. 10
      models/user.js
  4. 4
      services/user.js

@ -0,0 +1,15 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return Promise.all([
queryInterface.changeColumn('Users', 'codeMelli', {
type: Sequelize.BIGINT ,
}),
]);
},
down: (queryInterface) => {
return Promise.all([queryInterface.changeColumn('Users', 'codeMelli')]);
},
};

@ -0,0 +1,18 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return Promise.all([
queryInterface.addColumn('Users', 'fileName', {
type: Sequelize.STRING,
allowNull: false,
defaultValue: 'Hform4.docx'
}),
]);
},
down: (queryInterface) => {
return Promise.all([queryInterface.removeColumn('Users', 'fileName')]);
},
};

@ -17,7 +17,7 @@ module.exports = (sequelize, DataTypes) => {
firstName: DataTypes.STRING, firstName: DataTypes.STRING,
lastName: DataTypes.STRING, lastName: DataTypes.STRING,
fatherName: DataTypes.STRING, fatherName: DataTypes.STRING,
codeMelli: DataTypes.INTEGER, codeMelli: DataTypes.BIGINT,
workUnit: DataTypes.STRING, workUnit: DataTypes.STRING,
workUnitCode: DataTypes.INTEGER, workUnitCode: DataTypes.INTEGER,
address: DataTypes.TEXT, address: DataTypes.TEXT,
@ -27,7 +27,13 @@ module.exports = (sequelize, DataTypes) => {
requestDate: DataTypes.DATE, requestDate: DataTypes.DATE,
writtenOrderNumber: DataTypes.INTEGER, writtenOrderNumber: DataTypes.INTEGER,
writtenOrderDate: DataTypes.DATE, writtenOrderDate: DataTypes.DATE,
deadline: DataTypes.INTEGER deadline: DataTypes.INTEGER,
fileName:{
type: DataTypes.STRING,
allowNull: false,
defaultValue: 'Hform4.docx'
}
}, { }, {
sequelize, sequelize,
modelName: 'User', modelName: 'User',

@ -61,11 +61,11 @@ methods.completeForm =(userId)=>{
userInfo.requestDate = jalali( user.requestDate, 'YYYY/MM/DD').locale('fa').format('YYYY/MM/DD') userInfo.requestDate = jalali( user.requestDate, 'YYYY/MM/DD').locale('fa').format('YYYY/MM/DD')
userInfo.writtenOrderDate = jalali( user.writtenOrderDate, 'YYYY/MM/DD').locale('fa').format('YYYY/MM/DD') userInfo.writtenOrderDate = jalali( user.writtenOrderDate, 'YYYY/MM/DD').locale('fa').format('YYYY/MM/DD')
return docxTemp(userInfo, 'Hform4.docx') return docxTemp(userInfo, userInfo.fileName)
}).then(link=>{ }).then(link=>{
resolve(link) resolve(link)
}).catch(err => { }).catch(err => {
if (err.eText) { if (err.eText) {
if (typeof (err.eText) !== 'string') { if (typeof (err.eText) !== 'string') {

Loading…
Cancel
Save