-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CRUD and routers for EmailSignUpToken, two part register flow almost …
…done
- Loading branch information
1 parent
676d3a6
commit a15db8d
Showing
8 changed files
with
308 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""This module provides CRUD operations for email sign-up tokens.""" | ||
|
||
from store.app.crud.base import BaseCrud | ||
from store.app.model import EmailSignUpToken | ||
|
||
|
||
class EmailSignUpCrud(BaseCrud): | ||
async def create_email_signup_token(self, email: str) -> EmailSignUpToken: | ||
token = EmailSignUpToken.create(email=email) | ||
await self._add_item(token) | ||
return token | ||
|
||
async def get_email_signup_token(self, token: str) -> EmailSignUpToken | None: | ||
return await self._get_item(token, EmailSignUpToken, throw_if_missing=False) | ||
|
||
async def delete_email_signup_token(self, token: str) -> None: | ||
await self._delete_item(token) | ||
|
||
|
||
async def test_adhoc() -> None: | ||
async with EmailSignUpCrud() as crud: | ||
token = await crud.create_email_signup_token(email="[email protected]") | ||
retrieved_token = await crud.get_email_signup_token(token.token) | ||
print(f"Retrieved Token: {retrieved_token}") | ||
await crud.delete_email_signup_token(token.token) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.