'use server';

import Farm from '../../../models/farm';
import Processor from '../../../models/processor';

import { bins, farms, processors } from './placeholder-data';

export const seedDb = async (overwrite = false) => {
    if (overwrite || await Farm.countDocuments() === 0) {
        await Farm.deleteMany({});
        await Farm.insertMany(farms);
    }
    if (overwrite || await Processor.countDocuments() === 0) {
        await Processor.deleteMany({});
        await Processor.insertMany(processors);
    }
};
