Coder Social home page Coder Social logo

colisee-lib's People

Contributors

hannahstroble avatar matthewqualls avatar michael-beaver avatar russleyshaw avatar user404d avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

tarnasa

colisee-lib's Issues

Add middleware for error handling and logging

Error handling middleware should:

  • Accept any base error and turn it into a 500 and return it
  • Accept any http-error and return it
  • Log any non 5XX messages as debug or similar level
  • Log any 5XX messages as critical or similar level

The logging middleware should:

  • Log the following information as debug or similar level:
    • Requesting IP
    • Requesting Method
    • Requesting Path (including query params)
    • Request body size

Modify the teams table

We need to add three more columns to the teams table in the database. They shouldn't affect any other tables.

  • a "salt" column that contains a string
  • a "hash_iterations" (or similar name) column that contains a number
  • a "role" column that can have the values ["user", "admin"]
  • a "contact_name" column that contains a string

Please let me know if there is anything else you need to know

Consolidate helper functions and common functionality

Survey common helper functions used in colisee services along with other common functionality used and add them to this library. Reduces number of places that need to be touched when an api changes and reduces the chances for helpers and other ad hoc functionality from being implemented incorrectly between services.

Edited and New Tables for the website

The website is going to need some new tables and shift around the team table a bit to support new features that we want to have before MegaMiner. These changes should integrate a user + team system, instead of the teams just being synonymous with users, as well as adding a submissions metadata table that may have more added on later

From looking at previous commits I think I should hopefully be able to tackle this myself and put up a PR, but I still would appreciate some input on it, especially some of the data types

Worth noting, I don't think these changes should/could be pushed to chess.siggame.io. We could argue that the submissions_metadata could be put there (and maybe it should?) but I have a feeling that it will cause some unforeseen problems trying to set up the new table on the already existing database.

Existing tables

teams

Current Teams Table New Teams Table
Field type
id int4
name varchar
contact_email varchar
contact_name varchar
hash_iterations int4
is_eligible bool
password varchar
role text
salt varchar
created_at timestamp
updated_at timestamp
Field type
id int4
name varchar
is_eligible bool
is_paid bool
is_closed bool
team_captain_id int4
created_at timestamp
updated_at timestamp
  • Where team_captain is a foreign key to the users table.
  • The teams table no longer needs any of the user specific information, and we decided that whoever creates the team will become team captain and will be the one who can send out invites to the team.
  • I am not sure what the best type would be for the profile_pic column, any input?

New Tables:

users

Field type
id int4
name varchar
contact_email varchar
contact_name varchar
hash_iterations int4
password varchar
salt varchar
role text
form_response JSON
active bool: default false
bio varchar
profile_pic bytea (?)
created_at timestamp
updated_at timestamp
  • This is the new users table, the only new entry really is the form_response field, which we figured is where we would put the responses to the form that asks shirt size and pizza preferences, that way we don't need to make database changes if the questions change.
  • Edit: I also added an 'active' field for email verification so they have to click on their email to activate their account

teams_users

Field type
id int4
team_id int4
user_id int4
created_at timestamp
updated_at timestamp
  • Where team_id and user_id are foreign keys to their respective tables. This is to reference which user is on which team

invites

Field type
id int4
team_id int4
user_id int4
is_completed bool
created_at timestamp
updated_at timestamp
  • These are where the invites will go, whenever someone invites another person onto their team it is stored in here, the is_completed field is to show whether or not the invitation has been accepted or rejected.

submissions_metadata

Field type
id int4
submission_id int4
label varchar
label_color varchar
created_at timestamp
updated_at timestamp
  • Where submission_id is a foreign key to the submissions table
  • This table will be for meta data that users add on to their submissions. For now the only thing we have to add is a label and a color for the label, but there is room for expanding this later on.
  • Is there a more appropriate type for the label_color ? It will likely just be a hex code, but after some research I didn't find a standard way to store that.

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.