Giter Club home page Giter Club logo

hb_project's Introduction

README

Ruby version: 2.6.3 / Rails version: 6.0.3

A model UserAttribute (hb_project/app/models/user_attribute.rb) allows to store custom attributes for a User. The types Boolean and String are supported through the property field_type.
A model User (hb_project/app/models/user.rb) represents the users, with a role property to defined whether they are a basic user or an admin.
A model UserAttributeValue (hb_project/app/models/user_attribute_value.rb) has been created to act as a join model between User and UserAttribute. A many-to-many relation links them all together. This is the place where the specific values of the custom attributes will be stored for the users.

The same logic applies for Event, EventAttribute and EventAttributeValue. I could have used only one class for EventAttribute and UserAttribute but since both could evolve differently I prefered to keep the two features separated.

As requested by the exercise, the following criterias must be supported:

  • Admin manages the global User custom attributes
    Done through hb_project/test/models/user_attribute_test.rb
  • Admin manages a specific Event’s custom attributes
    Done through hb_project/test/models/event_attribute_test.rb
  • Admin makes a custom attribute optional/required on the User profile
    Done through hb_project/test/models/user_attribute_test.rb
  • Admin makes a custom attribute optional/required on the User signup form
    Done through hb_project/test/models/user_attribute_test.rb
  • Admin makes a custom attribute optional/required on a specific Event Registration form
    Done through hb_project/test/models/event_attribute_test.rb
  • User fills in a custom attribute on his profile
    Done through hb_project/test/models/user_test.rb
  • User fills in a custom attribute on the signup form
    Done through hb_project/test/models/user_test.rb
  • User fills in a custom attribute on an Event Registration form
    Done through hb_project/test/models/event_test.rb
  • User reads his custom attributes on his profile
    Done through hb_project/test/models/user_test.rb
  • Admin reads an Event registration’s custom attributes
    Done through hb_project/test/models/event_test.rb

All those tests can be launched in a Docker container with docker/run rails test -v. The command docker/setup is also available for a first setup.
The default test framework provided by Rails 6 was used.

For the moment, everything highly relies on models. On a second step it could be good to abstract some logic into service classes.

hb_project's People

Contributors

franckduche avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.