mirror of
https://github.com/simple-login/app.git
synced 2024-09-20 15:05:59 +08:00
PR comments
This commit is contained in:
parent
39b035a123
commit
bfb1ae6371
|
@ -25,6 +25,7 @@ from app.errors import (
|
|||
)
|
||||
from app.log import LOG
|
||||
from app.models import Alias, Contact, EmailLog, User
|
||||
from app.utils import sanitize_email
|
||||
|
||||
|
||||
def email_validator():
|
||||
|
@ -65,6 +66,7 @@ def create_contact(user: User, alias: Alias, contact_address: str) -> Contact:
|
|||
except ValueError:
|
||||
raise ErrAddressInvalid(contact_address)
|
||||
|
||||
contact_email = sanitize_email(contact_email)
|
||||
if not is_valid_email(contact_email):
|
||||
raise ErrAddressInvalid(contact_email)
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ class ErrContactAlreadyExists(SLException):
|
|||
"""raised when a contact already exists"""
|
||||
|
||||
# TODO: type-hint this as a contact when models are almost dataclasses and don't import errors
|
||||
def __init__(self, contact):
|
||||
def __init__(self, contact: "Contact"): # noqa: F821
|
||||
self.contact = contact
|
||||
|
||||
def error_for_user(self) -> str:
|
||||
|
|
|
@ -4,12 +4,6 @@
|
|||
|
||||
container_name=sl-db-new-migration
|
||||
|
||||
if [ "$#" -lt "1" ]; then
|
||||
echo "What is this migration for?"
|
||||
exit 1
|
||||
fi
|
||||
reason="$@"
|
||||
|
||||
# create a postgres database for SimpleLogin
|
||||
docker rm -f ${container_name}
|
||||
docker run -p 25432:5432 --name ${container_name} -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=sl -d postgres:13
|
||||
|
@ -21,7 +15,7 @@ sleep 3
|
|||
env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl poetry run alembic upgrade head
|
||||
|
||||
# generate the migration script.
|
||||
env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl poetry run alembic revision --autogenerate -m "$reason"
|
||||
env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl poetry run alembic revision --autogenerate $@
|
||||
|
||||
# remove the db
|
||||
docker rm -f ${container_name}
|
||||
|
|
Loading…
Reference in a new issue