This commit is contained in:
syuilo
2017-01-17 11:11:22 +09:00
parent caa8aee7a0
commit 9f81288fcc
48 changed files with 91 additions and 140 deletions

View File

@ -29,7 +29,7 @@ module.exports = (params, user, app, isSecure) =>
data: Object.assign(user.data || {}, JSON.parse(data))
}
};
await User.updateOne({ _id: user._id }, set);
await User.update({ _id: user._id }, set);
res(204);
} else {
const appdata = await Appdata.findOne({
@ -41,7 +41,7 @@ module.exports = (params, user, app, isSecure) =>
data: Object.assign((appdata || {}).data || {}, JSON.parse(data))
}
};
await Appdata.updateOne({
await Appdata.update({
app_id: app._id,
user_id: user._id
}, Object.assign({

View File

@ -44,14 +44,13 @@ module.exports = (params) =>
const favorites = await Favorites
.find({
user_id: user._id
}, {}, {
}, {
limit: limit,
skip: offset,
sort: {
_id: sort == 'asc' ? 1 : -1
}
})
.toArray();
});
// Serialize
res(await Promise.all(favorites.map(async favorite =>

View File

@ -92,11 +92,10 @@ module.exports = (params, user) =>
// Issue query
const notifications = await Notification
.find(query, {}, {
.find(query, {
limit: limit,
sort: sort
})
.toArray();
});
// Serialize
res(await Promise.all(notifications.map(async notification =>

View File

@ -59,11 +59,10 @@ module.exports = (params, user) =>
// Issue query
const history = await Signin
.find(query, {}, {
.find(query, {
limit: limit,
sort: sort
})
.toArray();
});
// Serialize
res(await Promise.all(history.map(async record =>

View File

@ -8,6 +8,7 @@ import User from '../../models/user';
import { isValidBirthday } from '../../models/user';
import serialize from '../../serializers/user';
import event from '../../event';
import config from '../../../conf';
/**
* Update myself
@ -73,9 +74,7 @@ module.exports = async (params, user, _, isSecure) =>
user.banner_id = new mongo.ObjectID(banner);
}
await User.updateOne({ _id: user._id }, {
$set: user
});
await User.update(user._id, user);
// Serialize
const iObj = await serialize(user, user, {