video-flow-toon/src/routes/other/deleteAllData.ts
ACT丶流星雨 0798ae03ee no message
2026-01-29 18:28:32 +08:00

26 lines
667 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import express from "express";
import u from "@/utils";
import { success } from "@/lib/responseFormat";
const router = express.Router();
// 删除数据库表数据
export default router.post("/", async (req, res) => {
const projects = await u.db("t_project").select("id");
const projectIds = projects.map((project) => project.id);
await Promise.all(
projectIds.map(async (id) => {
try {
await u.oss.deleteDirectory(String(id));
} catch (error) {
console.error(`删除OSS文件失败项目ID: ${id}`, error);
}
}),
);
// await initDB(db, true);
res.status(200).send(success("清空数据库成功"));
});