Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 6s
Build & Deploy / 🧪 QA (push) Failing after 54s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 1s
- Add branch deployment support - Switch build platform to linux/amd64 - Extract checks to turbo pipeline - Add pre/post-deploy scripts & cms-sync
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { getPayload } from "payload";
|
|
import configPromise from "../payload.config";
|
|
|
|
async function run() {
|
|
try {
|
|
const payload = await getPayload({ config: configPromise });
|
|
|
|
const existing = await payload.find({
|
|
collection: "users",
|
|
where: { email: { equals: "marc@mintel.me" } },
|
|
});
|
|
|
|
if (existing.totalDocs > 0) {
|
|
console.log("User already exists, updating password...");
|
|
await payload.update({
|
|
collection: "users",
|
|
where: { email: { equals: "marc@mintel.me" } },
|
|
data: {
|
|
password: "Tim300493.",
|
|
},
|
|
});
|
|
console.log("Password updated.");
|
|
} else {
|
|
console.log("Creating user...");
|
|
await payload.create({
|
|
collection: "users",
|
|
data: {
|
|
email: "marc@mintel.me",
|
|
password: "Tim300493.",
|
|
},
|
|
});
|
|
console.log("User marc@mintel.me created.");
|
|
}
|
|
process.exit(0);
|
|
} catch (err) {
|
|
console.error("Failed to create user:", err);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
run();
|