Skip to content

Commit 03f13cf

Browse files
committed
DEPLOYMENT DEV BY ANH TU
1 parent da67e1c commit 03f13cf

27 files changed

+160
-160
lines changed

app/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Author: Nguyễn Phương Anh Tú
3-
ID: 21110105
3+
44
The main purpose of this code is to configure the app by setting up directory paths, defining base sizes for a phone UI, and loading environment variables from a .env file.
55
'''
66
#* import flet as ft: Imports the Flet library, which is used for building GUI applications.
@@ -9,7 +9,7 @@
99

1010
'''
1111
Author: Nguyễn Phương Anh Tú
12-
ID: 21110105
12+
1313
- import pathlib: Imports the pathlib module, which provides an object-oriented interface for working with filesystem paths.
1414
- BASE_DIR = pathlib.Path(__file__).resolve().parent.parent: Defines BASE_DIR as the parent directory of the current script's parent directory. This is typically used to set a base directory for relative paths in the application.
1515
'''
@@ -20,7 +20,7 @@
2020

2121
'''
2222
Author: Nguyễn Phương Anh Tú
23-
ID: 21110105
23+
2424
- PHONE_WIDTH = 400: Sets the base width for the phone UI to 400 pixels.
2525
- PHONE_HEIGHT = 850: Sets the base height for the phone UI to 850 pixels.
2626
'''
@@ -33,7 +33,7 @@
3333

3434
'''
3535
Author: Nguyễn Phương Anh Tú
36-
ID: 21110105
36+
3737
- API_BE = os.getenv('API_BE'): Retrieves the API_BE environment variable from the loaded .env file. This variable typically holds the backend API endpoint.
3838
- DOMAIN_BE = os.getenv('DOMAIN_BE'): Retrieves the DOMAIN_BE environment variable, which likely represents the base domain for the backend.
3939
- DOMAIN_API = f'{DOMAIN_BE}/{API_BE}': Constructs the full API domain URL by combining DOMAIN_BE and API_BE.

