Skip to content

Commit

Permalink
Merge pull request #201 from Remmeauth/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiia-bilova committed Nov 11, 2019
2 parents 48c0640 + 1fbdee6 commit 1efb0d1
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 25 deletions.
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ $ curl -X POST http://localhost:8000/users/email/confirm/4b73ab1fc1f94c719420433
$ curl -H "Content-Type: application/json" http://localhost:8000/users/dmytro.striletskyi/ | python -m json.tool
{
"result": {
"email": "dmytro.striletskyi@gmail.com",
"id": 6,
"is_active": true,
"is_email_confirmed": true,
Expand Down Expand Up @@ -330,7 +329,6 @@ $ curl -H "Content-Type: application/json" http://localhost:8000/users/john.smit
"telegram_url": "",
"twitter_url": "",
"user": {
"email": "john.smith@gmail.com",
"id": 5,
"is_active": true,
"is_email_confirmed": true,
Expand Down Expand Up @@ -446,7 +444,6 @@ $ curl http://localhost:8000/block-producers/2/ -H "Content-Type: application/js
"telegram_url": "https://t.me/bpcanada",
"twitter_url": "https://twitter.com/bpcanada",
"user": {
"email": "tony.stark@gmail.com",
"id": 2,
"is_active": true,
"is_email_confirmed": true,
Expand Down Expand Up @@ -493,7 +490,6 @@ $ curl http://localhost:8000/block-producers/ -H "Content-Type: application/json
"telegram_url": "https://t.me/bpusa",
"twitter_url": "https://twitter.com/bpusa",
"user": {
"email": "tony.stark@gmail.com",
"id": 2,
"is_active": true,
"is_email_confirmed": true,
Expand Down Expand Up @@ -691,7 +687,6 @@ $ curl http://localhost:8000/block-producers/search/?phrase=block%20producer%20u
"telegram_url": "https://t.me/bpusa",
"twitter_url": "https://twitter.com/bpusa",
"user": {
"email": "tony.stark@gmail.com",
"id": 2,
"is_active": true,
"is_email_confirmed": true,
Expand Down Expand Up @@ -768,7 +763,6 @@ $ curl -H "Content-Type: application/json" http://localhost:8000/block-producers
"block_producer_id": 2,
"id": 2,
"user": {
"email": "john.smith@gmail.com",
"id": 1,
"is_active": true,
"is_email_confirmed": true,
Expand Down Expand Up @@ -826,7 +820,6 @@ $ curl -H "Content-Type: application/json" http://localhost:8000/block-producers
"id": 10,
"text": "Great block producer!",
"user": {
"email": "paul.rudd@gmail.com",
"id": 3,
"is_active": true,
"is_email_confirmed": true,
Expand Down
4 changes: 2 additions & 2 deletions directory/block_producer/dto/block_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from dataclasses_json import dataclass_json

from user.dto.user import UserDto
from user.dto.user import UserDtoWithoutEmail


@dataclass_json
Expand All @@ -15,7 +15,7 @@ class BlockProducerDto:
Block producer data transfer object implementation.
"""

user: UserDto
user: UserDtoWithoutEmail

user_id: int
id: int
Expand Down
4 changes: 2 additions & 2 deletions directory/block_producer/dto/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from dataclasses_json import dataclass_json

from user.dto.user import UserDto
from user.dto.user import UserDtoWithoutEmail


@dataclass_json
Expand All @@ -20,7 +20,7 @@ class BlockProducerCommentDto:
user_id: int
block_producer_id: int

user: UserDto
user: UserDtoWithoutEmail
profile_avatar_url: str

text: str
Expand Down
4 changes: 2 additions & 2 deletions directory/block_producer/dto/like.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from dataclasses_json import dataclass_json

from user.dto.user import UserDto
from user.dto.user import UserDtoWithoutEmail


@dataclass_json
Expand All @@ -19,7 +19,7 @@ class BlockProducerLikeDto:
user_id: int
block_producer_id: int

user: UserDto
user: UserDtoWithoutEmail


@dataclass_json
Expand Down
6 changes: 6 additions & 0 deletions directory/block_producer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def get_all(cls):

del user_as_dict['password']
del user_as_dict['created']
del user_as_dict['email']

block_producer['user'] = user_as_dict
del block_producer['created_at']
Expand Down Expand Up @@ -149,6 +150,7 @@ def get(cls, identifier):

del user_as_dict['password']
del user_as_dict['created']
del user_as_dict['email']

block_producer_as_dict['user'] = user_as_dict
del block_producer_as_dict['created_at']
Expand Down Expand Up @@ -176,6 +178,7 @@ def search(cls, phrase):

del user_as_dict['password']
del user_as_dict['created']
del user_as_dict['email']

del block_producer_as_dict['search']
del block_producer_as_dict['created_at']
Expand All @@ -201,6 +204,7 @@ def get_last(cls, username):

del user_as_dict['password']
del user_as_dict['created']
del user_as_dict['email']

last_block_producer['user'] = user_as_dict
del last_block_producer['created_at']
Expand Down Expand Up @@ -311,6 +315,7 @@ def get_all(cls, block_producer_id):

del user_as_dict['password']
del user_as_dict['created']
del user_as_dict['email']

block_producer_like['user'] = user_as_dict

Expand Down Expand Up @@ -372,6 +377,7 @@ def get_all(cls, block_producer_id):

del user_as_dict['password']
del user_as_dict['created']
del user_as_dict['email']

block_producer_comment['user'] = user_as_dict
block_producer_comment['profile_avatar_url'] = profile.avatar_url
Expand Down
4 changes: 0 additions & 4 deletions directory/block_producer/tests/views/test_block_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def test_get_block_producer(self):
'last_login': None,
'is_superuser': False,
'is_email_confirmed': True,
'email': 'martin.fowler@gmail.com',
'username': 'martin.fowler',
'is_active': True,
'is_staff': False,
Expand Down Expand Up @@ -327,7 +326,6 @@ def test_get_block_producers(self):
'is_email_confirmed': True,
'last_login': None,
'username': 'martin.fowler',
'email': 'martin.fowler@gmail.com',
'id': 3,
'is_active': True,
},
Expand Down Expand Up @@ -360,7 +358,6 @@ def test_get_block_producers(self):
'is_email_confirmed': True,
'last_login': None,
'username': 'martin.fowler',
'email': 'martin.fowler@gmail.com',
'id': 3,
'is_active': True,
},
Expand Down Expand Up @@ -463,7 +460,6 @@ def test_search_block_producers(self):
'user': {
'is_active': True,
'id': 4,
'email': 'martin.fowler@gmail.com',
'last_login': None,
'is_email_confirmed': True,
'is_superuser': False,
Expand Down
4 changes: 2 additions & 2 deletions directory/user/dto/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from dataclasses_json import dataclass_json

from user.dto.user import UserDto
from user.dto.user import UserDtoWithoutEmail


@dataclass_json
Expand All @@ -15,7 +15,7 @@ class UserProfileDto:
User profile data transfer object implementation.
"""

user: UserDto
user: UserDtoWithoutEmail

user_id: int

Expand Down
16 changes: 16 additions & 0 deletions directory/user/dto/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,19 @@ class UserDto:
is_staff: bool
is_superuser: bool
last_login: typing.Any = None


@dataclass_json
@dataclass
class UserDtoWithoutEmail:
"""
User data transfer object without email field implementation.
"""

id: typing.Any
username: str
is_email_confirmed: bool
is_active: bool
is_staff: bool
is_superuser: bool
last_login: typing.Any = None
1 change: 1 addition & 0 deletions directory/user/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def get(cls, username):

del user_as_dict['password']
del user_as_dict['created']
del user_as_dict['email']

user_profile_as_dict['user'] = user_as_dict

Expand Down
1 change: 0 additions & 1 deletion directory/user/tests/views/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def test_get_user_profile(self):
'id': 1,
'last_login': None,
'is_superuser': False,
'email': 'martin.fowler@gmail.com',
'username': 'martin.fowler',
'is_email_confirmed': True,
'is_active': True,
Expand Down
4 changes: 2 additions & 2 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ flake8-commas==2.0.0
flake8-comprehensions==3.0.1
flake8-docstrings==1.5.0
flake8-per-file-ignores==0.8.1
flake8-print==3.1.1
flake8-print==3.1.4
flake8==3.7.9
isort==4.3.21
pep8-naming==0.8.2
pep8-naming==0.9.0
pydocstyle==4.0.1
radon==4.0.0
safety==1.8.5
6 changes: 3 additions & 3 deletions requirements/project.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
boto3==1.10.5
dataclasses-json==0.3.5
boto3==1.10.14
dataclasses-json==0.3.6
dj-database-url==0.5.0
django-admin-multiple-choice-list-filter==0.1.1
django-cors-headers==3.1.1
django==2.2.6
django==2.2.7
djangorestframework-jwt==1.11.0
djangorestframework==3.10.3
psycopg2==2.8.4
Expand Down

0 comments on commit 1efb0d1

Please sign in to comment.