update setupdb route
This commit is contained in:
parent
4ed65eb436
commit
c4c645437f
@ -24,7 +24,7 @@ import {
|
||||
SqliteQueryInterface,
|
||||
} from "@sequelize/sqlite3";
|
||||
import { hashpassword } from "@/util/auth";
|
||||
import { copyFile, readFileSync } from "fs";
|
||||
import { copyFile, mkdirSync, readFileSync } from "fs";
|
||||
import path from "path";
|
||||
import { UUID } from "crypto";
|
||||
import { runApiAction } from "@/util/api";
|
||||
@ -96,8 +96,10 @@ async function seedPosts(qif: SqliteQueryInterface<SqliteDialect>) {
|
||||
bucket_id: bucket.id as UUID,
|
||||
filename: attachment.filename,
|
||||
}).then((a) => {
|
||||
console.log(bucket.id);
|
||||
mkdirSync(`./bucket/${bucket.id}/`, { recursive: true });
|
||||
copyFile(
|
||||
path.resolve(".", "db", "seed", "post", a.filename),
|
||||
path.resolve(".", "db", "seed", "posts", a.filename),
|
||||
path.resolve(".", "bucket", bucket.id, a.filename),
|
||||
() => {}
|
||||
);
|
||||
@ -171,7 +173,7 @@ export async function GET(request: Request) {
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
console.log("pp");
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
test: await queryInterface.describeTable("Posts").then((t) => t),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user