Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions migrations/20190604_project_estimation_add_quantity.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--
-- UPDATE EXISTING TABLES:
-- project_estimations:
-- added column `quantity`

--
-- product_templates

-- Add new column
ALTER TABLE project_estimations ADD COLUMN "quantity" int DEFAULT 1;
1 change: 1 addition & 0 deletions src/models/projectEstimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = function defineProjectHistory(sequelize, DataTypes) {
buildingBlockKey: { type: DataTypes.STRING, allowNull: false },
conditions: { type: DataTypes.STRING, allowNull: false },
price: { type: DataTypes.DOUBLE, allowNull: false },
quantity: { type: DataTypes.INTEGER, allowNull: true },
minTime: { type: DataTypes.INTEGER, allowNull: false },
maxTime: { type: DataTypes.INTEGER, allowNull: false },
metadata: { type: DataTypes.JSON, allowNull: false, defaultValue: {} },
Expand Down
1 change: 1 addition & 0 deletions src/routes/projects/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const createProjectValdiations = {
estimation: Joi.array().items(Joi.object().keys({
conditions: Joi.string().required(),
price: Joi.number().required(),
quantity: Joi.number().optional(),
minTime: Joi.number().integer().required(),
maxTime: Joi.number().integer().required(),
buildingBlockKey: Joi.string().required(),
Expand Down