feat: bootstrap SuperAdmin from env and lock one-time seeding
Production creates the SuperAdmin from env credentials, and dashboard seeding is authenticated, SuperAdmin-only, and locked after the first run.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// /components/seed/seedController.js
|
||||
'use strict';
|
||||
|
||||
const catchAsync = require('../../utils/catchAsync');
|
||||
const seedService = require('./seedService');
|
||||
const { successResponse } = require('../../utils/apiResponse');
|
||||
|
||||
exports.getStatus = catchAsync(async (req, res) => {
|
||||
const status = await seedService.getStatus();
|
||||
return successResponse(res, 200, 'Seed status retrieved', status);
|
||||
});
|
||||
|
||||
exports.runSeed = catchAsync(async (req, res) => {
|
||||
const result = await seedService.runSeed(req.user?._id);
|
||||
return successResponse(res, 200, 'Database seeded successfully', result);
|
||||
});
|
||||
Reference in New Issue
Block a user