change cover structure in radio fix #15
This commit is contained in:
parent
4aea43a8bb
commit
07cc31ede3
@ -56,9 +56,9 @@ router
|
|||||||
if (radio) {
|
if (radio) {
|
||||||
if (req.files.file) {
|
if (req.files.file) {
|
||||||
resize_image_for_radio(req.files.file.data, (result) => {
|
resize_image_for_radio(req.files.file.data, (result) => {
|
||||||
radio.cover32 = result.cover32;
|
radio.covers.cover32 = result.cover32;
|
||||||
radio.cover64 = result.cover64;
|
radio.covers.cover64 = result.cover64;
|
||||||
radio.cover128 = result.cover128;
|
radio.covers.cover128 = result.cover128;
|
||||||
database.radios.update(radio);
|
database.radios.update(radio);
|
||||||
res.json(radio).end();
|
res.json(radio).end();
|
||||||
});
|
});
|
||||||
|
@ -23,6 +23,9 @@ exports.byId = function (id, callback) {
|
|||||||
.collection("radios")
|
.collection("radios")
|
||||||
.findOne({ _id: ObjectId(id) }, (err, result) => {
|
.findOne({ _id: ObjectId(id) }, (err, result) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
if (!result.covers) {
|
||||||
|
result.covers = {};
|
||||||
|
}
|
||||||
callback(result);
|
callback(result);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -63,9 +66,7 @@ exports.update = function (radio, callback) {
|
|||||||
$set: {
|
$set: {
|
||||||
name: radio.name,
|
name: radio.name,
|
||||||
url: radio.url,
|
url: radio.url,
|
||||||
cover32: radio.cover32,
|
covers: radio.covers
|
||||||
cover64: radio.cover64,
|
|
||||||
cover128: radio.cover128
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ upsert: false },
|
{ upsert: false },
|
||||||
|
Loading…
Reference in New Issue
Block a user