Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ZandercraftGames committed Sep 27, 2023
2 parents 6992426 + bfc38bc commit 8f1241c
Showing 1 changed file with 82 additions and 1 deletion.
83 changes: 82 additions & 1 deletion database.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const modSchema = new Schema({
pretty_name: String,
version: String,
mc_version: String,
type: String,
type: String, // Can be forgemod, neoforgemod, fabricmod, quiltmod, <modloadernamemod>, or modloader(handled separately)
md5: String,
author: String,
description: String,
Expand Down Expand Up @@ -317,7 +317,88 @@ exports.deleteModpack = (m_slug) => {
}

// --- Mod-Related Functions ---
exports.getModBySlug = (m_slug) => {
return Mod.findOne({ name: m_slug }).exec().then((mod) => {

Check notice on line 321 in database.js

View workflow job for this annotation

GitHub Actions / Qodana for JS

Signature mismatch

Invalid number of arguments, expected 1
// Mod found
return mod
}).catch((reason) => {
// No mod found with this slug
debug(`ERROR (DB): Failed to find a mod with this slug because of: ${reason}`)
return false
})
}

exports.getModsByType = (m_type) => {
return Mod.find({ type: m_type }).exec().then((mods) => {

Check notice on line 332 in database.js

View workflow job for this annotation

GitHub Actions / Qodana for JS

Signature mismatch

Invalid number of arguments, expected 1
// Mods found
return mods
}).catch((reason) => {
// No mods found with this modloader
debug(`ERROR (DB): Failed to find a mod with modloader '${m_type}' because of: ${reason}`)
return false
})
}

exports.getModsByMinecraftVersion = (m_version) => {
return Mod.find({ mc_version: m_version }).exec().then((mods) => {

Check notice on line 343 in database.js

View workflow job for this annotation

GitHub Actions / Qodana for JS

Signature mismatch

Invalid number of arguments, expected 1
// Mods found
return mods
}).catch((reason) => {
// No mods found with this Minecraft version.
debug(`ERROR (DB): Failed to find a mod with Minecraft version '${m_version}' because of: ${reason}`)
return false
})
}

exports.getModsByMinecraftAndLoaderVersion = (m_version, m_type) => {
return Mod.find({ mc_version: m_version, type: m_type }).exec().then((mods) => {

Check notice on line 354 in database.js

View workflow job for this annotation

GitHub Actions / Qodana for JS

Signature mismatch

Invalid number of arguments, expected 1
// Mods found
return mods
}).catch((reason) => {
// No mods found with this Minecraft and modloader version.
debug(`ERROR (DB): Failed to find a mod with Minecraft version '${m_version}' and modloader version '${m_type}' because of: ${reason}`)
return false
})
}

exports.getAllMods = () => {
return Mod.find({}).exec().then((mods) => {

Check notice on line 365 in database.js

View workflow job for this annotation

GitHub Actions / Qodana for JS

Signature mismatch

Invalid number of arguments, expected 1
// Mods found
return mods
}).catch((reason) => {
// No mods found
debug(`ERROR (DB): Failed to find any mods because of: ${reason}`)
return false
})
}

exports.updateMod = (m_slug, m_object) => {
return Mod.updateOne(
{ name: m_slug },
{ $set: m_object }
).exec().then(() => {

Check notice on line 379 in database.js

View workflow job for this annotation

GitHub Actions / Qodana for JS

Signature mismatch

Invalid number of arguments, expected 1
// Successfully updated the modpack
return true
}).catch((reason) => {
// Failed to update the modpack
debug(`ERROR (DB): Failed to update modpack '${m_slug}' because of: ${reason}`)
return false
})
}

exports.deleteModpack = (m_slug) => {
return Modpack.deleteOne({ name: m_slug }).exec().then(() => {

Check notice on line 390 in database.js

View workflow job for this annotation

GitHub Actions / Qodana for JS

Signature mismatch

Invalid number of arguments, expected 1
// Successfully deleted this modpack
return true
}).catch((reason) => {
// Failed to delete the modpack
debug(`ERROR (DB): Failed to delete modpack '${m_slug}' because of: ${reason}`)
return false
})
}


// --- Modloader-Related Functions ---


// --- Build-Related Functions ---
Expand Down

0 comments on commit 8f1241c

Please sign in to comment.