* Add system test to create article from the editor
* Move article creation from API to app controller
* Fix system test to edit posts
* Move article update from API to app controller
* Rewrite create article API using API key
* Add main_image and canonical_url to allowed creation params
* Rewrite update article API using API key
* Fix tests and have Comments API inherit from API
* Add specs for single article functionality
* Add single article functionality
* Use article_id instead of single_article_id
* Add published: true when querying for one article
* Use article_id in specs oops
* Add basic tests for Analytics service
* User/Organization are always required
* Add some data to the test
* Use queries and date times
* Fix AnalyticsService interface in the controller
* s/HTTP_API_KEY/api-key
* Defend against nils and support datetime objects
* Update app/services/analytics_service.rb
Co-Authored-By: rhymes <rhymesete@gmail.com>
* Use SQL sum, not Rails sum
* Group average_read_time
* Use SQL, not Rails
* Use ISO date
* Fix specs
* Add API endpoints for analytics
* Remove comment and spacing
* Use proper time formatting
* Refactor and clean up some logic
* Add pro and org member traits
* Use shared examples for analytics API spec
* Add analytics authorization specs
* Remove accidental include Pundit
* Raise not_authorized for invalid requests
* Make attributes and time methods private
* Add custom UnauthorizedError
* Raise and use rescue_from to handle 4xx requests
* Enforce date parameters to follow a specific format
* Use current user to allow same origin requests
* Use custom headers and not params for token auth
* Default to current user for same origin requests
* Use correct boolean for choosing user
* Update tests to use request headers and add stricter tests