Update Artist === ```javascript! const { submitQuery, sql, sqlReduce } = require("~root/lib/database"); const updateArtistById = ({ artistId, genre = null, name = null }) => { const updates = []; if (genre !== null) { updates.push(sql`genre = ${genre}`); } if (name !== null) { updates.push(sql`name = ${name}`); } if (updates.length !== 0) { return submitQuery` UPDATE Artists SET ${updates.reduce(sqlReduce)} WHERE artist_id = ${artistId}; `; } return Promise.resolve(); }; module.exports = updateArtistById; ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up