[api] Enable commenting projects and packages through API

Refactoring a bit the comments models and controller and adding some extra tests in the process.