aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/pods.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/pods.js')
-rw-r--r--server/models/pods.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/models/pods.js b/server/models/pods.js
index 04cc2d6fc..daeadeb07 100644
--- a/server/models/pods.js
+++ b/server/models/pods.js
@@ -19,10 +19,13 @@ const PodsDB = mongoose.model('pods', podsSchema)
19const Pods = { 19const Pods = {
20 add: add, 20 add: add,
21 count: count, 21 count: count,
22 findById: findById,
22 findByUrl: findByUrl, 23 findByUrl: findByUrl,
23 findBadPods: findBadPods, 24 findBadPods: findBadPods,
24 incrementScores: incrementScores, 25 incrementScores: incrementScores,
25 list: list, 26 list: list,
27 listAllIds: listAllIds,
28 listAllUrls: listAllUrls,
26 remove: remove, 29 remove: remove,
27 removeAll: removeAll, 30 removeAll: removeAll,
28 removeAllByIds: removeAllByIds 31 removeAllByIds: removeAllByIds
@@ -48,6 +51,10 @@ function findBadPods (callback) {
48 PodsDB.find({ score: 0 }, callback) 51 PodsDB.find({ score: 0 }, callback)
49} 52}
50 53
54function findById (id, callback) {
55 PodsDB.findById(id, callback)
56}
57
51function findByUrl (url, callback) { 58function findByUrl (url, callback) {
52 PodsDB.findOne({ url: url }, callback) 59 PodsDB.findOne({ url: url }, callback)
53} 60}
@@ -68,6 +75,14 @@ function list (callback) {
68 }) 75 })
69} 76}
70 77
78function listAllIds (callback) {
79 return PodsDB.find({}, { _id: 1 }, callback)
80}
81
82function listAllUrls (callback) {
83 return PodsDB.find({}, { _id: 0, url: 1 }, callback)
84}
85
71function remove (url, callback) { 86function remove (url, callback) {
72 if (!callback) callback = function () {} 87 if (!callback) callback = function () {}
73 PodsDB.remove({ url: url }, callback) 88 PodsDB.remove({ url: url }, callback)