{"size": 1221, "ext": "js", "max_stars_repo_path": "functions/controllers/strengthController.js", "max_stars_repo_name": "tniles320/foothillfitness-api", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "functions/controllers/strengthController.js", "max_issues_repo_name": "tniles320/foothillfitness-api", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "functions/controllers/strengthController.js", "max_forks_repo_name": "tniles320/foothillfitness-api", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.5434782609, "max_line_length": 63, "alphanum_fraction": 0.5470925471}
const { Strength } = require("../models");

// methods for the booksController
module.exports = {
  findAll: function (req, res) {
    Strength.find({})
      .then((dbStrength) => res.json(dbStrength))
      .catch((err) => {
        console.error(err);
        res.status(422).json(err);
      });
  },
  findById: function (req, res) {
    Strength.findById(req.params.id)
      .then((dbStrength) => res.json(dbStrength))
      .catch((err) => {
        console.error(err);
        res.status(422).json(err);
      });
  },
  add: function (req, res) {
    Strength.create(req.body)
      .then((dbStrength) => res.json(dbStrength))
      .catch((err) => {
        console.error(err);
        res.status(422).json(err);
      });
  },
  update: function (req, res) {
    Strength.findOneAndUpdate({ _id: req.params.id }, req.body)
      .then((dbStrength) => res.json(dbStrength))
      .catch((err) => {
        console.error(err);
        res.status(422).json(err);
      });
  },
  remove: function (req, res) {
    Strength.deleteOne({ _id: req.params.id })
      .then((dbStrength) => res.json(dbStrength))
      .catch((err) => {
        console.error(err);
        res.status(422).json(err);
      });
  },
};
