-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ricardo Sánchez
committed
Feb 16, 2021
1 parent
141a534
commit 1629d34
Showing
10 changed files
with
119 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.1.0' | ||
__version__ = '0.1.1.dev2' |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
__all__ = ['Account', 'Transaction'] | ||
__all__ = ['Account', 'Card', 'Transaction', 'File'] | ||
|
||
from .accounts import Account | ||
from .cards import Card | ||
from .files import File | ||
from .transactions import Transaction |
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,11 @@ | ||
from mongoengine import DateTimeField, Document, StringField | ||
|
||
from agave.models import BaseModel | ||
from agave.models.helpers import uuid_field | ||
|
||
|
||
class Card(BaseModel, Document): | ||
id = StringField(primary_key=True, default=uuid_field('CA')) | ||
number = StringField(required=True) | ||
user_id = StringField(required=True) | ||
created_at = DateTimeField() |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
__all__ = ['app', 'Account', 'Transaction'] | ||
__all__ = ['app', 'Account', 'Card', 'File', 'Transaction'] | ||
|
||
from .accounts import Account | ||
from .base import app | ||
from .cards import Card | ||
from .files import File | ||
from .transactions import Transaction |
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,28 @@ | ||
from typing import Dict | ||
|
||
from chalice import Response | ||
|
||
from agave.filters import generic_query | ||
|
||
from ..models import Card as CardModel | ||
from ..validators import CardQuery | ||
from .base import app | ||
|
||
|
||
@app.resource('/cards') | ||
class Card: | ||
model = CardModel | ||
query_validator = CardQuery | ||
get_query_filter = generic_query | ||
|
||
@staticmethod | ||
def retrieve(card: CardModel) -> Response: | ||
data = card.to_dict() | ||
data['number'] = '*' * 16 | ||
return Response(data) | ||
|
||
@staticmethod | ||
def query(response: Dict): | ||
for item in response['items']: | ||
item['number'] = '*' * 16 | ||
return response |
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