Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement user functions for dynamodb #62

Merged
merged 47 commits into from
Nov 2, 2018
Merged

Implement user functions for dynamodb #62

merged 47 commits into from
Nov 2, 2018

Conversation

chuck-sys
Copy link
Collaborator

@chuck-sys chuck-sys commented Oct 27, 2018

Pull Request

Description

Lot's of functions, predicates, and tests for getting things from dynamodb users table.

Ticket(s)

Closes #33, closes #56

@chuck-sys chuck-sys requested a review from a team as a code owner October 27, 2018 21:39
@codecov
Copy link

codecov bot commented Oct 27, 2018

Codecov Report

Merging #62 into master will increase coverage by 1.34%.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #62      +/-   ##
========================================
+ Coverage   98.65%   100%   +1.34%     
========================================
  Files           5      7       +2     
  Lines         149    199      +50     
========================================
+ Hits          147    199      +52     
+ Misses          2      0       -2
Impacted Files Coverage Δ
tests/db/dynamodb_test.py 100% <100%> (ø)
tests/db/facade_test.py 100% <100%> (+11.76%) ⬆️
tests/util.py 100% <100%> (ø)
tests/model/user_test.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d4554b...9be71df. Read the comment docs.

@chuck-sys chuck-sys changed the title Implement user functions for dynamodb [WIP] Implement user functions for dynamodb Oct 27, 2018
@chuck-sys chuck-sys changed the title [WIP] Implement user functions for dynamodb Implement user functions for dynamodb Oct 27, 2018
rwblickhan
rwblickhan previously approved these changes Oct 27, 2018
docs/Database.md Outdated
`image_url` | `String`; The user's avatar image URL
`permission_level` | `String`; The user's permission level

The user's permission levle is one of `['member', 'admin', 'team_lead']`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling ("levle").

README.md Outdated
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
```

To have it executing in the background, simply add an ampersand (&) at the end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be useful to add slightly more detail here for users that don't know much about running things in the background (i.e. what does it mean to kill a process?). That might be too complex for this though.

db/dynamodb.py Outdated


class DynamoDB:
"""DynamoDB."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This docstring could be a bit more informative.

:return: boolean value, true if table exists, false otherwise
"""
existing_tables = self.ddb.tables.all()
return any(map(lambda t: t.name == table_name, existing_tables))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

user.set_biography(response['bio'])
user.set_image_url(response['image_url'])
user.set_permissions_level(Permissions[response['permission_level']])

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a good place to do some error handling/postcondition checking. We don't want invalid users floating around if somehow we end up missing some fields in DynamoDb.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing fields in dynamodb doesn't occur because the fields cannot be blank on storage. Thus I will make a static function that validates the models (make sure that all fields are non-empty).

@chuck-sys chuck-sys merged commit c97db19 into master Nov 2, 2018
@chuck-sys chuck-sys deleted the dynamodb branch November 2, 2018 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create script for configuring aws for travis test Start DynamoDb connection class
3 participants