fix(ui): global modal scroll locks and ci branch db seeding
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 13s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 13s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled
This commit is contained in:
41
scripts/create-agent-admin.ts
Normal file
41
scripts/create-agent-admin.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { getPayload } from 'payload';
|
||||
import config from '../payload.config';
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const payload = await getPayload({ config: await config });
|
||||
const user = await payload.create({
|
||||
collection: 'users',
|
||||
data: {
|
||||
email: 'agent@mintel.me',
|
||||
password: 'agentpassword123',
|
||||
},
|
||||
});
|
||||
console.log('SUCCESS: Created AI Agent admin user', user.id);
|
||||
} catch (e) {
|
||||
if (
|
||||
e.message?.includes('duplicate key') ||
|
||||
e.code === '11000' ||
|
||||
String(e).includes('already exists')
|
||||
) {
|
||||
console.log('User already exists, attempting to update password...', e.message);
|
||||
const payload = await getPayload({ config: await config });
|
||||
const users = await payload.find({
|
||||
collection: 'users',
|
||||
where: { email: { equals: 'agent@mintel.me' } },
|
||||
});
|
||||
if (users.docs.length > 0) {
|
||||
await payload.update({
|
||||
collection: 'users',
|
||||
id: users.docs[0].id,
|
||||
data: { password: 'agentpassword123' },
|
||||
});
|
||||
console.log('SUCCESS: Updated existing AI Agent admin user password');
|
||||
}
|
||||
} else {
|
||||
console.error('ERROR creating user:', e);
|
||||
}
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
run();
|
||||
Reference in New Issue
Block a user