Commit graph

4,552 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
0a4c19082d 📦 chore(pyproject.toml): add markupsafe dependency to improve compatibility and security
🔒 chore(pyproject.toml): update black dependency to version 23.1.0 for development purposes
2023-08-25 15:03:14 -03:00
Guangya Liu
dae856d0f6 Added readme for docker example 2023-08-25 15:03:14 -03:00
Gabriel Luiz Freitas Almeida
3b2bfd06cc 🔧 fix(test_database.py): fix test_create_flow function signature to include active_user and logged_in_headers parameters
🔧 fix(test_database.py): fix test_read_flows function signature to include active_user and logged_in_headers parameters
🔧 fix(test_database.py): fix test_read_flow function signature to include active_user and logged_in_headers parameters
🔧 fix(test_database.py): fix test_update_flow function signature to include active_user and logged_in_headers parameters
🔧 fix(test_database.py): fix test_delete_flow function signature to include active_user and logged_in_headers parameters
🔧 fix(test_database.py): fix test_create_flows function signature to include logged_in_headers parameter
🔧 fix(test_database.py): fix test_upload_file function signature to include logged_in_headers parameter
🔧 fix(test_database.py): fix test_download_file function signature to include active_user and logged_in_headers parameters
🔧 fix(test_database.py): fix test_create_flow_with_invalid_data function signature to include active_user and logged_in_headers parameters
🔧 fix(test_database.py): fix test_get_nonexistent_flow function signature to include active_user and logged_in_headers parameters
🔧 fix(test_database.py): fix test_update_flow_idempotency function signature to include active_user and logged_in_headers parameters
🔧 fix(test_database.py): fix test_update_nonexistent_flow function signature to include active_user and logged_in_headers parameters
🔧 fix(test_database.py): fix test_delete_nonexistent_flow function signature to include active_user and logged_in_headers parameters
🔧 fix(test_database.py): fix test_read_empty_flows function signature to include active_user and logged_in_headers parameters
2023-08-25 12:49:57 -03:00
Gabriel Luiz Freitas Almeida
00e5f70fe1 🔀 chore(user.py): add relationship to flows in User model 2023-08-25 12:49:46 -03:00
Gabriel Luiz Freitas Almeida
b5e4df9943 🐛 fix(flows.py): add missing import statement for User model
🐛 fix(flows.py): add missing import statement for TYPE_CHECKING
 feat(flows.py): add user_id field to FlowCreate model to allow specifying the user for a new flow
 feat(flows.py): add user_id field to FlowRead model to include the user_id in the response
 feat(flows.py): add user_id field to Flow model and create a relationship with User model
 feat(flows.py): add current_user dependency to create_flow endpoint to set the user_id for a new flow
 feat(flows.py): add current_user dependency to read_flows endpoint to filter flows by current user
 feat(flows.py): add current_user dependency to read_flow endpoint to filter flow by current user
 feat(flows.py): add current_user dependency to update_flow endpoint to filter flow by current user
 feat(flows.py): add current_user dependency to delete_flow endpoint to filter flow by current user
 feat(flows.py): add current_user dependency to create_flows endpoint to set the user_id for new flows
 feat(flows.py): add current_user dependency to upload_file endpoint to set the user_id for new flows
 feat(flows.py): add current_user dependency to download_file endpoint to filter flows by current user
🐛 fix(flow.py): add missing import statement for User model
 feat(flow.py): add user_id field to Flow model to associate a flow with a user
