Skip to content

Commit

Permalink
feat: added new tables holiday and leave
Browse files Browse the repository at this point in the history
  • Loading branch information
varijkapil13 committed Jan 16, 2019
1 parent 098bd63 commit 5c9d64d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 73 deletions.
4 changes: 1 addition & 3 deletions server/migrations/20190116075822-create-work-day.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ module.exports = {
type: Sequelize.STRING
},
from: {
allowNull: false,
type: Sequelize.TIME
},
to: {
allowNull: false,
type: Sequelize.TIME
},
logged_hours: {
Expand All @@ -46,4 +44,4 @@ module.exports = {
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('WorkDays');
}
};
};
4 changes: 1 addition & 3 deletions server/migrations/20190116081053-create-holiday.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ module.exports = {
type: Sequelize.STRING
},
from: {
allowNull: false,
type: Sequelize.TIME
},
to: {
allowNull: false,
type: Sequelize.TIME
},
createdAt: {
Expand All @@ -36,4 +34,4 @@ module.exports = {
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('Holidays');
}
};
};
50 changes: 21 additions & 29 deletions server/models/holiday.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
export default (sequelize, DataTypes) => {
const Holiday = sequelize.define('Holiday', {
date: {
type: DataTypes.DATE,
allowNull: {
args: false,
msg: 'Please enter a date'
}
},
notes: DataTypes.STRING,
from: {
type: DataTypes.TIME,
allowNull: {
args: false,
msg: 'Please enter start time'
}
},
to: {
type: DataTypes.TIME,
allowNull: {
args: false,
msg: 'Please enter end time'
}
},
}, {});
Holiday.associate = function (models) {
// associations can be defined here
};
return Holiday;
};
const Holiday = sequelize.define(
'Holiday',
{
date: {
type: DataTypes.DATE,
allowNull: {
args: false,
msg: 'Please enter a date'
}
},
notes: DataTypes.STRING,
from: DataTypes.TIME,
to: DataTypes.TIME
},
{}
);
Holiday.associate = function(models) {
// associations can be defined here
};
return Holiday;
};
68 changes: 30 additions & 38 deletions server/models/workday.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
export default (sequelize, DataTypes) => {
const WorkDay = sequelize.define('WorkDay', {
user_id: {
type: DataTypes.INTEGER,
allowNull: {
args: false,
msg: 'Please enter user\'s name'
}
},
date: {
type: DataTypes.DATE,
allowNull: {
args: false,
msg: 'Please enter a date'
}
},
tags: DataTypes.STRING,
notes: DataTypes.STRING,
from: {
type: DataTypes.TIME,
allowNull: {
args: false,
msg: 'Please enter start time'
}
},
to: {
type: DataTypes.TIME,
allowNull: {
args: false,
msg: 'Please enter end time'
}
},
logged_hours: {type: DataTypes.DOUBLE}
}, {});
WorkDay.associate = function (models) {
// associations can be defined here
};
return WorkDay;
};
const WorkDay = sequelize.define(
'WorkDay',
{
user_id: {
type: DataTypes.INTEGER,
allowNull: {
args: false,
msg: "Please enter user's name"
}
},
date: {
type: DataTypes.DATE,
allowNull: {
args: false,
msg: 'Please enter a date'
}
},
tags: DataTypes.STRING,
notes: DataTypes.STRING,
from: DataTypes.TIME,
to: DataTypes.TIME,
logged_hours: {type: DataTypes.DOUBLE}
},
{}
);
WorkDay.associate = function(models) {
// associations can be defined here
};
return WorkDay;
};

0 comments on commit 5c9d64d

Please sign in to comment.