feat: add me
This commit is contained in:
@@ -5,7 +5,13 @@ import { v4 as uuidv4 } from 'uuid';
|
||||
import { ContainerModel } from '../container/models/index.ts';
|
||||
import { Op } from 'sequelize';
|
||||
import { getDeck } from './module/cache-file.ts';
|
||||
|
||||
export const clearBlank = (newStyle: any) => {
|
||||
for (let key in newStyle) {
|
||||
if (newStyle[key] === '' || newStyle[key] === undefined || newStyle[key] === null) {
|
||||
delete newStyle[key];
|
||||
}
|
||||
}
|
||||
};
|
||||
app
|
||||
.route({
|
||||
path: 'page',
|
||||
@@ -82,6 +88,7 @@ app
|
||||
.route('page', 'updateNode')
|
||||
.define(async (ctx) => {
|
||||
const { id, nodeData } = ctx.query.data;
|
||||
const force = ctx.query.force;
|
||||
if (!id) {
|
||||
throw new CustomError('id is required');
|
||||
}
|
||||
@@ -98,16 +105,16 @@ app
|
||||
flag = true;
|
||||
const { data, ...rest } = nodeItem;
|
||||
const { style, ...restData } = data || {};
|
||||
let newStyle = force ? { ...style } : { ...item?.data?.style, ...style };
|
||||
clearBlank(newStyle);
|
||||
console.log('newStyle', newStyle);
|
||||
const newNodeItem = {
|
||||
...item,
|
||||
...rest,
|
||||
data: {
|
||||
...item?.data,
|
||||
...restData,
|
||||
style: {
|
||||
...item?.data?.style,
|
||||
...style,
|
||||
},
|
||||
style: newStyle,
|
||||
},
|
||||
};
|
||||
console.log('newNodeItem', newNodeItem);
|
||||
|
||||
@@ -67,7 +67,7 @@ app
|
||||
middleware: ['auth'],
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const { username, password, description } = ctx.query;
|
||||
const { username, password, description, avatar, email } = ctx.query.data || {};
|
||||
const state = ctx.state?.tokenUser || {};
|
||||
const { id } = state;
|
||||
const user = await User.findByPk(id);
|
||||
@@ -83,6 +83,12 @@ app
|
||||
if (description) {
|
||||
user.description = description;
|
||||
}
|
||||
if (avatar) {
|
||||
user.avatar = avatar;
|
||||
}
|
||||
if (email) {
|
||||
user.email = email;
|
||||
}
|
||||
await user.save();
|
||||
ctx.body = await user.getInfo();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user