diff --git a/frontend/src/components/auth/GoogleAuthComponent.tsx b/frontend/src/components/auth/GoogleAuthComponent.tsx index 455cbfe..de010f7 100644 --- a/frontend/src/components/auth/GoogleAuthComponent.tsx +++ b/frontend/src/components/auth/GoogleAuthComponent.tsx @@ -33,6 +33,7 @@ const GoogleAuthComponentInner = () => { addAlert(humanReadableError(error), "error"); } finally { setCredential(null); + setDisableButton(false); } } })(); @@ -41,10 +42,10 @@ const GoogleAuthComponentInner = () => { const login = useGoogleLogin({ onSuccess: (tokenResponse) => { const returnedCredential = tokenResponse.access_token; - if (returnedCredential === undefined) { - addAlert("Failed to login using Google OAuth.", "error"); - } else { + if (returnedCredential) { setCredential(returnedCredential); + } else { + addAlert("Failed to login using Google OAuth.", "error"); } }, onError: () => { diff --git a/linguaphoto/crud/base.py b/linguaphoto/crud/base.py index af09bd2..47c789c 100644 --- a/linguaphoto/crud/base.py +++ b/linguaphoto/crud/base.py @@ -9,7 +9,7 @@ from redis.asyncio import Redis from types_aiobotocore_dynamodb.service_resource import DynamoDBServiceResource -from photolingo.settings import settings +from linguaphoto.settings import settings logger = logging.getLogger(__name__) diff --git a/linguaphoto/crud/robots.py b/linguaphoto/crud/robots.py index 0281791..aaa392e 100644 --- a/linguaphoto/crud/robots.py +++ b/linguaphoto/crud/robots.py @@ -2,8 +2,8 @@ import logging -from photolingo.crud.base import BaseCrud -from photolingo.model import Part, Robot +from linguaphoto.crud.base import BaseCrud +from linguaphoto.model import Part, Robot logger = logging.getLogger(__name__) diff --git a/linguaphoto/crud/users.py b/linguaphoto/crud/users.py index 39058a3..031c952 100644 --- a/linguaphoto/crud/users.py +++ b/linguaphoto/crud/users.py @@ -6,9 +6,9 @@ from boto3.dynamodb.conditions import Key as KeyCondition -from photolingo.crud.base import BaseCrud -from photolingo.crypto import hash_api_key -from photolingo.model import ApiKey, User +from linguaphoto.crud.base import BaseCrud +from linguaphoto.crypto import hash_api_key +from linguaphoto.model import ApiKey, User class UserCrud(BaseCrud): @@ -71,5 +71,5 @@ async def test_adhoc() -> None: if __name__ == "__main__": - # python -m store.app.crud.users + # python -m linguaphoto.crud.users asyncio.run(test_adhoc()) diff --git a/linguaphoto/db.py b/linguaphoto/db.py index 811c632..3be4bb3 100644 --- a/linguaphoto/db.py +++ b/linguaphoto/db.py @@ -4,9 +4,9 @@ import logging from typing import AsyncGenerator, Self -from store.app.crud.base import BaseCrud -from store.app.crud.robots import RobotCrud -from store.app.crud.users import UserCrud +from linguaphoto.crud.base import BaseCrud +from linguaphoto.crud.robots import RobotCrud +from linguaphoto.crud.users import UserCrud class Crud( @@ -44,28 +44,8 @@ async def create_tables(crud: Crud | None = None) -> None: ("emailIndex", "email", "S", "HASH"), ], ) - await crud._create_dynamodb_table( - name="Robots", - keys=[ - ("robot_id", "S", "HASH"), - ], - gsis=[ - ("ownerIndex", "owner", "S", "HASH"), - ("nameIndex", "name", "S", "HASH"), - ], - ) - await crud._create_dynamodb_table( - name="Parts", - keys=[ - ("part_id", "S", "HASH"), - ], - gsis=[ - ("ownerIndex", "owner", "S", "HASH"), - ("nameIndex", "name", "S", "HASH"), - ], - ) if __name__ == "__main__": - # python -m store.app.db + # python -m linguaphoto.db asyncio.run(create_tables()) diff --git a/linguaphoto/main.py b/linguaphoto/main.py index 9baa97e..0ad5a48 100644 --- a/linguaphoto/main.py +++ b/linguaphoto/main.py @@ -4,10 +4,10 @@ from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse -from store.app.routers.part import parts_router -from store.app.routers.robot import robots_router -from store.app.routers.users import users_router -from store.settings import settings +from linguaphoto.routers.part import parts_router +from linguaphoto.routers.robot import robots_router +from linguaphoto.routers.users import users_router +from linguaphoto.settings import settings app = FastAPI() diff --git a/linguaphoto/model.py b/linguaphoto/model.py index 698cdb4..cbc571f 100644 --- a/linguaphoto/model.py +++ b/linguaphoto/model.py @@ -9,7 +9,7 @@ from pydantic import BaseModel -from store.app.crypto import hash_api_key +from linguaphoto.crypto import hash_api_key class User(BaseModel): diff --git a/linguaphoto/routers/part.py b/linguaphoto/routers/part.py index b223c4f..4e05c23 100644 --- a/linguaphoto/routers/part.py +++ b/linguaphoto/routers/part.py @@ -5,10 +5,10 @@ from fastapi import APIRouter, Depends, HTTPException -from photolingo.crypto import get_new_user_id -from photolingo.db import Crud -from photolingo.model import Part -from photolingo.routers.users import ApiKeyData, get_api_key +from linguaphoto.crypto import get_new_user_id +from linguaphoto.db import Crud +from linguaphoto.model import Part +from linguaphoto.routers.users import ApiKeyData, get_api_key parts_router = APIRouter() diff --git a/linguaphoto/routers/robot.py b/linguaphoto/routers/robot.py index 331abcc..a492ceb 100644 --- a/linguaphoto/routers/robot.py +++ b/linguaphoto/routers/robot.py @@ -5,10 +5,10 @@ from fastapi import APIRouter, Depends, HTTPException -from photolingo.crypto import get_new_user_id -from photolingo.db import Crud -from photolingo.model import Robot -from photolingo.routers.users import ApiKeyData, get_api_key +from linguaphoto.crypto import get_new_user_id +from linguaphoto.db import Crud +from linguaphoto.model import Robot +from linguaphoto.routers.users import ApiKeyData, get_api_key robots_router = APIRouter() diff --git a/linguaphoto/routers/users.py b/linguaphoto/routers/users.py index 8e36d93..df73eb0 100644 --- a/linguaphoto/routers/users.py +++ b/linguaphoto/routers/users.py @@ -10,10 +10,10 @@ from fastapi.security.utils import get_authorization_scheme_param from pydantic.main import BaseModel -from photolingo.crypto import get_new_api_key, get_new_user_id -from photolingo.db import Crud -from photolingo.model import User -from photolingo.utils.email import OneTimePassPayload, send_delete_email, send_otp_email +from linguaphoto.crypto import get_new_api_key, get_new_user_id +from linguaphoto.db import Crud +from linguaphoto.model import User +from linguaphoto.utils.email import OneTimePassPayload, send_delete_email, send_otp_email logger = logging.getLogger(__name__) diff --git a/linguaphoto/settings/__init__.py b/linguaphoto/settings/__init__.py index 22ab2ba..74baf7d 100644 --- a/linguaphoto/settings/__init__.py +++ b/linguaphoto/settings/__init__.py @@ -7,7 +7,7 @@ from dotenv import load_dotenv from omegaconf import OmegaConf -from photolingo.settings.environment import EnvironmentSettings +from linguaphoto.settings.environment import EnvironmentSettings T = TypeVar("T") @@ -19,9 +19,9 @@ def _check_exists(path: Path) -> Path: def _load_environment_settings() -> EnvironmentSettings: - if "PHOTOLINGO_ENVIRONMENT_SECRETS" in os.environ: - load_dotenv(os.environ["PHOTOLINGO_ENVIRONMENT_SECRETS"]) - environment = os.environ["PHOTOLINGO_ENVIRONMENT"] + if "LINGUAPHOTO_ENVIRONMENT_SECRETS" in os.environ: + load_dotenv(os.environ["LINGUAPHOTO_ENVIRONMENT_SECRETS"]) + environment = os.environ["LINGUAPHOTO_ENVIRONMENT"] base_dir = (Path(__file__).parent / "configs").resolve() config_path = _check_exists(base_dir / f"{environment}.yaml") config = OmegaConf.load(config_path) diff --git a/linguaphoto/settings/configs/production.yaml b/linguaphoto/settings/configs/production.yaml index 8e79260..f32d1c2 100644 --- a/linguaphoto/settings/configs/production.yaml +++ b/linguaphoto/settings/configs/production.yaml @@ -1,6 +1,6 @@ crypto: jwt_secret: ${oc.env:JWT_SECRET} site: - homepage: https://photolingo.co - image_url: https://media.photolingo.co - api: https://api.photolingo.co + homepage: https://linguaphoto.com + image_url: https://media.linguaphoto.com + api: https://api.linguaphoto.com diff --git a/linguaphoto/settings/environment.py b/linguaphoto/settings/environment.py index e50f5cc..9957abd 100644 --- a/linguaphoto/settings/environment.py +++ b/linguaphoto/settings/environment.py @@ -7,8 +7,8 @@ @dataclass class RedisSettings: - host: str = field(default=II("oc.env:PHOTOLINGO_REDIS_HOST")) - password: str = field(default=II("oc.env:PHOTOLINGO_REDIS_PASSWORD")) + host: str = field(default=II("oc.env:LINGUAPHOTO_REDIS_HOST")) + password: str = field(default=II("oc.env:LINGUAPHOTO_REDIS_PASSWORD")) port: int = field(default=6379) db: int = field(default=0) diff --git a/linguaphoto/utils/email.py b/linguaphoto/utils/email.py index ed1d34d..34fb060 100644 --- a/linguaphoto/utils/email.py +++ b/linguaphoto/utils/email.py @@ -11,8 +11,8 @@ import aiosmtplib -from photolingo.crypto import decode_jwt, encode_jwt -from photolingo.settings import settings +from linguaphoto.crypto import decode_jwt, encode_jwt +from linguaphoto.settings import settings logger = logging.getLogger(__name__) @@ -97,5 +97,5 @@ def test_email_adhoc() -> None: if __name__ == "__main__": - # python -m store.app.utils.email + # python -m linguaphoto.utils.email test_email_adhoc()