Skip to content

Commit

Permalink
add: deleteMyUser and deleteMyArtist
Browse files Browse the repository at this point in the history
  • Loading branch information
adhimrahman committed May 7, 2024
1 parent ede14b1 commit 6426b2e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions utils/deleteDatas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const mysql = require('mysql');
const connection = mysql.createConnection({ host: 'localhost', user: 'root', password: '', database: 'spotitip' });

async function deleteMyUser(userId) {
return new Promise((resolve, reject) => {
const sql = 'DELETE FROM user WHERE id= ?';
connection.query(sql, [userId], (err, results) => {
if (err) {
reject(err);
} else {
resolve(results);
}
});
});
}

async function deleteMyArtist(artistId) {
return new Promise((resolve, reject) => {
const sql = 'DELETE FROM artist WHERE id= ?';
connection.query(sql, [artistId], (err, results) => {
if (err) {
reject(err);
} else {
resolve(results);
}
});
});
}

module.exports = { deleteMyUser, deleteMyArtist }

0 comments on commit 6426b2e

Please sign in to comment.