clear: old code

This commit is contained in:
2025-02-18 18:10:02 +08:00
parent d9fe68d3fe
commit 84edde385e
67 changed files with 288 additions and 6897 deletions

View File

@@ -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();

View File

@@ -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();