ASWWU-Web / python_server

The API server for ASWWU Web. This project uses the Tornado web framework to serve and manage data across all ASWWU sites.
https://aswwu.com/server
4 stars 10 forks source link

WIP: New Notification System #162

Closed stacmi closed 2 months ago

stacmi commented 4 years ago

This is a WIP - Do Not Merge - this code is not in working condition yet

purpose

This pull request is for collaboration on the new system which is not yet finished

notes

new endpoints for notifications consistiong of

Currently there is only skeleton code for POST which still needs a lot of work

ermsdev commented 4 years ago

A few of thoughts for this:

stacmi commented 4 years ago

moved the notifications code into homepage and then started creating the notifications db

codecov[bot] commented 4 years ago

Codecov Report

Attention: Patch coverage is 33.12883% with 109 lines in your changes missing coverage. Please review.

Project coverage is 47.57%. Comparing base (4c93cec) to head (b848b7b). Report is 77 commits behind head on develop.

Files Patch % Lines
src/aswwu/route_handlers/homepage.py 22.95% 47 Missing :warning:
src/aswwu/alchemy_new/notifications.py 34.09% 29 Missing :warning:
src/aswwu/validators/notifications.py 23.07% 20 Missing :warning:
src/aswwu/models/bases.py 36.84% 12 Missing :warning:
src/aswwu/models/notifications.py 91.66% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #162 +/- ## =========================================== - Coverage 48.35% 47.57% -0.78% =========================================== Files 29 32 +3 Lines 3032 3195 +163 =========================================== + Hits 1466 1520 +54 - Misses 1566 1675 +109 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

stacmi commented 4 years ago

@stephenermshar

There is an issue setting the current user of the session. Issue appears when adding the decorator @tornado.web.authenticated where the issue of current_user has no attribute username come up. Need to look into it more as currently using postman requests to test the new changes.

Core functionality works. Working on adding authentication and validators.

ermsdev commented 4 years ago

what's in your settings.py file?

stacmi commented 4 years ago
keys = {
    'hmac':"fakekeystring",
    'samlEndpointKey': "fakekeystring"
}
testing = {
    'pytest': False,  # enables access to roles endpoint, set to false in production
    'dev': True,  # bypasses authentication and logs in `developer`
    'developer': 2024971,
    'base_url': 'http://127.0.0.1',
    'port': 8888,
    'log_name': 'aswwu_test',
    'current_year': '1920',
    'database': './testing_databases',
}
production = {
    'port': 8888,
    'log_name': 'aswwu',
    'current_year': '1920',
}
email = {
    'username': 'aswwu.webmaster@wallawalla.edu',
    'password': 'fakepassword'
}
database = {
    'location': './testing_databases'
}
ermsdev commented 4 years ago

This could be related to the database['location'] variable being set to './testing_databases' rather than your actual local database. the poeople.db in './testing_databases' should not contain your wwuid since it's intended for automated pytests, not running the server locally. There's a new settings.py file I'm working on that should address that issue. Until then, make sure you have a copy of the full database in a folder on the same level as your python repository, and set

database = {
    'location': '../databases'
}
stacmi commented 4 years ago

Code is up to date.

Core functionality tested and working using postman requests.

secured the endpoint for post/put requests.

ermsdev commented 4 years ago

quick reminders from today's meeting:

If sqlite/sqlalchemy supports boolean types for columns we should use a boolean value for visible and archived instead of an integer.

ermsdev commented 4 years ago

To make sure this project is in a good state when the school year ends, I think it would be good to prepare it for deployment and have it running on the live server early this week. Until the frontend administration components are finished we'll have to add and remove notifications with SQL through SSH, which is still an improvement over redeploying the frontend site with html notifications.

this week make sure: