60255f20bb
Seven bundled improvements: - PartModel combobox on Add Part + Log Repair (known MPN auto-fills; unknown reveals manufacturer picker for catalog upsert). - Host lifecycle: state (DEPLOYED/DEGRADED/TESTING) and stack (PRODUCTION/VETTING) fields, driven by external clients via the API. - Locations page redesigned as a 2-pane tree + bin grid with breadcrumb. - PENDING_REPAIR custody state: tech takes a SPARE into custody for a future swap; resolves to DEPLOYED via Repair or back to SPARE via a bin-required drop-off. - Move Category from Part to PartModel; seed common categories (GPU/RAM/SSD/HDD/NIC/CPU/PSU/MOBO). Parts table gets a Category column and filter sourced from the model. - Fix Deployed Value 100x bug on the Dashboard (price is stored as dollars, not cents). - PartModels table shows "No" instead of "--" when destroyOnFail=false. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
38 lines
940 B
TypeScript
38 lines
940 B
TypeScript
import bcrypt from 'bcryptjs';
|
|
import { prisma } from '../src/client.js';
|
|
|
|
async function main() {
|
|
const passwordHash = await bcrypt.hash('admin', 12);
|
|
|
|
const admin = await prisma.user.upsert({
|
|
where: { username: 'admin' },
|
|
update: {},
|
|
create: {
|
|
username: 'admin',
|
|
email: 'admin@vector.local',
|
|
passwordHash,
|
|
role: 'ADMIN',
|
|
},
|
|
});
|
|
|
|
console.log(`Seeded admin user: ${admin.username} (${admin.email})`);
|
|
console.log('Default password: admin — change this immediately!');
|
|
|
|
const categoryNames = ['GPU', 'RAM', 'SSD', 'HDD', 'NIC', 'CPU', 'PSU', 'MOBO'];
|
|
for (const name of categoryNames) {
|
|
await prisma.category.upsert({
|
|
where: { name },
|
|
update: {},
|
|
create: { name },
|
|
});
|
|
}
|
|
console.log(`Seeded ${categoryNames.length} part categories.`);
|
|
}
|
|
|
|
main()
|
|
.catch((err) => {
|
|
console.error(err);
|
|
process.exit(1);
|
|
})
|
|
.finally(() => prisma.$disconnect());
|