diff options
| author | stuppie | 2026-09-02 15:08:19 -0600 |
|---|---|---|
| committer | stuppie | 2026-09-02 15:08:19 -0600 |
| commit | 81cf8de5dbcb530718eb8687b5bfab44517a6757 (patch) | |
| tree | abd2266fbffd2d50e01b0ef8d29a6fb9c9242fe8 /jb/managers/thl.py | |
| parent | 81261e52931d055df5830e29b9bf5ef81ba9134e (diff) | |
| download | amt-jb-81cf8de5dbcb530718eb8687b5bfab44517a6757.tar.gz amt-jb-81cf8de5dbcb530718eb8687b5bfab44517a6757.zip | |
stripping out some amt stuff. reject all submitted assignments. add direct work view
Diffstat (limited to 'jb/managers/thl.py')
| -rw-r--r-- | jb/managers/thl.py | 49 |
1 files changed, 3 insertions, 46 deletions
diff --git a/jb/managers/thl.py b/jb/managers/thl.py index f0534db..e50fe76 100644 --- a/jb/managers/thl.py +++ b/jb/managers/thl.py @@ -16,46 +16,7 @@ from generalresearch.models.thl.definitions import PayoutStatus from typing import Optional import requests -# TODO: Organize this more with other endpoints (offerwall, cashout -# requests/approvals, etc). - - -def get_user_profile(amt_worker_id: str) -> UserProfile: - url = f"{settings.fsb_host}{settings.product_id}/user/{amt_worker_id}/profile/" - res = requests.get(url).json() - - if res.get("detail") == "user not found": - raise ValueError("user not found") - - user_profile = res["user_profile"] - # todo: these are computed fields, need a UserProfile parser - user_profile.pop("email_md5", None) - user_profile.pop("email_sha1", None) - user_profile.pop("email_sha256", None) - # todo: this contains computed fields inside each streak object - user_profile.pop("streaks", None) - # todo: this shouldn't be in here anyways ---v - user_profile["user"].pop("id", None) - - return UserProfile.model_validate(user_profile) - - -def get_user_blocked(amt_worker_id: str) -> bool: - # Not blocked if None - res = get_user_profile(amt_worker_id=amt_worker_id) - return res.user.blocked if res.user.blocked is not None else False - - -def get_user_blocked_or_not_exists(amt_worker_id: str) -> Optional[bool]: - try: - res = get_user_profile(amt_worker_id=amt_worker_id) - return res.user.blocked if res.user.blocked is not None else False - - except ValueError as e: - if e.args[0] == "user not found": - return True - - return None +from jb.models.auth import User def get_task_status(tsid: str) -> Optional[TaskStatusResponse]: @@ -68,18 +29,14 @@ def get_task_status(tsid: str) -> Optional[TaskStatusResponse]: def user_cashout_request( - amt_worker_id: str, amount: USDCent, cashout_method_id: str + user: User, amount: USDCent, cashout_method_id: str ) -> CashoutRequestInfo: - assert cashout_method_id in { - settings.amt_assignment_cashout_method, - settings.amt_bonus_cashout_method, - } assert isinstance(amount, USDCent) assert USDCent(0) < amount < USDCent(10_00) url = f"{settings.fsb_host}{settings.product_id}/cashout/" body: dict[str, str | int] = { - "bpuid": amt_worker_id, + "bpuid": user.product_user_id, "amount": int(amount), "cashout_method_id": cashout_method_id, } |
