30 lines
768 B
TypeScript
30 lines
768 B
TypeScript
import useDatabase from "~/composables/useDatabase";
|
|
import type { FileType } from '~/types/content';
|
|
import { explorerContentTable } from "~/db/schema";
|
|
import { eq, ne } from "drizzle-orm";
|
|
|
|
const typeMapping: Record<string, FileType> = {
|
|
".md": "markdown",
|
|
".canvas": "canvas"
|
|
};
|
|
|
|
export default defineTask({
|
|
meta: {
|
|
name: 'push',
|
|
description: 'Push the data to Git',
|
|
},
|
|
async run(event) {
|
|
try {
|
|
const db = useDatabase();
|
|
const files = db.select().from(explorerContentTable).where(ne(explorerContentTable.type, 'folder')).all();
|
|
|
|
|
|
|
|
return { result: true };
|
|
}
|
|
catch(e)
|
|
{
|
|
return { result: false, error: e };
|
|
}
|
|
},
|
|
}) |