import { validationResult } from 'express-validator' import { success, warning } from '../helpers/index.js' import { ResponseCode } from '../ENUMS.js' import { Simulation } from '../db/index.js' export const getSimulation = async (req, res) => { const validationErrors = validationResult(req) if (!validationErrors.isEmpty()) { return warning(res, { code: ResponseCode.ValidationError }) } const { id } = req.params const result = await Simulation.findById({ _id: id }) success(res, { data: result }) } export const getSimulations = async (req, res) => { const result = await Simulation.find() success(res, { data: result }) }