Commit 4f75a45a authored by Evgeniy Zaitsev's avatar Evgeniy Zaitsev
Browse files

v1.0.5

parent 1f7ac6ba
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
{
"name": "service-sdk",
"version": "1.0.4",
"version": "1.0.5",
"private": true,
"description": "Service SDK for LViS",
"keywords": [],
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -13,18 +13,37 @@ function* post() {
this.throwResponseErrorIfNeed(this.errors);
project.config = JSON.stringify(project.config);
const query = `SELECT * FROM \`${this.tablesNames.PROJECTS}\` WHERE \`id\` = "${project.id}"`;
const projects = yield this.db.queryAsync(query);
yield this.db.queryAsync(`INSERT INTO \`${this.tablesNames.PROJECTS}\` SET ?`, project);
project.config = JSON.stringify(project.config);
this.logger.log(
__filename,
'inserted project with id',
project.id,
'to table',
this.tablesNames.PROJECTS,
'successfully'
);
if (projects.length) {
yield this.db.queryAsync(
`UPDATE \`${this.tablesNames.PROJECTS}\` SET name = ?, feed_uuid = ?, config = ? WHERE id = ?`,
[project.name, project.feed_uuid, project.config, this.state.project.id]
);
this.logger.log(
__filename,
'update row with id',
this.state.project.id,
'in table',
this.tablesNames.PROJECTS,
'successfully'
);
} else {
yield this.db.queryAsync(`INSERT INTO \`${this.tablesNames.PROJECTS}\` SET ?`, project);
this.logger.log(
__filename,
'inserted project with id',
project.id,
'to table',
this.tablesNames.PROJECTS,
'successfully'
);
}
this.body = {};
}
......@@ -42,10 +61,11 @@ function* put() {
project.config = JSON.stringify(project.config);
yield this.db.queryAsync(
`UPDATE \`${this.tablesNames.PROJECTS}\` SET name = ?, config = ? WHERE id = ?`,
[project.name, project.config, this.state.project.id]
);
yield this.db.queryAsync(`UPDATE \`${this.tablesNames.PROJECTS}\` SET name = ?, config = ? WHERE id = ?`, [
project.name,
project.config,
this.state.project.id,
]);
this.logger.log(
__filename,
......@@ -62,9 +82,7 @@ function* put() {
function* del() {
this.logger.log(__filename, 'DELETE');
yield this.db.queryAsync(`DELETE FROM \`${this.tablesNames.PROJECTS}\` WHERE id = ?`, [
this.state.project.id,
]);
yield this.db.queryAsync(`DELETE FROM \`${this.tablesNames.PROJECTS}\` WHERE id = ?`, [this.state.project.id]);
this.logger.log(
__filename,
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
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