-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: deleteMyUser and deleteMyArtist
- Loading branch information
1 parent
ede14b1
commit 6426b2e
Showing
1 changed file
with
30 additions
and
0 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,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 } |