app/api/auth_api.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'''
22
Author: Nguyễn Phương Anh Tú
3-
ID: 21110105
4-
Author: : Đinh Thành Đức
5-
ID: 21110765
3+
4+
5+
66
Main Purpose:
77
=> Implementing the AuthAPI class to handle user authentication API requests.
88
'''
@@ -38,7 +38,7 @@ class AuthAPI:
3838
def get_token(payload: UserSignInRequest):
3939
'''
4040
Author: Nguyễn Phương Anh Tú
41-
ID: 21110105
41+
4242
Sends a POST request to retrieve a token based on the provided user sign-in payload. Returns the token if successful, otherwise returns an error code.
4343
'''
4444
response = post(f'{DOMAIN_API}/api/token/', json=payload)
@@ -54,7 +54,7 @@ def get_token(payload: UserSignInRequest):
5454
def get_user_by_token(token: str):
5555
'''
5656
Author: Nguyễn Phương Anh Tú
57-
ID: 21110105
57+
5858
Sends a GET request to fetch user information using the provided token. Returns user data if successful, otherwise returns an error code.
5959
'''
6060
response = get(f'{DOMAIN_API}/users/get-user-by-token', headers={
@@ -73,7 +73,7 @@ def get_user_by_token(token: str):
7373
def check_auth():
7474
'''
7575
Author: Nguyễn Phương Anh Tú
76-
ID: 21110105
76+
7777
Checks if the user is authenticated by attempting to retrieve the token from local storage and verifying it with the server. Returns True if authenticated, otherwise False.
7878
'''
7979
token = LocalStore.get_data('access', 'token')
@@ -90,8 +90,8 @@ def check_auth():
9090
@staticmethod
9191
def sign_up(payload: dict):
9292
'''
93-
Author: : Đinh Thành Đức
94-
ID: 21110765
93+
94+
9595
Sends a POST request to sign up a new user with the provided payload. Returns the server response.
9696
'''
9797
response = post(f'{DOMAIN_API}/api-view/sign-up/', json=payload)
@@ -101,7 +101,7 @@ def sign_up(payload: dict):
101101
def sign_in(payload: dict):
102102
'''
103103
Author: Nguyễn Phương Anh Tú
104-
ID: 21110105
104+
105105
Sends a POST request to sign in a user with the provided payload. Returns the server response.
106106
'''
107107
response = post(f'{DOMAIN_API}/api-view/sign-in/', json=payload)
@@ -111,8 +111,8 @@ def sign_in(payload: dict):
111111
@staticmethod
112112
def forgot_password(payload: dict):
113113
'''
114-
Author: : Đinh Thành Đức
115-
ID: 21110765
114+
115+
116116
Sends a GET request to initiate the forgot password process with the provided payload. Returns the server response.
117117
'''
118118
response = get(f'{DOMAIN_API}/api-view/common/forgot-password/', json=payload)
@@ -122,7 +122,7 @@ def forgot_password(payload: dict):
122122
def refresh_token(refresh_token: str):
123123
'''
124124
Author: Nguyễn Phương Anh Tú
125-
ID: 21110105
125+
126126
Sends a POST request to refresh the token using the provided refresh token. Returns the server response.
127127
'''
128128
response = post(f'{DOMAIN_API}/api/token/refresh/', json={'refresh': refresh_token})
@@ -132,7 +132,7 @@ def refresh_token(refresh_token: str):
132132
def auth_by_email(email: str):
133133
'''
134134
Author: Nguyễn Phương Anh Tú
135-
ID: 21110105
135+
136136
Sends a POST request to authenticate a user by email. Returns the server response.
137137
'''
138138
response = post(f'{DOMAIN_API}/api-view/token/', json={'email': email})
@@ -142,7 +142,7 @@ def auth_by_email(email: str):
142142
def check_token_of_email(token: str):
143143
'''
144144
Author: Nguyễn Phương Anh Tú
145-
ID: 21110105
145+
146146
Sends a POST request to check the token of an email. Returns the server response.
147147
'''
148148
response = get(f'{DOMAIN_API}/api-view/token/', headers={

app/api/common_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'''
22
Author: Nguyễn Phương Anh Tú
3-
ID: 21110105
4-
Author: : Đinh Thành Đức
5-
ID: 21110765
3+
4+
5+
66
'''
77
from typing import (
88
Optional,

app/api/course_api.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'''
22
Author: Nguyễn Phương Anh Tú
3-
ID: 21110105
4-
Author: : Lê Quốc Thắng
5-
ID: 21110799
3+
4+
5+
66
'''
77
from typing import (
88
Optional,
@@ -29,7 +29,7 @@ class CourseAPI:
2929
def get_all_courses(page: Optional[int] = 1) -> CoursePaginationResponse:
3030
'''
3131
Author: Nguyễn Phương Anh Tú
32-
ID: 21110105
32+
3333
Sends a GET request to retrieve all courses, with optional pagination. Returns the server response as a CoursePaginationResponse
3434
'''
3535
page_query = f"?page={page}" if page > 1 else ""
@@ -41,7 +41,7 @@ def get_all_courses(page: Optional[int] = 1) -> CoursePaginationResponse:
4141
def get_all_lessons_of_course(course_id: int, page: Optional[int] = 1) -> List[LessonResponse]:
4242
'''
4343
Author: Nguyễn Phương Anh Tú
44-
ID: 21110105
44+
4545
Sends a GET request to retrieve all lessons of a specific course, with optional pagination. Returns the server response as a list of LessonResponse objects
4646
'''
4747
page_query = f"?page={page}" if page > 1 else ""
@@ -51,8 +51,8 @@ def get_all_lessons_of_course(course_id: int, page: Optional[int] = 1) -> List[L
5151
@staticmethod
5252
def get_all_detail_lesson(lesson_id: int, page: Optional[int] = 1) -> LessonResponse:
5353
'''
54-
Author: : Lê Quốc Thắng
55-
ID: 21110799
54+
55+
5656
Sends a GET request to retrieve all detail lessons of a specific lesson, with optional pagination. Returns the server response as a LessonResponse
5757
'''
5858
page_query = f"?page={page}" if page > 1 else ""
@@ -62,8 +62,8 @@ def get_all_detail_lesson(lesson_id: int, page: Optional[int] = 1) -> LessonResp
6262
@staticmethod
6363
def get_detail_one_lesson(lesson_id: int) -> LessonResponse:
6464
'''
65-
Author: : Lê Quốc Thắng
66-
ID: 21110799
65+
66+
6767
Sends a GET request to retrieve the details of a specific lesson. Returns the server response as a LessonResponse object
6868
'''
6969
response = get(f'{DOMAIN_API}/detail-lessons/{lesson_id}/')
@@ -73,7 +73,7 @@ def get_detail_one_lesson(lesson_id: int) -> LessonResponse:
7373
def get_all_exercise_by_slug(slug: str) -> Any:
7474
'''
7575
Author: Nguyễn Phương Anh Tú
76-
ID: 21110105
76+
7777
Sends a GET request to retrieve all exercises of a specific lesson. Returns the server response as a list of ExerciseResponse objects
7878
'''
7979
response = get(f'{DOMAIN_API}/exercises/get-all-exercise-by-name?slugTagName={slug}')
@@ -83,7 +83,7 @@ def get_all_exercise_by_slug(slug: str) -> Any:
8383
def get_one_detail_exercise(exercise_id: int) -> Any:
8484
'''
8585
Author: Nguyễn Phương Anh Tú
86-
ID: 21110105
86+
8787
Sends a GET request to retrieve the details of a specific exercise. Returns the server response as a ExerciseResponse object
8888
'''
8989
response = get(f'{DOMAIN_API}/exercises/{exercise_id}/')

app/constant/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Author: Nguyễn Phương Anh Tú
3-
ID: 21110105
3+
44
Main Purpose:
55
=> Define the constant variables for the project.
66
'''

app/data/token.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"refresh": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTcxNzM4MjIxOSwiaWF0IjoxNzE3MjA5NDE5LCJqdGkiOiJlNTkzNzcwYmY2NzI0MDE1YThmOTM2Y2JlMGJiNjRmZiIsInVzZXJfaWQiOjEwfQ.VMF-RoHFE6BNKXr0jdDQwwTTa5mduYpeK8aFgBirbcoeLhL0rkzYIVEYT37lAoG0kSXa5wuZTe3GdXSrImsLqQ",
3-
"access": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzE3ODE0MjE5LCJpYXQiOjE3MTcyMDk0MTksImp0aSI6IjZhY2M4NTg5ODY0NjQ4YTE5NjNhNTNiNDE5NzYwNzAzIiwidXNlcl9pZCI6MTB9.oaFMODoITW7rkNl6CDq0REPdTouyuP4LBfXqcBjW4vge89MpXKXdG6RwFt-dlnic4NXSRlPCOLap5oVCC2JRHA"
2+
"refresh": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTcxODI5NTQ3MCwiaWF0IjoxNzE4MTIyNjcwLCJqdGkiOiJkNjdjMGUxMjg5NDc0ZjY4ODM0NWQ4OWViYzAwMThlZiIsInVzZXJfaWQiOjEwfQ.mwOTnZe_QRcb7lHFm2S3oAGFI2qTu_UEPNTui-R94-wBp2Ll_qrXvPA5B14i4IQUhoxTvFcOokHVVC5Bu0wCtQ",
3+
"access": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzE4NzI3NDcwLCJpYXQiOjE3MTgxMjI2NzAsImp0aSI6IjgzZDkxNjM1OWZjOTRhY2FiOTdmNTg2MjViNjBjZmE5IiwidXNlcl9pZCI6MTB9.j1z_-LGv3PRLtV5vLwPYPfOvnZySNFy4kO1UmRIPrpK8mB5d6aNfdiBxAAXxnSy0UitaBTwBUYL2ZLT54dkaUw"
44
}

app/hook/auth_hook.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'''
2-
Author: : Đinh Thành Đức
3-
ID: 21110765
4-
Author: : Lê Quốc Thắng
5-
ID: 21110799
2+
3+
4+
5+
66
'''
77
from app.util import (
88
LocalStore

app/schema/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Author: Nguyễn Phương Anh Tú
3-
ID: 21110105
3+
44
Main Purpose:
55
=> Export all the modules in the schema package.
66
'''

app/schema/asset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Author: Nguyễn Phương Anh Tú
3-
ID: 21110105
3+
44
'''
55
from typing import (
66
Literal

app/schema/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
2-
Author: : Đinh Thành Đức
3-
ID: 21110765
2+
3+
44
'''
55
from typing import Optional, Literal, Dict, List
66

app/schema/course.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Author: Nguyễn Phương Anh Tú
3-
ID: 21110105
3+
44
'''
55
from typing import Optional, Literal, Dict, List
66

app/schema/pages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
2-
Author: : Đinh Thành Đức
3-
ID: 21110765
2+
3+
44
'''
55
from typing import Optional, Literal
66

app/schema/user.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'''
22
Author: Nguyễn Phương Anh Tú
3-
ID: 21110105
4-
Author: : Lê Quốc Thắng
5-
ID: 21110799
3+
4+
5+
66
'''
77

88
# Importing necessary type hints from typing module

app/screens/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Author: Nguyễn Phương Anh Tú
3-
ID: 21110105
3+
44
55
Main Purpose:
66
=> Export all the modules in the screens package.

app/screens/auth_ui/auth_ui.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
class AuthUI(ft.Container):
1111
'''
1212
Author: Nguyễn Phương Anh Tú
13-
ID: 21110105
14-
Author: : Lê Quốc Thắng
15-
ID: 21110799
13+
14+
15+
1616
Main Purpose:
1717
=> Define the authentication user interface of the application.
1818
'''
@@ -41,9 +41,9 @@ def __init__(self, page: Optional[ft.Page] = None, **kwargs):
4141
def init_form(self):
4242
'''
4343
Author: Nguyễn Phương Anh Tú
44-
ID: 21110105
45-
Author: : Lê Quốc Thắng
46-
ID: 21110799
44+
45+
46+
4747
'''
4848
# Initialize UI elements for form inputs
4949
self.signin_text = ft.Text(
@@ -192,9 +192,9 @@ def init_form(self):
192192
def on_submit(self, event):
193193
'''
194194
Author: Nguyễn Phương Anh Tú
195-
ID: 21110105
196-
Author: : Lê Quốc Thắng
197-
ID: 21110799
195+
196+
197+
198198
'''
199199
# Determine action based on page route
200200
if self.page.route == '/sign-up':
@@ -208,9 +208,9 @@ def on_submit(self, event):
208208
def handle_signin(self):
209209
'''
210210
Author: Nguyễn Phương Anh Tú
211-
ID: 21110105
212-
Author: : Lê Quốc Thắng
213-
ID: 21110799
211+
212+
213+
214214
'''
215215
# Disable button and show loading indicator
216216
self.signin_btn.visible = False
@@ -248,9 +248,9 @@ def handle_signin(self):
248248
def handle_signup(self):
249249
'''
250250
Author: Nguyễn Phương Anh Tú
251-
ID: 21110105
252-
Author: : Lê Quốc Thắng
253-
ID: 21110799
251+
252+
253+
254254
'''
255255
# Disable button and show loading indicator
256256
self.signin_btn.visible = False
@@ -282,9 +282,9 @@ def handle_signup(self):
282282
def handle_forgot_password(self):
283283
'''
284284
Author: Nguyễn Phương Anh Tú
285-
ID: 21110105
286-
Author: : Lê Quốc Thắng
287-
ID: 21110799
285+
286+
287+
288288
'''
289289
# Disable button and show loading indicator
290290
self.signin_btn.visible = False

app/screens/main_ui/main_ui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Author: Nguyễn Phương Anh Tú
3-
ID: 21110105
3+
44
Main Purpose:
55
=> Define the main user interface of the application.
66
'''

0 commit comments

Comments
 (0)