* wip

* wip

* wip

* wip

* wip

* Update registry.value.vue

* wip

* wip

* wip

* wip

* typo
This commit is contained in:
syuilo
2021-01-11 20:38:34 +09:00
committed by GitHub
parent 1286dee1ab
commit 6c975275f8
37 changed files with 1017 additions and 100 deletions

View File

@@ -1,5 +1,7 @@
import define from '../define';
import { Users } from '../../../models';
import { RegistryItems, UserProfiles, Users } from '../../../models';
import { ensure } from '../../../prelude/ensure';
import { genId } from '../../../misc/gen-id';
export const meta = {
desc: {
@@ -22,6 +24,27 @@ export const meta = {
export default define(meta, async (ps, user, token) => {
const isSecure = token == null;
// TODO: そのうち消す
const profile = await UserProfiles.findOne(user.id).then(ensure);
for (const [k, v] of Object.entries(profile.clientData)) {
await RegistryItems.insert({
id: genId(),
createdAt: new Date(),
updatedAt: new Date(),
userId: user.id,
domain: null,
scope: ['client', 'base'],
key: k,
value: v
});
}
await UserProfiles.createQueryBuilder().update()
.set({
clientData: {},
})
.where('userId = :id', { id: user.id })
.execute();
return await Users.pack(user, user, {
detail: true,
includeSecrets: isSecure