{"size": 451, "ext": "js", "max_stars_repo_path": "routes/todolist/service.js", "max_stars_repo_name": "allevo/fastplace", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "routes/todolist/service.js", "max_issues_repo_name": "allevo/fastplace", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "routes/todolist/service.js", "max_forks_repo_name": "allevo/fastplace", "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": 18.7916666667, "max_line_length": 89, "alphanum_fraction": 0.6518847007}
'use strict'

class TodoListService {
  constructor (collection, log) {
    this.collection = collection
    this.log = log
  }

  async createTodo ({ name, tags }) {
    const result = await this.collection.insertOne({ name, tags, createdAt: new Date() })

    return result.ops[0]
  }

  async listTodo () {
    const cur = this.collection.find()
    const result = await cur.toArray()

    return result
  }
}

module.exports = { TodoListService }
