Commit cc7a4a7f authored by Pavel Leshkovich's avatar Pavel Leshkovich
Browse files

Merge branch 'push_notification' into 'master'

Push notification

See merge request !1
parents 63c8dae9 b8ce8eb9
...@@ -41,6 +41,19 @@ function * createTables() { ...@@ -41,6 +41,19 @@ function * createTables() {
); );
} }
try {
yield this
.db
.queryAsync(`
ALTER TABLE \`${this.tablesNames.PROJECTS}\` ADD \`instance_id\` CHAR(36)
`);
} catch (e) {
this.logger.log(
__filename,
'instance_id column already exist'
);
}
this.logger.log( this.logger.log(
__filename, __filename,
'tables created successfully' 'tables created successfully'
......
...@@ -8,7 +8,8 @@ function* post() { ...@@ -8,7 +8,8 @@ function* post() {
.isLength(1, 255).value, .isLength(1, 255).value,
config: this.checkBody('config').eq('[object Object]').value, config: this.checkBody('config').eq('[object Object]').value,
feed_uuid: this.checkBody('feed_uuid').isUUID().value, feed_uuid: this.checkBody('feed_uuid').isUUID().value,
project_id: this.checkBody('project_id').isInt().value project_id: this.checkBody('project_id').isInt().value,
instance_id: this.checkParams('instanceId').isUUID().value
}; };
const str = JSON.stringify(project); const str = JSON.stringify(project);
...@@ -25,8 +26,8 @@ function* post() { ...@@ -25,8 +26,8 @@ function* post() {
yield this.db.queryAsync( yield this.db.queryAsync(
`UPDATE \`${ `UPDATE \`${
this.tablesNames.PROJECTS this.tablesNames.PROJECTS
}\` SET name = ?, feed_uuid = ?, project_id = ?, config = ? WHERE id = ?`, }\` SET name = ?, feed_uuid = ?, project_id = ?, config = ?, instance_id = ? WHERE id = ?`,
[project.name, project.feed_uuid, project.project_id, project.config, project.id] [project.name, project.feed_uuid, project.project_id, project.config, project.instance_id, project.id]
); );
this.logger.log( this.logger.log(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment