mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-03 21:54:53 -04:00
Small fixes
This commit is contained in:
parent
08a41e37b4
commit
5ea423072b
@ -705,7 +705,7 @@ class Database {
|
|||||||
* @param {string} providerSlug
|
* @param {string} providerSlug
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
async doesCustomProviderExistBySlug(providerSlug) {
|
async doesCustomProviderExistWithSlug(providerSlug) {
|
||||||
const id = providerSlug.split("custom-")[1]
|
const id = providerSlug.split("custom-")[1]
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
@ -53,7 +53,7 @@ class LibraryController {
|
|||||||
|
|
||||||
// Validate that the custom provider exists if given any
|
// Validate that the custom provider exists if given any
|
||||||
if (newLibraryPayload.provider && newLibraryPayload.provider.startsWith("custom-")) {
|
if (newLibraryPayload.provider && newLibraryPayload.provider.startsWith("custom-")) {
|
||||||
await Database.doesCustomProviderExistBySlug(newLibraryPayload.provider)
|
await Database.doesCustomProviderExistWithSlug(newLibraryPayload.provider)
|
||||||
}
|
}
|
||||||
|
|
||||||
const library = new Library()
|
const library = new Library()
|
||||||
@ -182,7 +182,7 @@ class LibraryController {
|
|||||||
|
|
||||||
// Validate that the custom provider exists if given any
|
// Validate that the custom provider exists if given any
|
||||||
if (req.body.provider && req.body.provider.startsWith("custom-")) {
|
if (req.body.provider && req.body.provider.startsWith("custom-")) {
|
||||||
await Database.doesCustomProviderExistBySlug(req.body.provider)
|
await Database.doesCustomProviderExistWithSlug(req.body.provider)
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasUpdates = library.update(req.body)
|
const hasUpdates = library.update(req.body)
|
||||||
|
@ -27,7 +27,7 @@ class CustomMetadataProvider extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static findByPk(id) {
|
static findByPk(id) {
|
||||||
this.findOne({
|
return this.findOne({
|
||||||
where: {
|
where: {
|
||||||
id,
|
id,
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,7 @@ class CustomProviderAdapter {
|
|||||||
|
|
||||||
async search(title, author, providerSlug) {
|
async search(title, author, providerSlug) {
|
||||||
const providerId = providerSlug.split("custom-")[1]
|
const providerId = providerSlug.split("custom-")[1]
|
||||||
|
const provider = await Database.customMetadataProviderModel.findByPk(providerId);
|
||||||
console.log(providerId)
|
|
||||||
const provider = await Database.customMetadataProviderModel.findOne({
|
|
||||||
where: {
|
|
||||||
id: providerId,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
throw new Error("Custom provider not found for the given id");
|
throw new Error("Custom provider not found for the given id");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user