temp
This commit is contained in:
@@ -116,10 +116,11 @@ app
|
||||
path: 'mark',
|
||||
key: 'update',
|
||||
middleware: ['auth'],
|
||||
isDebug: true,
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const tokenUser = ctx.state.tokenUser;
|
||||
const { id, ...data } = ctx.query.data || {};
|
||||
const { id, createdAt, updatedAt, uid: _, puid: _2, uname: _3, ...data } = ctx.query.data || {};
|
||||
let markModel: MarkModel;
|
||||
if (id) {
|
||||
markModel = await MarkModel.findByPk(id);
|
||||
@@ -130,7 +131,15 @@ app
|
||||
ctx.throw(403, 'no permission');
|
||||
}
|
||||
const version = Number(markModel.version) + 1;
|
||||
await markModel.update({ ...markModel.data, ...data, version });
|
||||
await markModel.update({
|
||||
...markModel.data,
|
||||
...data,
|
||||
data: {
|
||||
...markModel.data,
|
||||
...data,
|
||||
},
|
||||
version,
|
||||
});
|
||||
} else {
|
||||
markModel = await MarkModel.create({
|
||||
...data,
|
||||
|
||||
@@ -317,3 +317,5 @@ export const syncMarkModel = async (sync?: Opts) => {
|
||||
const sequelize = await useContextKey('sequelize');
|
||||
await MarkMInit({ sequelize, tableName: 'micro_mark' }, sync);
|
||||
};
|
||||
|
||||
syncMarkModel({ sync: true, alter: true, logging: true });
|
||||
Reference in New Issue
Block a user