Skip to content

Commit

Permalink
Added Automated Invoicing, Refactoring, Bug Fixes with Migration
Browse files Browse the repository at this point in the history
  • Loading branch information
abaveja313 committed May 31, 2021
1 parent 338977d commit c93b611
Show file tree
Hide file tree
Showing 28 changed files with 209 additions and 63 deletions.
2 changes: 1 addition & 1 deletion admin-dashboard/backend/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re

from shared.models.dashboard_entities import AdminDashboardUser
from shared.service.jwt_auth_config import JWTAuthManager
from shared.service.jwt_auth_wrapper import JWTAuthManager

SCHOOL_REGEX: re.Pattern = re.compile('(?P<school>.+)-admin', flags=re.I)

Expand Down
6 changes: 3 additions & 3 deletions admin-dashboard/backend/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
SymptomConfigRetriever,
UserHealthItem, UserLocationItem)
from shared.models.user_entities import HealthReport
from shared.service.flower_config import FlowerAPI
from shared.service.neo_config import Neo4JGraph, current_day_node
from shared.service.vault_config import VaultConnection
from shared.service.flower_api import FlowerAPI
from shared.service.neo4j_api import Neo4JGraph, current_day_node
from shared.service.vault_api import VaultConnection

from .authorization import OIDC_COOKIE

Expand Down
2 changes: 1 addition & 1 deletion admin-dashboard/backend/user_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
MemberAccessInfo,
MultipleMemberAccessInfo,
UserRolesResponse)
from shared.service.neo_config import Neo4JGraph
from shared.service.neo4j_api import Neo4JGraph

from .authorization import OIDC_COOKIE

Expand Down
9 changes: 9 additions & 0 deletions admin-dashboard/static/assets/js/manage-users.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ function userSelectionChange(checkbox) {
*/
function showModifyModal() {
$("#modify-users").modal("show");
$.get("/user/current-user-roles", function () {
console.log("Got Current User Roles");
}, "json").done(function (data) {
if (data.roles.length > 1){
$("#switch-report").show();
$("#campus-history-warning").show();
$("#delete-campus-history-btn").show();
}
}).fail(requestFailure)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion admin-dashboard/static/assets/js/manage-users.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions admin-dashboard/templates/components/modify-users-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,38 @@ <h5 class="modal-subheader">Toggle Access</h5>
</table>
</div>

<div class="password-reset"><br>
<div id="password-reset"><br>
<h5 class="modal-subheader">Resend Invitation</h5>
<p style="font-size: 15px;">If a user does not redeem their invitation in 48 hours, their link will expire. You
can re-send invites to those users here.</p>
<button id="password-reset-btn" onclick='submitCheckedPasswordReset()' class="btn btn-warning btn-reduced">
Resend Invite
</button>
</div>
<div class="switch-report"><br>
<div id="switch-report" style="display:none"><br>
<h5 class="modal-subheader">Switch Reporting Campus</h5>
<p style="font-size: 15px;">You can switch a user between MarinTrace campuses you have administrator permissions
for. Please note that their report history will not transfer from school to school—a new history will be created at each campus. Inactive campuses will be read-only.</p>
for. Please note that their report history will not transfer from school to school—a new history will be
created at each campus. Inactive campuses will be read-only.</p>
<button id="switch-report-btn" onclick='submitSwitchReport()' class="btn btn-warning btn-reduced">
Switch Campus
</button>
</div>
<div class="delete-users"><br>
<div id="delete-users"><br>
<h5 class="modal-subheader">Permanently Delete</h5>
<p style="font-size: 15px;">The button below will remove a user's access to MarinTrace and delete their report
history and contacts. Please note
that this is not reversible, and the deleted information cannot be recovered. If you have access to multiple
campuses, you can use the "Delete Campus History" button to clear only
the report history for a specific campus.</p>
that this is not reversible, and the deleted information cannot be recovered.
<div id="campus-history-warning" style="display: none">Since you have access to multiple
campuses, you can use the "Delete Campus History" button to clear the user's
report history for the current campus (but keeping it everywhere else).
</div>
</p>
<button class="btn btn-danger btn-reduced" id="delete-users-btn" onclick="submitCheckedDeleteUsers()">Delete
Users
</button>
<button class="btn btn-secondary btn-reduced" id="delete-users-btn" onclick="submitCheckedDeleteUsers()">Delete
<button class="btn btn-secondary btn-reduced" id="delete-campus-history-btn" style="display: none"
onclick="submitCheckedDeleteUsers()">Delete
Campus History
</button>

Expand Down
Empty file removed celery/celery_notifier.py
Empty file.
1 change: 1 addition & 0 deletions celery/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
gql==2.0.0
boto3==1.13.24
amqp==2.6.1
celery==4.4.5
Expand Down
2 changes: 1 addition & 1 deletion celery/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from celery import signals
from shared.logger import logger
from shared.service.celery_config import get_celery
from shared.service.celery_wrapper import get_celery

from .notification_tasks import notify_risk
from .reporting_tasks import (report_active_user, report_health,
Expand Down
8 changes: 4 additions & 4 deletions celery/tasks/notification_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from shared.logger import logger
from shared.models.risk_entities import UserHealthItem
from shared.models.user_entities import User
from shared.service.celery_config import GLOBAL_CELERY_OPTIONS, get_celery
from shared.service.email_config import SendgridAPI
from shared.service.neo_config import Neo4JGraph
from shared.service.vault_config import VaultConnection
from shared.service.celery_wrapper import GLOBAL_CELERY_OPTIONS, get_celery
from shared.service.sendgrid_api import SendgridAPI
from shared.service.neo4j_api import Neo4JGraph
from shared.service.vault_api import VaultConnection

RiskTier = namedtuple('RiskTier', ['depth'])

Expand Down
8 changes: 4 additions & 4 deletions celery/tasks/reporting_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from shared.models.enums import UserStatus, VaccinationStatus
from shared.models.risk_entities import ScoredUserHealthItem
from shared.models.user_entities import HealthReport, InteractionReport, User
from shared.service.celery_config import GLOBAL_CELERY_OPTIONS, get_celery
from shared.service.neo_config import Neo4JGraph, current_day_node
from shared.service.celery_wrapper import GLOBAL_CELERY_OPTIONS, get_celery
from shared.service.neo4j_api import Neo4JGraph, current_day_node

celery = get_celery()

Expand Down Expand Up @@ -137,7 +137,7 @@ def report_vaccination(self, *, sender: User, task_data: UpdateVaccinationReques
:param task_data: API request from API
"""
logger.info("Setting authorized user's vaccination status to 'vaccinated'")
update_user_properties(sender=sender, data={'vaccinated': task_data.status})
update_user_properties(sender=sender, data={'vaccinated': task_data.status}, change_all_nodes=True)


@celery.task(name='tasks.report_active_user', **GLOBAL_CELERY_OPTIONS)
Expand All @@ -159,4 +159,4 @@ def report_location_status(self, *, sender: User, task_data: UpdateLocationReque
:param task_data: API request from API
"""
logger.info(f"Setting authorized user's location state to {task_data.location}... authorized by {sender.email}")
update_user_properties(sender=sender, data={'location': task_data.location})
update_user_properties(sender=sender, data={'location': task_data.location}, change_all_nodes=False)
Loading

0 comments on commit c93b611

Please sign in to comment.