{"size": 1143, "ext": "js", "max_stars_repo_path": "src/controllers/adItem.js", "max_stars_repo_name": "dangolbeeker/adserver-tut", "max_stars_repo_stars_event_min_datetime": "2020-08-18T14:29:10.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-25T06:43:09.000Z", "max_issues_repo_path": "src/controllers/adItem.js", "max_issues_repo_name": "dangolbeeker/adserver-tut", "max_issues_repo_issues_event_min_datetime": "2020-08-13T07:23:55.000Z", "max_issues_repo_issues_event_max_datetime": "2020-09-11T06:11:02.000Z", "max_forks_repo_path": "src/controllers/adItem.js", "max_forks_repo_name": "dangolbeeker/adserver-tut", "max_forks_repo_forks_event_min_datetime": "2020-08-18T15:15:50.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-13T23:08:37.000Z"}
{"max_stars_count": 59, "max_issues_count": 21, "max_forks_count": 25, "avg_line_length": 25.4, "max_line_length": 71, "alphanum_fraction": 0.5258092738}
import AdItem from "./../models/adItem";

export default {
  list: query => {
    return new Promise((resolve, reject) => {
      AdItem.find(query)
      .then(res => {
        if (res) console.log({ query }, "Lists AdItems");
        return resolve(res);
      })
      .catch(error => reject(error));
    });
  },
  retrieve: query => {
    return new Promise((resolve, reject) => {
      AdItem.findOne(query).lean().exec()
      .then(res => {
        if (res) console.log({ query }, "Retrieves AdItem");
        return resolve(res);
      })
      .catch(error => reject(error));
    });
  },
  create: query => {
    return new Promise((resolve, reject) => {
      AdItem.create(query)
      .then(res => {
        if (res) console.log({ query }, "Creates AdItem");
        return resolve(res);
      })
      .catch(error => reject(error));
    });
  },
  delete: query => {
    return new Promise((resolve, reject) => {
      AdItem.deleteMany(query)
      .then(res => {
        if (res.deletedCount) console.log({ query }, "Deletes AdItem");
        return resolve(res);
      })
      .catch(error => reject(error));
    });
  }
}
