nanka iroiro
This commit is contained in:
parent
2053a041e5
commit
14d12c21f2
6 changed files with 51 additions and 2 deletions
|
@ -45,6 +45,11 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
|
|||
if (bannerIdErr) return rej('invalid bannerId param');
|
||||
if (bannerId !== undefined) updates.bannerId = bannerId;
|
||||
|
||||
// Get 'wallpaperId' parameter
|
||||
const [wallpaperId, wallpaperIdErr] = $.type(ID).optional().nullable().get(params.wallpaperId);
|
||||
if (wallpaperIdErr) return rej('invalid wallpaperId param');
|
||||
if (wallpaperId !== undefined) updates.wallpaperId = wallpaperId;
|
||||
|
||||
// Get 'isLocked' parameter
|
||||
const [isLocked, isLockedErr] = $.bool.optional().get(params.isLocked);
|
||||
if (isLockedErr) return rej('invalid isLocked param');
|
||||
|
@ -85,6 +90,16 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
|
|||
}
|
||||
}
|
||||
|
||||
if (wallpaperId) {
|
||||
const wallpaper = await DriveFile.findOne({
|
||||
_id: wallpaperId
|
||||
});
|
||||
|
||||
if (wallpaper != null && wallpaper.metadata.properties.avgColor) {
|
||||
updates.wallpaperColor = wallpaper.metadata.properties.avgColor;
|
||||
}
|
||||
}
|
||||
|
||||
await User.update(user._id, {
|
||||
$set: updates
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue