controller¶
Controls the engine that drives the backend for this project.
-
class
prophecypracticum.engine.controller.
Controller
¶ Bases:
object
-
add_supplicant
(prophet_id: int, supplicant_id: int) → None¶ Assign a supplicant to a prophet.
- Parameters
prophet_id – user_id for the prophet - should exist in users.
supplicant_id – user_id for the supplicant - should exist in users.
-
create_user
(username: str, user_email: str, user_id: int) → None¶ Create a user and add it to the users list.
- Parameters
username – The user’s name
user_email – The user’s email address.
user_id – The ID that identifies this user in the system.
-
get_user
(user_to_get: int) → prophecypracticum.engine.user.User¶ Return the user requested by ID.
If the user cannot be found, raise an exception because this is automated so it should never be a bad number.
- Parameters
user_to_get – The user ID of the user to get.
- Raises
error.IDError
- Returns
The requested user.
-
prophecy_completed_deliver_to_supplicant
(user_id: int) → None¶ Mark prophecy_received as True in supplicant.
The anticipated flow is that this is a method that will be run when the time for editing prophecies is over. If it finds that the prophet has delivered the prophecy, it will mark supplicant’s prophecy_received True. Then when the email method runs, it will see that this is true and send the email.
-
retrieve_prophecy_for_supplicant
(supplicant_id: int) → prophecypracticum.engine.prophecy.Prophecy¶ Retrieve prophecy from supplicant’s prophet.
- Parameters
supplicant_id – The ID of the user who needs to get their prophecy.
- Returns
A prophecy object.
-