clear: old code
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
import { AiAgent } from '@/models/agent.ts';
|
||||
import { RouterCodeModel } from '@/models/code.ts';
|
||||
import { Prompt } from '@/models/prompt.ts';
|
||||
|
||||
import { User } from '@/models/user.ts';
|
||||
import { ContainerModel } from '@/routes/container/models/index.ts';
|
||||
import { PageModel } from '@/routes/page/models/index.ts';
|
||||
import { ResourceModel } from '@/routes/resource/models/index.ts';
|
||||
|
||||
// declare uid: string;
|
||||
// uid: {
|
||||
// type: DataTypes.UUID,
|
||||
// allowNull: true,
|
||||
// },
|
||||
// 系统表
|
||||
export const stystemTables = [AiAgent, RouterCodeModel, Prompt];
|
||||
|
||||
export const userTables = [ContainerModel, PageModel, ResourceModel];
|
||||
|
||||
const rootUid = '14206305-8b5c-44cc-b177-766cfe2e452f';
|
||||
|
||||
const updateUser = async () => {
|
||||
const updateTables = [...userTables] as any[];
|
||||
for (let Table of updateTables) {
|
||||
// const res = await ContainerModel.update({ uid: rootUid }, { where: { uid: null } });
|
||||
try {
|
||||
const list = await Table.update({ uid: rootUid }, { where: { uid: null } });
|
||||
console.log('update--', list.length);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// updateUser();
|
||||
@@ -1,47 +0,0 @@
|
||||
import { ContainerModel } from '@/routes/container/models/index.ts';
|
||||
import { ChatPrompt } from '@/models/chat-prompt.ts';
|
||||
const recoverData = async () => {
|
||||
const data = {
|
||||
id: '868970a4-8cab-4141-a73c-cc185fd17508',
|
||||
title: '测试es6每次导入的变量,运行一次+1,并打印',
|
||||
description: '',
|
||||
tags: [],
|
||||
type: '',
|
||||
code: "let a = 1\n\nexport const main = () => {\n console.log('current a', a);\n return a++\n}",
|
||||
source: '',
|
||||
sourceType: '',
|
||||
data: {
|
||||
className: '',
|
||||
style: {},
|
||||
showChild: true,
|
||||
shadowRoot: false,
|
||||
},
|
||||
publish: {},
|
||||
uid: '14206305-8b5c-44cc-b177-766cfe2e452f',
|
||||
createdAt: '2024-09-19T13:27:58.796Z',
|
||||
updatedAt: '2024-09-28T05:27:05.381Z',
|
||||
};
|
||||
const r = await ContainerModel.create(data);
|
||||
};
|
||||
|
||||
// recoverData();
|
||||
|
||||
const revoverId = async () => {
|
||||
const id = 'e235576e-eb48-4b5c-8385-9b8ada4a137f';
|
||||
// const cp = await ChatPrompt.findByPk(id);
|
||||
const cp = await ChatPrompt.findAll({
|
||||
paranoid: false,
|
||||
});
|
||||
console.log(
|
||||
cp.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
// @ts-ignore
|
||||
deletedAt: item.deletedAt,
|
||||
};
|
||||
}),
|
||||
);
|
||||
// cp 被删除了,复原
|
||||
await ChatPrompt.restore({ where: { id } });
|
||||
};
|
||||
revoverId();
|
||||
Reference in New Issue
Block a user