mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-28 21:19:42 +00:00
Update libraryItem model to include libraryId
This commit is contained in:
parent
d745e6b656
commit
633e83a4ab
7 changed files with 161 additions and 4 deletions
28
server/controllers2/library.controller.js
Normal file
28
server/controllers2/library.controller.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
const libraryDb = require('../db/library.db')
|
||||
const itemDb = require('../db/item.db')
|
||||
|
||||
const getAllLibraries = async (req, res) => {
|
||||
const libraries = await libraryDb.getAllLibraries()
|
||||
res.json({
|
||||
libraries
|
||||
})
|
||||
}
|
||||
|
||||
const getLibrary = async (req, res) => {
|
||||
const library = await libraryDb.getLibrary(req.params.id)
|
||||
if (!library) return res.sendStatus(404)
|
||||
res.json(library)
|
||||
}
|
||||
|
||||
const getLibraryItems = async (req, res) => {
|
||||
const libraryItems = await itemDb.getLibraryItemsForLibrary(req.params.id)
|
||||
res.json({
|
||||
libraryItems
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getAllLibraries,
|
||||
getLibrary,
|
||||
getLibraryItems
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue