-
-
Notifications
You must be signed in to change notification settings - Fork 37
Database
On the contrary of the previous version, this use PostgreSQL as a production and development database. But it has an API to allow the export and reuse of the data.
We simplified a lot the schema as we had only 10 days to develop the tool. Also, we take advantage of the versatility of Rails framework to simplify what we could.
To contribute to the website, you must login as a user. A nickname, email and password are necessary. Admins are flagged through a boolean value, only other admins can change.
Created through the devise gem. Password are encrypted using bcrypt gem.
Analyses submitted by users.
belongs_to :user belongs_to :topic belongs_to :service has_one :reason
- "user_id": all points are linked to the user that created them
- "rank" (default: 0): all created points have a default rank of 0. Rank is used to sort the point and allow users to upvote or downvote them.
- "title": Title of the point. Cannot be blank.
- "source": Source of the ToS. Cannot be blank.
- "status": Status of the point, when created is "pending". Admins review it change it to "approved", "declined" or "disputed". When the status is declined, admins must give a reason that will be sent to the users. Cannot be null (nil).
- "analysis": The actual analysis. Cannot be blank.
- "rating": Rating of the point, integer. To choose between 0 and 10. Cannot be blank.
- "featured", default: false: (Admins only). Allow admins to feature the point on the card on the front page.
- "topic_id": Foreign key to the topic the point is linked to. Cannot be blank.
- "service_id": Foreign key to the service the point is linked to. Cannot be blank.
Reasons appear when points are declined by admins. They are sent to users as a explanation why their point was dismissed.
belongs_to :user belongs_to :point
- "reason": Text of the reason. Cannot be blank.
- "user_id": User id to which the reason is linked.
- "point_id": Point id to which the reason is linked.
Services to which the points are linked. Only admins can create services but user can request the creation of new services.
has_many :points
- "name": name of the service. Cannot be blank.
- "url": url of the service. Cannot be blank.
- "grade": grade of the service. Calculated automatically from the average of the ratings of this service
Topics are categories of services. Only admins can create topics.
has_many :points
- "title": Title of the topic. Cannot be blank.
- "Subtitle": Subtitle of the topic. Cannot be blank.
- "Description": Description of the topic. Cannot be blank.