const { globSync } = require('glob');
const path = require('path');

let registered = false;

const registerAllModels = () => {
  if (registered) return;
  const modelFiles = globSync('./src/models/**/*.js');
  for (const filePath of modelFiles) {
    require(path.resolve(filePath));
  }
  registered = true;
};

module.exports = { registerAllModels };
