Feat/admin options #14
@@ -146,6 +146,20 @@ export async function attachSongToSongbook(songId: number, songbookId: number, n
|
||||
}
|
||||
}
|
||||
|
||||
export async function removeSongfromSongbook(songId: number, songbookId: number) {
|
||||
try {
|
||||
const info = db.prepare(`
|
||||
DELETE FROM songbook_songs
|
||||
WHERE songbook_id = ? AND song_id = ?
|
||||
`).run(songbookId, songId);
|
||||
|
||||
return { success: info.changes > 0 };
|
||||
} catch (error) {
|
||||
console.error("Error in removeSongfromSongbook:", error);
|
||||
return { success: false };
|
||||
}
|
||||
}
|
||||
|
||||
export async function getSongbooks() {
|
||||
try {
|
||||
const songbooks = db.prepare('SELECT id, name, language FROM songbooks ORDER BY name ASC').all();
|
||||
|
||||
Reference in new issue
Block a user