OperationCode / operationcode_backend

This is the backend repo for the Operation Code website
https://operationcode.org
MIT License
62 stars 110 forks source link

Slack Integration 1: Create New DB Table #318

Closed apex-omontgomery closed 6 years ago

apex-omontgomery commented 6 years ago

Feature

Why is this feature being added?

This feature is being added so that identifying information from the Slack API can be stored in the production database.

By adding a new DB we will reduce the bloat of User and allow new contributors to practice performing joins on the DB instance.

What should your feature do?


SlackUser Table

key attribute example
FK, unique user_id 20
unique slack_id "W012A3CDE"
slack_name "harry"
slack_real_name "William Michael John"
slack_display_name "Very Unoriginal"
unique slack_email "thebestwrestler@wwf.com"
apex-omontgomery commented 6 years ago

I'd like to work on this first.

hpjaj commented 6 years ago

@wimo7083 - It's yours! Let me know if you need a hand with anything.

hpjaj commented 6 years ago

When a new db table is created, you will also want to create a new SlackUser model. This is where the business logic will reside for validations, associations, etc.

apex-omontgomery commented 6 years ago

Looking at the other models I'm getting an idea of what these do. These look like the private classes that manipulate the database directly that you can expose to the endpoint handlers. Since any email changes are coming from slack I probably don't need email validation. But I could put the query in here to perform the join to find user.

Other than that not sure what custom methods I should include.

hpjaj commented 6 years ago

Yes, exactly, things like that. Here is a model that uses a variety of validations, constants, scopes, queries, and instance methods:

https://github.com/OperationCode/operationcode_backend/blob/master/app/models/git_hub_statistic.rb

hpjaj commented 6 years ago

@wimo7083 - How goes on the code review comments? Any questions?

hpjaj commented 6 years ago

@wimo7083 - We need to get this issue closed in the next few days, as it is blocking the 5 remaining Slack issues.

I can take the issue over if you don't have the bandwidth. Pls let me know ASAP.

hpjaj commented 6 years ago

completed in https://github.com/OperationCode/operationcode_backend/pull/324