This commit is contained in:
syuilo 2019-06-25 01:24:01 +09:00
parent bc83963ac7
commit f74bc309b1
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69

View file

@ -2,6 +2,7 @@ import $ from 'cafy';
import { publishMainStream } from '../../../../services/stream';
import define from '../../define';
import { UserProfiles } from '../../../../models';
import { ensure } from '../../../../prelude/ensure';
export const meta = {
requireCredential: true,
@ -20,11 +21,13 @@ export const meta = {
};
export default define(meta, async (ps, user) => {
const profile = await UserProfiles.findOne(user.id).then(ensure);
await UserProfiles.createQueryBuilder().update()
.set({
clientData: {
clientData: Object.assign(profile.clientData, {
[ps.name]: ps.value
},
}),
})
.where('userId = :id', { id: user.id })
.execute();