-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4934 from NMDSdevopsServiceAdm/test
Test into live: Workplace Details workflow amendments, Bulk Upload Workplace refactor, Benchmarks view table
- Loading branch information
Showing
88 changed files
with
4,489 additions
and
2,195 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable( | ||
'BenchmarksViewed', | ||
{ | ||
ID: { | ||
type: Sequelize.INTEGER, | ||
primaryKey: true, | ||
autoIncrement: true, | ||
}, | ||
EstablishmentID: { | ||
type: Sequelize.DataTypes.INTEGER, | ||
allowNull: false, | ||
references: { | ||
model: { | ||
tableName: 'Establishment', | ||
schema: 'cqc', | ||
}, | ||
key: 'EstablishmentID', | ||
}, | ||
}, | ||
ViewedTime: { | ||
type: Sequelize.DataTypes.DATE, | ||
allowNull: false, | ||
}, | ||
}, | ||
{ schema: 'cqc' }, | ||
); | ||
}, | ||
|
||
down: (queryInterface) => { | ||
return queryInterface.dropTable({ | ||
tableName: 'BenchmarksViewed', | ||
schema: 'cqc', | ||
}); | ||
}, | ||
}; |
216 changes: 108 additions & 108 deletions
216
...r/models/BulkImport/csv/establishments.js → ...s/BulkImport/csv/workplaceCSVValidator.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module.exports = function (sequelize, DataTypes) { | ||
const BenchmarksViewed = sequelize.define( | ||
'benchmarksViewed', | ||
{ | ||
ID: { | ||
type: DataTypes.INTEGER, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
}, | ||
EstablishmentID: { | ||
type: DataTypes.INTEGER, | ||
allowNull: false, | ||
primaryKey: true, | ||
}, | ||
ViewedTime: { | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
primaryKey: true, | ||
}, | ||
}, | ||
{ | ||
tableName: 'BenchmarksViewed', | ||
schema: 'cqc', | ||
createdAt: false, | ||
updatedAt: false, | ||
}, | ||
); | ||
|
||
BenchmarksViewed.associate = (models) => { | ||
BenchmarksViewed.belongsTo(models.establishment, { | ||
foreignKey: 'EstablishmentID', | ||
targetKey: 'id', | ||
as: 'benchmarkEstablishment', | ||
}); | ||
}; | ||
|
||
return BenchmarksViewed; | ||
}; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
const models = require('../../../../models'); | ||
const moment = require('moment'); | ||
|
||
const postBenchmarkTabUsage = async (req, res) => { | ||
const viewedTime = moment(); | ||
try { | ||
await models.benchmarksViewed.create({ | ||
EstablishmentID: req.establishmentId, | ||
ViewedTime: viewedTime, | ||
}); | ||
res.status(200).send(); | ||
} catch (err) { | ||
console.error(err); | ||
return res.status(500).json({}); | ||
} | ||
}; | ||
router.route('/').post(postBenchmarkTabUsage); | ||
|
||
module.exports = router; | ||
module.exports.postBenchmarkTabUsage = postBenchmarkTabUsage; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.