chore: remove test scripts breaking build
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 11s
Build & Deploy / 🧪 QA (push) Successful in 4m31s
Build & Deploy / 🏗️ Build (push) Successful in 6m22s
Build & Deploy / 🚀 Deploy (push) Successful in 12s
Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 4m12s
Build & Deploy / 🔔 Notify (push) Successful in 1s
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 11s
Build & Deploy / 🧪 QA (push) Successful in 4m31s
Build & Deploy / 🏗️ Build (push) Successful in 6m22s
Build & Deploy / 🚀 Deploy (push) Successful in 12s
Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 4m12s
Build & Deploy / 🔔 Notify (push) Successful in 1s
This commit is contained in:
@@ -1,49 +0,0 @@
|
|||||||
import { getPayload } from "payload";
|
|
||||||
import config from "./src/payload/payload.config";
|
|
||||||
|
|
||||||
const createAdmin = async () => {
|
|
||||||
const payload = await getPayload({ config });
|
|
||||||
|
|
||||||
const email = "marc@mintel.me";
|
|
||||||
const password = "Tim300493.";
|
|
||||||
|
|
||||||
console.log(`Creating/Updating admin: ${email}`);
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Check if user exists
|
|
||||||
const users = await payload.find({
|
|
||||||
collection: "users",
|
|
||||||
where: {
|
|
||||||
email: {
|
|
||||||
equals: email,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (users.totalDocs > 0) {
|
|
||||||
console.log("User already exists. Updating password.");
|
|
||||||
await payload.update({
|
|
||||||
collection: "users",
|
|
||||||
id: users.docs[0].id,
|
|
||||||
data: {
|
|
||||||
password,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
await payload.create({
|
|
||||||
collection: "users",
|
|
||||||
data: {
|
|
||||||
email,
|
|
||||||
password,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log("Admin user created successfully.");
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error creating admin:", error);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
process.exit(0);
|
|
||||||
};
|
|
||||||
|
|
||||||
createAdmin();
|
|
||||||
Reference in New Issue
Block a user