Javi Martín
6fd9a286d7
Don't access the database in after_initialize
...
Rails 5.2 crashes in the `db:create` task because it tries to run the
`after_initialize` block before the database is created.
The easiest way to solve it is to move the code out of the initializer
and calculate the API type definitions on demand. Note results are still
cached using a class instance variable (not to be confused with a class
variable), and so once definitions are obtained, they will remain
constant until the application is restarted, even in the development
environment.
2020-07-08 18:34:58 +02:00
Javi Martín
8b5cca746c
Apply rubocop rules to freeze constants
...
Added by popular demand among our team members.
2019-10-26 13:21:36 +02:00
Javi Martín
db97f9d08c
Add and apply rubocop rules for empty lines
...
We were very inconsistent regarding these rules.
Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.
The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.
[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Javi Martín
f9ed186909
Add rubocop spacing rules
...
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
Julian Herrero
002e16ce30
Use double quotes in lib/
2019-03-15 10:29:07 +01:00
Bertocq
c4d90691b1
Fix all Layout/SpaceInLambdaLiteral rubocop issues and remove files from rubocop_todo list
2017-06-26 18:05:14 +02:00
Alberto Miedes Garcés
9ec8b166d7
Use scopes for better query performance
2017-06-01 20:04:51 +02:00
Alberto Miedes Garcés
18db68a430
Force pagination, limit query depth and complexity
2017-05-29 09:47:39 +02:00
Alberto Miedes Garcés
ad8aba0739
Revised public fields, wrote more exhaustive specs
2017-05-15 20:22:11 +02:00
Alberto Miedes Garcés
c52602e04b
Simplify the way ApiTypesCreator is used
2017-01-27 13:13:19 +01:00
Alberto Miedes Garcés
620c83fb69
Simplify the way QueryTypeCreator is used
2017-01-27 12:54:33 +01:00
Alberto Miedes Garcés
073ce38a8d
Improved API docs autogeneration
2017-01-27 12:39:44 +01:00
Alberto Miedes Garcés
14798deab0
Fix bug in singular_association resolver
2017-01-26 12:00:01 +01:00
Alberto Miedes Garcés
83267330a7
Group methods related to text generation for GraphQL documentation into a module
2017-01-26 10:47:12 +01:00
Alberto Miedes Garcés
e3fca5c49f
Remove functionality related to votes demographic info
...
Since this was giving me too much pain and nobody actually requested
this functionality, I decided to remove it.
2017-01-25 13:37:29 +01:00
Alberto Miedes Garcés
0107ddce11
Fix bug when resolving multiple associations
2017-01-16 11:24:02 +01:00
Alberto Miedes Garcés
d2a8d509b6
Cleaning
2017-01-13 01:21:59 +01:00
Alberto Miedes Garcés
d1f14ffb93
Simplify the way GraphQL 'resolve' is used
2017-01-12 19:51:58 +01:00
Alberto Miedes Garcés
b0bd30e3d1
Move api config file parsing method into the ApiTypesCreator class
2017-01-09 13:36:53 +01:00
Alberto Miedes Garcés
60786f17c2
Improved code coverage for GraphQL resolvers specs
2017-01-09 10:14:31 +01:00
Alberto Miedes Garcés
e1b3d468e5
Fix failing spec
2017-01-08 14:27:20 +01:00
Alberto Miedes Garcés
398bc8c211
Split api types creation and query type creation between two different classes
2017-01-08 13:39:50 +01:00
Alberto Miedes Garcés
b9d2bc2801
Wrote specs for QueryType creation
2017-01-08 12:45:48 +01:00
Alberto Miedes Garcés
7027164867
Clean code
2017-01-08 11:37:56 +01:00
Alberto Miedes Garcés
ed6ba384dd
Wrote specs for GraphQL root resolvers
2017-01-08 11:37:15 +01:00
Alberto Miedes Garcés
0b302c2afc
Move code from GraphQL initializer into GraphQL::TypeCreator
2017-01-07 23:04:30 +01:00
Alberto Miedes Garcés
d76e4518e6
Extract QueryRoot resolve functions into its own classes
2017-01-07 22:43:42 +01:00
Alberto Miedes Garcés
3c73f35416
Removed useless code
2017-01-07 22:20:28 +01:00
Alberto Miedes Garcés
9cfb3eb52e
Write specs for GraphQL::AssociationResolver
2017-01-03 18:30:53 +01:00
Alberto Miedes Garcés
cdc3b46370
Extract TypeCreator methods into AssociationResolver class
2017-01-03 16:52:13 +01:00
Alberto Miedes Garcés
4e12e9055c
Refactor GraphQL::TypeCreator
2017-01-03 16:27:11 +01:00
Alberto Miedes Garcés
4783f14eb4
Show voter info in api
2017-01-02 00:13:16 +01:00
Alberto Miedes Garcés
7dc4d80e7b
Read GraphQL field types from file instead of from database
2017-01-01 19:36:07 +01:00
Alberto Miedes Garcés
0aed5338f6
Customize resolvers to only permit allowed records
2016-12-29 14:17:44 +01:00
Alberto Miedes Garcés
402b07d959
Expose Proposal public_author using scopes instead of modules
2016-12-13 14:04:53 +01:00
Alberto Miedes Garcés
82954c922a
Expose public_author for proposals
2016-12-11 15:42:17 +01:00
Alberto Miedes Garcés
b2730b6239
DRY GraphQL::TypeCreator
2016-12-11 15:20:17 +01:00
Alberto Miedes Garcés
42355e770c
Fixed bug related to wrong use of GraphQL::Relay connection helper
2016-12-11 12:22:15 +01:00
Alberto Miedes Garcés
d1e1ee9d41
Moved api_types into TypeCreator
2016-11-30 13:43:10 +01:00
Alberto Miedes Garcés
6fca1f02fe
Added clarifying comments related to GraphQL return types
2016-11-17 17:23:57 +01:00
Alberto Miedes Garcés
36bdad8851
Fixed bug in GraphQL::TypeCreator
2016-11-17 17:23:27 +01:00
Alberto Miedes Garcés
195d1c5f69
Fixed bug in GraphQL::TypeCreator
2016-11-14 15:11:41 +01:00
Alberto Miedes Garcés
fc2d4fda5b
Fixed bug in TypeCreator and improved field descriptions
2016-11-11 12:52:54 +01:00
Alberto Miedes Garcés
59a355df1b
First working version of new GraphQL::TypeCreator after major refactoring
2016-11-10 20:53:15 +01:00