feat: add cross-album search, auto-rules, album UI redesign, editorial archiving and pdf download
This commit is contained in:
1 parent
9c0d43b1ec
commit
375e5b8b7d
23 files changed
+1153
-43
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import { eq } from "drizzle-orm";
|
||||
import { auth } from "../src/modules/auth/auth";
|
||||
import { db } from "../src/db/client";
|
||||
import { users } from "../src/db/schema";
|
||||
|
||||
async function main() {
|
||||
const email = process.argv[2] || "mail@leon-tonhaeuser.de";
|
||||
const password = process.argv[3] || "AdminPassword123!";
|
||||
const name = process.argv[4] || "Leon Tonhäuser";
|
||||
|
||||
console.log(`Creating Admin user: ${email}...`);
|
||||
|
||||
try {
|
||||
const res = await auth.api.signUpEmail({
|
||||
body: {
|
||||
email,
|
||||
name,
|
||||
password,
|
||||
},
|
||||
});
|
||||
|
||||
const userId = res.user.id;
|
||||
await db.update(users).set({ role: "ADMIN", emailVerified: true }).where(eq(users.id, userId));
|
||||
|
||||
console.log(`Successfully created Admin account!`);
|
||||
console.log(`Email: ${email}`);
|
||||
console.log(`Password: ${password}`);
|
||||
} catch (error) {
|
||||
console.error("Error creating admin user:", error);
|
||||
// If user already exists, update to admin
|
||||
const [existing] = await db.select().from(users).where(eq(users.email, email));
|
||||
if (existing) {
|
||||
await db.update(users).set({ role: "ADMIN", emailVerified: true }).where(eq(users.id, existing.id));
|
||||
console.log(`Updated existing user ${email} to ADMIN role.`);
|
||||
}
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error("Fatal error:", err);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in new issue
Block a user