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