2023-08-25 12:49:24 -03:00
Gabriel Luiz Freitas Almeida
eab34e2fdc
Adds Tests for Login, Users and API keys (#821) 2023-08-25 15:27:02 +00:00
Gabriel Luiz Freitas Almeida
16695c8241
Merge branch 'login' into authentication 2023-08-25 15:23:22 +00:00
Gabriel Luiz Freitas Almeida
a4aeff6d79 🔧 fix(api_key.py): import missing dependencies and fix type annotations in api_key.py
🔧 fix(api_key.py): fix type annotations and import in api_key.py
🔧 fix(api_key.py): fix type annotations and
2023-08-25 12:21:14 -03:00
Gabriel Luiz Freitas Almeida
950b9d179b 🔥 refactor(user/utils.py): remove unused code and imports from user/utils.py module
 feat(test_api_key.py): add tests for API key creation, retrieval, and deletion
 feat(test_user.py): remove unused fixtures and imports from test_user.py module
2023-08-25 12:05:54 -03:00
Gabriel Luiz Freitas Almeida
ba081e81b6 🔀 chore(user.py): add type hinting for ApiKey import to improve code readability
🔀 chore(user.py): add relationship between User and ApiKey models to establish a one-to-many relationship
2023-08-25 12:05:20 -03:00
Gabriel Luiz Freitas Almeida
7783f4532e 📦 chore(user/crud.py): add CRUD operations for User model in database
🔒 fix(user/crud.py): add validation to prevent duplicate usernames during user update
🔄 refactor(user/crud.py): update user attributes and last_login_at timestamp during user update
🐛 fix(user/crud.py): handle IntegrityError during user update and rollback transaction
2023-08-25 12:04:51 -03:00
Gabriel Luiz Freitas Almeida
e42686738c 📦 chore(api_key/crud.py): add CRUD functions for managing API keys in the database
This commit adds the following functions to the `api_key/crud.py` file:
- `get_api_keys`: Retrieves a list of API keys associated with a specific user ID from the database.
- `create_api_key`: Generates a random API key, hashes it, and creates a new `ApiKey` object in the database.
- `delete_api_key`: Deletes an API key from the database based on its ID.

These functions provide the necessary functionality for managing API keys in the application's database.
2023-08-25 12:04:20 -03:00
Gabriel Luiz Freitas Almeida
82fbeace06 🔀 chore(api_key): update import and export names in __init__.py for better clarity and consistency
🔀 chore(api_key): add UnmaskedApiKeyRead model to represent an unmasked API key

🔀 chore(api_key): add user relationship to ApiKey model for easier access to associated user

🔀 chore(api_key): add user_id field to ApiKeyBase and ApiKeyCreate models for easier user association

🔀 chore(api_key): add mask_api_key validator to ApiKeyRead model to mask the API key for security reasons
2023-08-25 12:03:51 -03:00
Gabriel Luiz Freitas Almeida
edd58705e4 🔨 refactor(schemas.py): update import statement for ApiKeyRead to reflect new file structure
🔨 refactor(schemas.py): update import statement for ApiKeyRead to reflect
2023-08-25 12:03:03 -03:00
Gabriel Luiz Freitas Almeida
eb02220aad feat(api_key.py): add GET and POST routes for retrieving and creating API keys
🐛 fix(api_key.py): fix delete_api_key route to use correct dependencies and handle exceptions properly
2023-08-25 12:02:32 -03:00
Gabriel Luiz Freitas Almeida
8d1e1b8710 🔒 chore(api_key.py): update hardcoded API key value to improve security
🔒 chore(api_key.py): update hardcoded API key value to improve security by removing the actual key from the code and adding a placeholder comment
2023-08-25 10:25:28 -03:00
Gabriel Luiz Freitas Almeida
fc93e4ced0 🔀 chore(test_database.py): update import statement for Session from sqlalchemy.orm to sqlmodel to match the library being used 2023-08-25 10:24:33 -03:00
Gabriel Luiz Freitas Almeida
81816baada 🔧 fix(login.py): update import statement from sqlalchemy.orm to sqlmodel.Session for Session class
🔧 fix(users.py): update type annotation for current_user parameter from Session to User
🔧 fix(utils.py): update import statement from sqlalchemy.orm to sqlmodel.Session
🔧 fix(utils.py): update type annotation for token parameter from Annotated to Union[Coroutine, str]
🔧 fix(utils.py): update type annotation for get_user_by_username function return type from User to Union[User, None]
🔧 fix(utils.py): update type annotation for get_user_by_id function return type from User to Union[User, None]
🔧 fix(manager.py): update type annotation for dependencies parameter in register_factory method from List to Optional[List]
2023-08-25 10:24:01 -03:00
Gabriel Luiz Freitas Almeida
8411922a07 feat(test_user.py): add tests for user-related functionalities
🐛 fix(test_user.py): fix typo in test_user_waiting_for_approval function name
🐛 fix(test_user.py): fix typo in test_deactivated_user_cannot_access function name
🐛 fix(test_user.py): fix typo in test_data_consistency_after_update function name
🐛 fix(test_user.py): fix typo in test_data_consistency_after_delete function name
🐛 fix(test_user.py): fix typo in test_inactive_user function name
🐛 fix(test_user.py): fix typo in test_normal_user_cant_read_all_users function name
🐛 fix(test_user.py): fix typo in test_patch_user_wrong_id function name
🐛 fix(test_user.py): fix typo in test_delete_user_wrong_id function name
🐛 fix(test_user.py): fix typo in test_normal_user_cant_delete_user function name
 feat(test_user.py): add test_add_super_user_for_testing_purposes_delete_me_before_merge_into_dev function
2023-08-25 10:17:46 -03:00
Gabriel Luiz Freitas Almeida
7b897906b9 feat(test_login.py): add tests for login functionality
🐛 fix(test_login.py): fix typo in test_login_unsuccessful_wrong_username test

🐛 fix(test_login.py): fix typo in test_login_unsuccessful_wrong_password test
2023-08-25 10:17:36 -03:00
Gabriel Luiz Freitas Almeida
7e3d329df9 🔧 chore(auth.py): add API_V1_STR constant to improve code readability and maintainability
🐛 fix(auth.py): update tokenUrl in oauth2_scheme to use API_V1_STR constant for consistency
2023-08-25 10:17:25 -03:00
Gabriel Luiz Freitas Almeida
92a7ae6be7 🐛 fix(utils.py): remove unnecessary type casting in get_user_by_username and get_user_by_id functions
🐛 fix(utils.py): fix update_user function to correctly update user attributes and handle username conflicts
2023-08-25 10:16:04 -03:00
Gabriel Luiz Freitas Almeida
4517f8ad5c 🔧 fix(service.py): add request parameter to run_oauth2_scheme method in AuthManager class to handle FastAPI request object
🔧 fix(utils.py): add request parameter to auth_scheme_dependency function to handle FastAPI request object
🔧 fix(utils.py): change get_current_active_user function to synchronous and remove async keyword
 feat(utils.py): add get_current_active_superuser function to check if the current user is an active superuser
2023-08-25 10:11:24 -03:00
Gabriel Luiz Freitas Almeida
e4cbc0a07f 🐛 fix(users.py): change router tag from "Login" to "Users" for better categorization
 feat(users.py): add status code 201 to the response of the add_user endpoint to indicate successful creation of a new user
🐛 fix(users.py): update the usage of UserCreate model to create a new User instance using User.from_orm(user) for better compatibility
 feat(users.py): add current_user parameter to the read_current_user endpoint to enforce authentication and authorization
 feat(users.py): add current_user parameter to the read_all_users endpoint to enforce authentication and authorization
 feat(users.py): add current_user parameter to the delete_user endpoint to enforce authentication and authorization. Also, add validation checks to prevent deleting own user account and unauthorized deletion of users.
2023-08-25 10:10:57 -03:00
Gabriel Luiz Freitas Almeida
43b2d62661 🔀 chore(router.py): add login_router to the APIRouter to include login functionality
🔀 chore(__init__.py): import and include login_router in the APIRouter to enable login functionality
🔀 chore(login.py): add tags to the login router to categorize it as "Login" in the API documentation
2023-08-25 10:10:19 -03:00
Gabriel Luiz Freitas Almeida
6b82b730cd 🔥 refactor(auth): remove unused code and dependencies in auth module
🔥 refactor(routers): remove unused code and dependencies in routers module
2023-08-25 10:09:37 -03:00
anovazzi1
9b3e4f27a5 fix(tabsContext.tsx): handle error message properly when saving changes in the tabs provider
The error handling in the tabs provider has been improved to display a more meaningful error message when there is an error while saving changes. Instead of directly assigning the error to the `setErrorData` state variable, the error message is now wrapped in an object with a title and a list of error messages. This change ensures that the error message is displayed consistently and provides better context to the user.
2023-08-24 19:50:17 -03:00
anovazzi1
cea8acacd8 update type to avoid undefined 2023-08-24 19:42:48 -03:00
anovazzi1
bf568ad22f update attribute 2023-08-24 19:42:05 -03:00
anovazzi1
aaf34d49bb
Fix success messages to work only after backend response (#804)
🔧 fix(tabsContext.tsx): add setSuccessData to useContext to fix missing
function error
 feat(tabsContext.tsx): add success alert when changes are saved
successfully in TabsProvider component
🔧 fix(flowSettingsModal/index.tsx): remove setSuccessData from
useContext to fix missing function error
🔧 fix(AdminPage/index.tsx): remove console.log statement
 feat(AdminPage/index.tsx): add success alert when user is edited
successfully
🔧 fix(extraSidebarComponent/index.tsx): remove setSuccessData from
useContext to fix missing function error
2023-08-24 17:59:40 -03:00
anovazzi1
544738ebef
Merge branch 'login' into bugfix-msgSuccess 2023-08-24 17:58:25 -03:00
Gabriel Luiz Freitas Almeida
41ef2fd2f7 🔧 fix(alembic): fix indentation and formatting issues in add_apikey_table migration script
 feat(alembic): add support for creating apikey and user tables in the database
🔥 chore(alembic): remove flowstyle and component tables from the database schema
2023-08-24 17:42:53 -03:00
Gabriel Luiz Freitas Almeida
58121cc6ca 🔥 refactor(main.py): remove unused routers from the app to improve code cleanliness and reduce unnecessary imports 2023-08-24 17:42:33 -03:00
Gabriel Luiz Freitas Almeida
d9cbf17b1a 🔄 chore(router.py): add users_router and api_key_router to the APIRouter to include the new routes for users and api keys
🔄 chore(__init__.py): add users_router and api_key_router to the __all__ list to include the new routes for users and api keys
🆕 feat(api_key.py): add new routes for retrieving, creating, and deleting API keys
🆕 feat(login.py): add new routes for user login, auto login, and token refresh
🆕 feat(schemas.py): add new schemas for API key response and users response
🆕 feat(users.py): add new routes for adding, reading, updating, and deleting users
🗑️ chore(health.py): remove health router as it is no longer needed
🔄 chore(utils.py): update import statements for User model and update_user_last_login_at function
2023-08-24 17:41:41 -03:00
anovazzi1
6dbc06dc12 Merge remote-tracking branch 'origin/dev' into bugfix-msgSuccess 2023-08-24 17:41:26 -03:00
anovazzi1
704fc6a244
fix: tweaks page (#807)
This pull request addresses multiple bugs and issues that have been
identified on the tweaks page of our application. The changes
implemented here aim to enhance the overall user experience and improve
the stability of the page. Below is an overview of the resolved issues:
2023-08-24 17:40:36 -03:00
anovazzi1
24e84aa2fe Merge branch 'dev' into bugfix-msgSuccess 2023-08-24 17:39:52 -03:00
Gabriel Luiz Freitas Almeida
1a51cc0848 📦 feat(api_key): add ApiKey model and related classes for database operations
📦 feat(component): add Component model and related classes for database operations

📦 feat(flow): add Flow model and related classes for database operations

📦 feat(token): add Token model for authentication

📦 feat(user): add User model and related classes for database operations

📦 feat(user): add utility functions for user operations
2023-08-24 17:32:26 -03:00
anovazzi1
668387dde8 Merge branch 'dev' into bugfix-tweakPage 2023-08-24 17:18:40 -03:00
anovazzi1
e863f79782 update git attributes 2023-08-24 17:15:42 -03:00
anovazzi1
c49ee222be update git attributes 2023-08-24 17:15:42 -03:00
anovazzi1
4fab63e5de code format 2023-08-24 17:10:02 -03:00
anovazzi1
c1c5b2242f fix(buildTrigger/index.tsx): change the success message title from "Code is ready to run" to "Flow is ready to run" for better clarity and accuracy 2023-08-24 17:08:24 -03:00
igorrCarvalho
f8d51b4882 Refactor: Move header login buttons to right side of flow name 2023-08-24 14:29:24 -03:00
Gabriel Luiz Freitas Almeida
aa47af7a3b
Fix orjson_dumps import (#814) 2023-08-24 15:07:59 +00:00
DiogenesBR
fe3a9c61df fix the imports of orjson_dumps 2023-08-24 14:57:18 +00:00
DiogenesBR
cdd25dbeb2 add some new types to the .gitattributes 2023-08-24 14:56:09 +00:00
Gabriel Luiz Freitas Almeida
fd6ef1815b format 2023-08-23 21:43:23 -03:00
Gabriel Luiz Freitas Almeida
63ca408506 🔧 chore(alembic): add ApiKey table and remove FlowStyle and Component tables
🔄 refactor(alembic): downgrade migration to recreate FlowStyle and Component tables and remove User and ApiKey tables
2023-08-23 21:43:14 -03:00
Gabriel Luiz Freitas Almeida
061a9c09ba Merge remote-tracking branch 'origin/main' into dev 2023-08-23 21:42:34 -03:00