Skip to content

Commit

Permalink
create delete query
Browse files Browse the repository at this point in the history
Relates #5
  • Loading branch information
Alaalser committed Feb 15, 2021
1 parent 620bd2d commit 70eda59
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/database/queries/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const {
getKindergartenById,
getKindergartenId,
getKindergartenSearch,
deleteKindergartenQuery,
} = require('./kindergarten');
const { getUsersQuery } = require('./users');
const { getLocationsQuery } = require('./locations');
Expand All @@ -14,6 +15,7 @@ module.exports = {
getKindergartenById,
addCommentsQuery,
getKindergartenId,
deleteKindergartenQuery,
getCommentsQuery,
getUsersQuery,
getLocationsQuery,
Expand Down
11 changes: 11 additions & 0 deletions server/database/queries/kindergarten/deleteKindergarten.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { connection } = require('../../data');

const deleteKindergartenQuery = (kindergartenId) => {
const sql = {
text: 'DELETE * FROM kindergarten WHERE kindergartens.id=$1 CASCADE',
values: [kindergartenId],
};
return connection.query(sql);
};

module.exports = deleteKindergartenQuery;

0 comments on commit 70eda59

Please sign in to comment.