Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huynh Minh Truong - Python - Submit test #327

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4fea5d7
[Setup Evironment] Create a Dockerfile and docker-compose.
huynhminhtruong Jun 24, 2022
b0d03dc
[Coding] Create baseuser module.
huynhminhtruong Jun 24, 2022
5b23324
[Coding] Create todo module.
huynhminhtruong Jun 24, 2022
a247d60
[Coding] Create constants module.
huynhminhtruong Jun 24, 2022
19f9c6f
[Coding] Create services module.
huynhminhtruong Jun 24, 2022
ff55396
[Coding] Create utils module.
huynhminhtruong Jun 24, 2022
a0c6ced
[Guideline] Update README format.
huynhminhtruong Jun 24, 2022
26d7ebd
[Guideline] Update README content.
huynhminhtruong Jun 24, 2022
46124f1
[Guideline] Update README format.
huynhminhtruong Jun 24, 2022
6b0c57c
[Coding] Add get user detail and masking user id in both response and…
huynhminhtruong Jun 24, 2022
6312338
[Coding] Load tasks while get user and the current user cannot view i…
huynhminhtruong Jun 24, 2022
d25ff47
[Coding] Tiny update.
huynhminhtruong Jun 24, 2022
ae63468
[Guideline] Update README content.
huynhminhtruong Jun 24, 2022
43aeaed
[Coding] Change filter count number of added tasks of today.
huynhminhtruong Jun 26, 2022
af7ef3f
[Coding] Add more validation when create and update user.
huynhminhtruong Jun 26, 2022
79366ce
[Guideline] Update README content.
huynhminhtruong Jun 26, 2022
82ce0fd
[Coding] Update init database script.
huynhminhtruong Jun 26, 2022
d6983af
[Testing] Implement test cases.
huynhminhtruong Jun 26, 2022
2023cb5
[Testing] Implement test cases for baseuser module.
huynhminhtruong Jun 27, 2022
eb701d6
[Testing] Tiny update.
huynhminhtruong Jun 27, 2022
bddbe51
[Testing] Add tearDown to clean up variables.
huynhminhtruong Jun 27, 2022
a853b9f
[Guideline][Testing] Update README content and todo test cases.
huynhminhtruong Jun 27, 2022
c681171
[Guideline] Update README content format.
huynhminhtruong Jun 27, 2022
997106a
[Guideline] Update README content format.
huynhminhtruong Jun 27, 2022
df130a7
[Guideline] Update README content format.
huynhminhtruong Jun 27, 2022
4494351
[Testing][Guideline] Update test cases and README content.
huynhminhtruong Jun 28, 2022
c73e9b9
[Testing] Add more test cases.
huynhminhtruong Jun 28, 2022
1e5c296
[Guideline] Update README content.
huynhminhtruong Jun 28, 2022
8177cb3
[Guideline] Update README content.
huynhminhtruong Jun 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Coding] Tiny update.
huynhminhtruong committed Jun 24, 2022
commit d25ff4756da61e47e0d01daaf5905d3f2a8859e7
3 changes: 1 addition & 2 deletions baseuser/serializers.py
Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@


class UserSerializer(serializers.ModelSerializer):
tasks = TaskSerializer(many=True, read_only=True)

def to_representation(self, instance):
data = super().to_representation(instance)
data["id"] = encrypting.encrypt(data["id"])
@@ -18,6 +16,7 @@ class Meta:
fields = (
"id",
"username",
"password",
"maximum_task_per_day",
"tasks",
)
1 change: 1 addition & 0 deletions constants/messages.py
Original file line number Diff line number Diff line change
@@ -3,3 +3,4 @@ class HTTPReponseMessage:
MISSING_FIELD = "Missing field maximum_task_per_day"
EXCEED_MAXIMUM_ERROR = "The number of tasks has exceeded the limit of per day"
DELETE_SUCCESSFULL = "Delete successfully"
NOT_ALLOWED_VIEW = "This user does not have permission to get information of others"
2 changes: 1 addition & 1 deletion services/task_service.py
Original file line number Diff line number Diff line change
@@ -95,5 +95,5 @@ def __get_task_by_id(self, task_id, user_id):

def __get_single_or_list(self, user_id, is_list, task_id):
if is_list is True:
return Task.objects.filter(created_by=user_id).values()
return Task.objects.filter(created_by=user_id)
return self.__get_task_by_id(task_id, user_id)
2 changes: 1 addition & 1 deletion services/user_service.py
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ def get_single_user(self, request, user_id):
return serializer.data, status.HTTP_200_OK

return response_formatting.get_format_message(
HTTPReponseMessage.NOT_ALLOWED, status.HTTP_403_FORBIDDEN
HTTPReponseMessage.NOT_ALLOWED_VIEW, status.HTTP_403_FORBIDDEN
)

def get(self, request) -> tuple:
4 changes: 2 additions & 2 deletions todo/apps.py
Original file line number Diff line number Diff line change
@@ -2,5 +2,5 @@


class TodoConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'todo'
default_auto_field = "django.db.models.BigAutoField"
name = "todo"
2 changes: 1 addition & 1 deletion todo/serializers.py
Original file line number Diff line number Diff line change
@@ -12,4 +12,4 @@ def to_representation(self, instance):

class Meta:
model = Task
exclude = ("created_by",)
fields = "__all__"