-
Notifications
You must be signed in to change notification settings - Fork 208
Frontend #464
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
Closed
Sujal3820
wants to merge
61
commits into
jalantechnologies:feat/frontend-logger
from
Sujal3820:frontend
Closed
Frontend #464
Sujal3820
wants to merge
61
commits into
jalantechnologies:feat/frontend-logger
from
Sujal3820:frontend
Conversation
This file contains hidden or 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
* refactor: rename Otp to OTP * refactor: move acess-token to authentication * refactor: merge password-reset-token into authentication * refactor: move otp into authentication * refactor: clean authentication/otp * refactor: change otp generation from random to secrets * refactor: clean imports * refactor: move access-token and password-reset-token tests to authentication * fix: circular import between account and authentication * refactor: remove common by moving files into application * refactor: format changes
* refactor: add absolute path settings * refactor: all frontend relative path to absolute path
* refactor: rename default_otp to exempt_otp refactor: rename default_phone_number to exempt_phone_number * feat: added Tooltip component * refactor: resolve sonar cube error * refactor: seperate styles from tooltip into a seperate file * refactor: remove code for default_otp delivery for specific phone number * refactor: UI hint changes * refactor: removed tooltip component * refactor: resolve comments * refactor: set default otp code to false * fix: tests fail due to missing_key * refactor: let default_otp.enabled to true for development and preview --------- Co-authored-by: Killg0d <[email protected]>
* add temporal deployment for preview * add postgres_seeds to env * modify temporal_server.py path * add doppler integration to fetch postgres user and password * update temporal app name and modify service to Nodeport * fix python-worker container error for temporal_server.py path not found * fix the resource limits indendation error * change db name and remove host in workflows added to doppler * change db name to postgres12 * add temporal_address and set env dbname * change dbname to postgres * remove ssl env * update temporal_address for temporal-server * modify temporal_address and port * modify dbname to temporal * modify temporal_server.py path * change service type to NodePort * modify service name to temporal in Service.yaml * modify service name to temporal in ingress.yaml * add doppler env secrets to python-worker * fix syntax error for python-worker * modify resource limits * modify temporal_server.py command in python-worker * modify temporal service name to temporal * add containerPort 8080 to temporal-server and comment the temporal-ui * core: add temporal admin deployment * core: update tempora ui version to 2.34.0 * core: remove doppler env from temporal ui * core: remove unnecessary comments from deployment scripts * chore: add temporal deployment doc to README * fix: fix architecture diagram formatting in README.md * add fallback env values to preview web-app deployment * add fallback env values for python-worker --------- Co-authored-by: Govind Sharma <[email protected]>
* fix: worker issue with blocking code * fix: resolve temporal worker issue with duplicate activity name (jalantechnologies#155) * fix: resolve temporal worker issue with duplicate activity name * refactor: change the worker architecture (jalantechnologies#156) * refactor: change the worker architecture * fix: fix typing error in readme.md Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
…s#158) * feat: update serve command to start temporal server * feat: update readme to include wsl instructions
add service for web-app
…lantechnologies#161) * modify Temporal deployment logic to prevent reuse across PRs * fix indendation error in temporal-deployment.yaml * update service name in ingress.yaml
add temporal deployment for production
* modify pod limits on temporal deployments * add nodeAffinity to temporal deployments
…gies#167) * chore: install datadog dependency and setup config and readme * feat: initialise datadog logger and rum * feat: Add datadog logger account details * feat: add datadog automatic error tracking with fallback UI * feat: use datadog router extension for automatic view collection * chore: remove usage of deprecated .render method * feat: use tailadmin error page design
…gies#170) update temporal-grpc service name in service.yaml
update release tag to v2.6
chore: format files with npm run fmt
* modify workers ingress host * update service name in hosts
…ologies#174) fix indentation syntax error at temporal-deployment.yaml
add probes to temporal containers
* add temporal deployment rollout * chore: remove healthcheck in kube for temporal --------- Co-authored-by: Govind Sharma <[email protected]>
…#182) * feat: Add github badge for build and code coverage * feat: Update readme.md to include insturction on github badges
…gies#183) update temporal label in temporal-deployment.yaml
update temporal service names
* Feat: Add cyclic dependency detection * fix: Sync package-lock.json with package.json * fix: Remove unnecessary *.js extension from eslint * feat: add .js and .jsx extensions to eslint config * fix: Remove cyclic dependency in user-menu-dropdown and other lint errors (jalantechnologies#186) * fix: Remove cyclic dependency in user-menu-dropdown * fix: add .js .jsx extension again
* update hostname to bettrhq.com * update production hostname
* temporal clean up * modify deployment name and label to python-worker * update python-worker pod limits
Revert "chore: temporal clean up (jalantechnologies#228)" This reverts commit 8d6d868.
…ntechnologies#233) * refactor: migrate communication services to notification module * feat: implement notification service for email and SMS
chore: update Dockerfile to install jq and change MongoDB port mapping in docker-compose
* docs: update project documentation * docs: add frontend logging example * docs: update readme
…hnologies#254) * feat: auto-create test user in dev and preview environments - Add config flags and credentials for test user in development and preview YAML files - Implement generic setup script to create a test user on app startup if enabled and not already present - Integrate setup script into backend startup for dev/preview environments only - Use config-driven, boilerplate-friendly approach (no project-specific logic) - Add documentation to README for usage, customization, and disabling of the feature - Use consistent logging for setup actions "Rebase with main branch" * fix : Added None type to th functions * feat(bootstrap): add generic app bootstrapping script for one-time setup tasks - Refactor test user seeding script to as a generic entry point for all bootstrapping/seed tasks - Update backend server to run all bootstrapping tasks on startup in dev/preview environments - Document the new bootstrapping process and extensibility in the README - Preserve and document test user seeding as the default bootstrapping task * fix: use none type in functions setup_test script * refactor(scripts): rename setup_test_user_account.py to bootstrap_app.py for generic bootstrapping entry point * refactor(bootstrap): encapsulate bootstrapping logic in BootstrapApp class for extensibility and clarity * fix(bootstrap): move BootstrapApp import inside env check to resolve mypy type errors * improve code quality by removing extra comments and inline imports * WIP: Save changes before rebase * Refactor bootstrap logic and config flags per review - Remove redundant environment checks for bootstrapping; use BOOTSTRAP_APP config flag instead - Add BOOTSTRAP_APP flag to all relevant config files (default, development, preview, production) - Remove unnecessary comments and inline imports from scripts and server files - Refactor bootstrap_app.py to use config flag and proper test user creation logic - Clean up server.py to avoid double checks and unnecessary error handling * Refactor bootstrap logic and config for review compliance - Remove BOOTSTRAP_APP from production config (default is false) - Refactor bootstrap_app.py: load test user fields directly from config, catch MissingKeyError, remove type checks, and do not pass default for BOOTSTRAP_APP - Remove redundant comment in server.py about config flag check * Undo changes in Readme file * docs: add dedicated documentation for bootstrap script and update references * docs: rename BootStrapping to Bootstrapping and update doc filename - Updated README to use Bootstrapping (single word, lowercase 's') - Renamed docs/bootstrap.md to docs/bootstrapping.md for consistency --------- Co-authored-by: Aakash Yadav <[email protected]>
… Reference Reusable Workflow v3.2.1 (jalantechnologies#267)
…#262) * Add default OTP whitelist support and update OTP check logic - Added `whitelist` field to environment config files under `public.default_otp`. - Updated `is_default_otp_enabled` to check if a phone number is whitelisted before returning the default OTP. - Added error handling and logging for whitelist lookup failures. - Allows safer use of default OTP codes by restricting them to specific numbers. * Refactor type hint to use Optional for `phone_number` - Updated `is_default_otp_enabled` method signature to declare `phone_number` as `Optional[str]`. - Improves code readability and supports better static type checking. * Add `default_otp` environment variable mappings - Added `default_otp` block to map new env vars: - `DEFAULT_OTP_ENABLED` - `DEFAULT_OTP_CODE` - `DEFAULT_OTP_WHITELIST` - Supports configurable default OTP behavior across environments. * Enable SMS in dev and refine default OTP check - Enabled the `sms` feature in `docker-dev.yml` to allow SMS sending in development. - Adjusted the `is_default_otp_enabled` call to pass the recipient's phone number for more granular control. - Removed the unused `EMAIL` authentication mechanism comment to clean up config. * Move `Logger` import to module level - Relocated the `Logger` import to the top of the file instead of importing inside the exception block. - Simplifies exception handling and aligns with common Python style for clarity and maintainability. * Reorder imports to follow PEP 8 guidelines - Moved `typing` imports (`Any`, `List`, `Optional`) below standard library imports (`secrets`, `string`). - Helps maintain a consistent and clean import structure. * Simplify `is_default_otp_enabled` logic and cleanup - Combined checks for `default_otp_enabled` and `phone_number` into a single condition to streamline the method. - Removed redundant return statement that returned `default_otp_enabled` when `phone_number` was `None`. - Deleted an unnecessary blank line before the conditional in `authentication_service.py` to keep related logic grouped. * Harden `is_default_otp_enabled` by tightening fallback logic - Changed fallback behavior to return `False` when the whitelist is empty instead of enabling default OTP by default. - Updated exception handling to also return `False` on error, ensuring stricter control. - Removed unnecessary blank lines inside `try/except` for cleaner code. * test files added * update test files * remove comments * Rename OTP config key to `whitelisted_phone_numbers_with_country_code` - Replaced `public.default_otp.whitelist` with `public.default_otp.whitelisted_phone_numbers_with_country_code` across all configuration files. - Updated `OTPUtil` to reference the new config key. - Refactored all tests to reflect the updated configuration name. - Enhances clarity by specifying the expected format (phone numbers with country codes). * Remove `default_otp` code and whitelist from default config - Deleted `code` and `whitelisted_phone_numbers_with_country_code` fields from the `default_otp` section in `default.yml`. * Rename OTPUtil method to clarify its purpose - Replaced `is_default_otp_enabled` with `is_phone_number_whitelisted_for_default_otp` for clarity. - Updated usage in `authentication_service.py` and OTP utility module. - Adjusted test cases to reference the new method name. - The new name better communicates the method's behavior: validating if a phone number qualifies for the default OTP based on the whitelist. * Improve OTP whitelist error logging with more context * Refactor OTP whitelist method to require non-null phone number - Changed `phone_number` parameter from `Optional[str]` to `str` in `is_phone_number_whitelisted_for_default_otp`. - Removed `Optional` from imports since it's no longer needed. * Added check for whitelist configuration in OTPUtil class * Remove `default_otp` configuration from all environments - Deleted the entire `default_otp` block from `default`, `development`, `docker-dev`, and `preview` configuration files. - Indicates that the default OTP functionality is being deprecated or removed. - Simplifies configuration by eliminating obsolete settings. * Refactor OTPUtil class to remove try-except block and improve code readability * Removed trailing newline from otp_util.py file. * Refactor OTPUtil: rename is_phone_number_whitelisted_for_default_otp to should_use_default_otp_for_phone_number * Refactor test_otp_whitelist_api.py to use environment variables instead of mock ConfigService and SMSService * Refactor OTPUtil check in AuthenticationService: is_phone_number_whitelisted_for_default_otp -> should_use_default_otp_for_phone_number * Removed test_access_token_creation_with_whitelisted_number_default_otp test case * Changed type hint for ConfigService.get_value in OTPUtil class * Refactor default OTP whitelisted phone number configuration key in custom environment variables and OTP utility * Deleted test files for OTP whitelist functionality * Added test files for OTP whitelist functionality * Refactor test_otp_whitelist_api.py and test_otp_whitelist_service.py to remove unused imports and environment variables * Removed unused imports and type hints from otp_util.py * Removed test for creating account with no whitelist config and no SMS * Refactor DEFAULT_OTP_WHITELISTED_NUMBERS_WITH_COUNTRY_CODE to DEFAULT_OTP_WHITELISTED_NUMBER in multiple files * Update custom environment variables and OTP util to remove country code from whitelisted phone number * Refactor OTPUtil class: Simplify whitelist config check and add phone number comparison * Update DEFAULT_OTP_WHITELISTED_NUMBER to DEFAULT_OTP_WHITELISTED_PHONE_NUMBER in environment variable and test files * `Refactored test_otp_whitelist_service.py to remove duplicate tests and update test cases to reflect changes in OTPUtil behavior.` * `Refactor test_otp_whitelist_api.py to update test cases and environment variables` * `Remove unused mock.patch decorator in test_default_otp_enabled_matching_whitelist_no_sms` * `Added __name and __format to default_otp enabled variable in custom-environment-variables.yml` * `Refactor OTPUtil whitelisted_phone_number check: remove strip() call and simplify condition` * `Removed test_whitelist_with_spaces_is_trimmed test case` * Update custom-environment-variables.yml with no changes * `Removed enabled boolean format and replaced with a string value` * `Remove hardcoded "false" values for DEFAULT_OTP_ENABLED environment variable`
… and push notification (jalantechnologies#258) * feat: add user notification preferences with configurable email, SMS, and push notification (jalantechnologies#239) - Introduce AccountNotificationPreferencesModel & repository with schema validation - Implement get_notification_preferences and update_notification_preferences in AccountService - Expose PUT /accounts/<account_id>/notification-preferences endpoint in AccountRouter - Update AccountView to include notification_preferences when requested - Extend EmailService and SMSService to honor user notification_preferences - Add NotificationPreferences types and comprehensive API tests * refactor: notifcation preferences view * refactor: update notification preferences logic and related tests" * feat: add AccountNotificationPreferenceReader to encapsulate fetching notification preferences * chore: update return type of get_existing_notification_preferences_by_account_id to dict[str, Any] * chore: add cast for return type in get_existing_notification_preferences_by_account_id * Refactor: notification preference persistence to writer class * deleted diff.txt * refactor: module import in accout_service.py * Refactor notification preferences update to remove params object - Removed the `UpdateNotificationPreferencesParams` dataclass in favor of directly passing `account_id` and `NotificationPreferences`. - Updated `AccountService` and `AccountNotificationPreferenceWriter` methods to reflect this simpler signature. - Adjusted REST API layer to construct `NotificationPreferences` directly instead of the old params object. - Improves code clarity and reduces unnecessary indirection when updating notification preferences. * Rename `NotificationPreferences` to `NotificationPreferencesParams` - Renamed the `NotificationPreferences` dataclass to `NotificationPreferencesParams` to clarify its role as a DTO for API and service layers. - Updated method signatures and return types in `AccountService` and `AccountNotificationPreferenceWriter`. - Modified REST API view to construct and handle `NotificationPreferencesParams` instead of the old type. - Improves maintainability by making parameter objects explicit and reducing naming ambiguity. * Replace `NotificationPreferences` with `NotificationPreferencesParams` everywhere - Updated `AccountNotificationPreferenceReader` to return `NotificationPreferencesParams`. - Adjusted type hints in `EmailService` and `SMSService` to accept `NotificationPreferencesParams`. - Ensures consistency and alignment with earlier refactor that renamed the data class. - Keeps core logic unchanged while improving clarity of parameter object usage. * Update tests to use `NotificationPreferencesParams` - Removed usage of `UpdateNotificationPreferencesParams` in favor of `NotificationPreferencesParams`. - Updated `AccountService.update_notification_preferences` calls to pass `account_id` explicitly alongside preferences. - Kept test logic and assertions unchanged to ensure correct verification of notification preferences updates. * Refactor reader to return `NotificationPreferencesParams` instead of dict - Updated `get_existing_notification_preferences_by_account_id` to return `Optional[NotificationPreferencesParams]`. - Removed use of `cast` and direct dict return; now consistently returns domain-friendly DTOs. - Improves type safety and keeps repository details encapsulated within the reader. * Refactor reader & writer to reuse BSON→params util - Introduced `AccountNotificationPreferenceUtil` to convert BSON to `NotificationPreferencesParams`. - Updated reader to use insert+find so it returns the newly created document. - Updated writer's update method to use `find_one_and_update` and return the fresh document. - Removes duplication and ensures service always reflects stored data accurately. * Raise `NotificationPreferencesNotFoundError` if preferences not found - Removed automatic creation of default preferences on read. - Introduced `NotificationPreferencesNotFoundError` with error code `PREFERENCES_NOT_FOUND`. - Added `NotificationErrorCode` to centralize notification-related error codes. - Improves system transparency by forcing explicit creation of preferences instead of implicit defaults. * `Refactor test_notification_preferences_api.py: remove test_update_notification_preferences_with_missing_fields, rename test_update_notification_preferences_unauthorized to test_update_notification_preferences_no_auth` * Update tests to expect NotFoundError on missing preferences - Removed test that verified automatic creation of default preferences. - Added test ensuring `get_notification_preferences` raises `NotificationPreferencesNotFoundError` if preferences are missing. - Kept other tests for create, update, and retrieval unchanged to validate correct service behavior. - Aligns test suite with new explicit error-first design. * Add blank line for import grouping * Replace `update_notification_preferences` with `create_or_update_notification_preferences` - Removed `update_notification_preferences` from `AccountService` and replaced with clearer `create_or_update_notification_preferences`. - Updated REST API view and test cases to call the new method. - Keeps logic unchanged but improves method naming to better reflect actual behavior. * Restore `update_account_profile` method in service * Restore `update_account_profile` method in service * Refactor notification preferences handling into writer method - Introduced `create_or_update_notification_preferences` in `AccountNotificationPreferenceWriter` to encapsulate logic. - Simplified `AccountService` by replacing duplicated if-else logic with a single method call. - Improves maintainability and keeps service layer cleaner. * Remove legacy preference reader/writer and switch to new modules - Deleted `account_notification_preference_reader.py`, `account_notification_preference_writer.py`, and related util. - Updated `account_service.py` to import from new `account_notification_preferences_reader` and `account_notification_preferences_writer`. * Refactor REST and internal modules import paths - Deleted `notification_preferences_view.py` and switched to `account_notification_preferences_view.py`. - Updated imports in reader/writer modules to remove `apps.backend` prefix, using shorter module paths. - Keeps codebase cleaner and aligns REST view naming with domain terminology. * Moved 'account_notification_preferences_model' and 'account_notification_preferences_repository' to Notification module. * Moved 'account_notification_preferences_util.py' , 'account_notification_preferences_reader.py' and 'account_notification_preferences_writer.py' to Notification Module. * Moved 'account_notification_preferences_view.py' to Notifcation Module * Rename method for clarity in account service - Renamed `get_notification_preferences` to `get_account_notification_preferences`. - Makes it explicit that the method retrieves notification preferences for a given account. * Move notification preferences logic to notification service - Removed `create_or_update_notification_preferences` and `get_account_notification_preferences` from `AccountService`. - Added equivalent methods to `NotificationService` using internal reader/writer. - Clarifies service boundaries by centralizing notification handling. * Remove unused `NotificationPreferencesParams` import - Deleted leftover import from `account_service.py`. - Keeps code clean after moving notification logic to `NotificationService`. * Update REST views to use `NotificationService` - Changed `account_view.py` to fetch preferences via `NotificationService`. - Updated `account_notification_preferences_view.py` to create/update preferences through `NotificationService` instead of `AccountService`. - Keeps REST layer aligned with recent service separation. * Load notification preferences by account ID in services - Replaced explicit `preferences` parameter with `account_id` in both `EmailService.send_email` and `SMSService.send_sms`. - Integrated `AccountNotificationPreferenceReader` to fetch user preferences dynamically. - Added logging to warn if preferences cannot be retrieved. - Keeps respect for user notification settings unless `bypass_preferences` is set. * Reorder keyword arguments in notification services - Updated method signatures in `send_email` and `send_sms` to place `account_id` and `bypass_preferences` before `params`. - Keeps a consistent and clear keyword-only interface across notification services. - Helps make method calls easier to read and aligns with internal style conventions. * Improve logging with recipient and context info - Extended skipped notification logs to include recipient email/phone and account ID when available. - Added template ID (for emails) and message body snippet (for SMS) to logs. - Makes it easier to trace why specific notifications were skipped due to user preferences or configuration. * Simplify JSON schema by removing descriptions - Removed redundant `"description"` fields from the notification preferences validation schema. - Retained only the required `bsonType` validations to keep the schema concise. - Makes the schema easier to maintain without losing validation functionality. * Remove extra blank lines from preferences model * Add `active` flag to manage current preferences - Introduced an `active` boolean field in `AccountNotificationPreferencesModel` and validation schema. - Modified reader and writer queries to filter by `active=True`. - Added unique partial index on `(active, account_id)` to ensure only one active preferences document per account. - Keeps historical data while supporting safe updates and soft deletes. * Rename exception to clarify missing account preferences - Renamed `NotificationPreferencesNotFoundError` to `AccountNotificationPreferencesNotFoundError` for clarity. - Updated reader logic and tests to use the new exception. - Makes the error name more descriptive and consistent with the domain. * Rename reader methods for clearer account context - Renamed `get_notification_preferences_by_account_id` to `get_account_notification_preferences_by_account_id`. - Renamed `get_existing_notification_preferences_by_account_id` to `get_existing_account_notification_preferences_by_account_id`. - Updated all service and writer calls to use the new names. - Improves readability and keeps naming consistent with the domain. * Rename util method for clarity and consistency - Renamed `convert_notification_preferences_bson_to_params` to `convert_account_notification_preferences_bson_to_params`. - Updated all reader and writer usages to match the new name. - Keeps naming consistent and makes the method purpose clearer. * Rename methods for clearer account context - Renamed methods like `create_or_update_notification_preferences` → `create_or_update_account_notification_preferences`. - Renamed `get_account_notification_preferences` → `get_account_notification_preferences_by_account_id` for clarity. - Updated all service, writer, and REST API references to match new names. - Makes code more explicit and consistent in describing account-level notification preferences. * Rename methods for clearer account context - Renamed methods like `create_or_update_notification_preferences` → `create_or_update_account_notification_preferences`. - Renamed `get_account_notification_preferences` → `get_account_notification_preferences_by_account_id` for clarity. - Updated all service, writer, and REST API references to match new names. - Makes code more explicit and consistent in describing account-level notification preferences. * Unify account notification preferences under AccountView - Exposed methods in `AccountService` to create/update and fetch account notification preferences. - Moved `PUT` handler for updating preferences into `AccountView` instead of a separate view. - Removed `AccountNotificationPreferencesView` and updated the router to use `AccountView`. - Added validation for boolean fields in request data. - Keeps account profile and notification preferences management together in one controller. * Remove separate AccountNotificationPreferencesView and rest_api module - Deleted `account_notification_preferences_view.py` and its parent `rest_api` package. * Update tests to call NotificationService directly - Replaced calls to removed `AccountService` methods with direct `NotificationService` method calls. - Updated import statements to match new module structure. - Keeps tests aligned with refactored notification preferences flow. * Rename send methods to clarify account context - Renamed `send_email` → `send_email_for_account` and `send_sms` → `send_sms_for_account` in services. - Updated `NotificationService` to call the renamed methods. - Refactored tests to mock the new method names consistently. - Clarifies these methods handle sending notifications while respecting account preferences. * Make reader return Optional instead of raising exception - Changed `get_account_notification_preferences_by_account_id` to return `Optional` when no preferences exist. - Removed direct raising of `AccountNotificationPreferencesNotFoundError` from reader. - Updated writer to handle missing preferences by checking for `None`. - Moves responsibility for handling missing preferences to service layer for clearer separation. * Refactor reader to raise on missing preferences; handle in writer - Reader method now raises `AccountNotificationPreferencesNotFoundError` if no preferences found. - Writer uses `try/except` to decide between update or create. - Removed unused `Optional` import since method no longer returns `None`. - Keeps data access strict and business logic in writer layer. * Rename NotificationPreferencesParams → NotificationPreferences across codebase - Renamed the dataclass to `NotificationPreferences` for clarity and brevity. - Updated all references in services, writers, readers, utils, REST API, and tests. - Keeps field structure and behavior unchanged; only improves naming consistency. * Introduce AccountNotificationPreferences model with account_id - Added `AccountNotificationPreferences` dataclass including `account_id` field. - Updated reader, writer, and service layers to return this richer model. - Kept `NotificationPreferences` as the input/update type without `account_id`. - Added/updated tests to assert `account_id` presence in service layer, while keeping it hidden from API responses. - Improves separation of input vs. persisted data and keeps API clean. * Return AccountNotificationPreferences from service and writer methods - Updated `create_or_update_account_notification_preferences` and related writer methods to return `AccountNotificationPreferences`. - Ensures service layer has access to `account_id` for auditing or logging. - API responses keep `account_id` hidden to avoid leaking internal IDs. - Added/updated test assertions to check presence of `account_id` in service results, but absence in API output. * Rename NotificationPreferences → CreateOrUpdateAccountNotificationPreferences - Clarifies that this dataclass is used for creating or updating preferences and does not include `account_id`. - Kept `AccountNotificationPreferences` as the return/output type with `account_id`. - Updated service, writer, views, and all test files to use the new input type name. - Improves separation of input DTOs from persisted data models. * Remove silent error handling in notification services - Removed `try/except` when fetching notification preferences. - Allow exceptions (like `AccountNotificationPreferencesNotFoundError`) to propagate instead of logging and continuing silently. - Simplified SMS disabled log message to avoid extra account context. - Improves transparency and ensures real errors aren't hidden. * Reformat test dataclass initialization for clarity - Reformatted `CreateOrUpdateAccountNotificationPreferences` instances in test files to multi-line. - Improves readability and makes future diffs clearer. - No functional change; test logic and values remain the same. * Handle missing account notification preferences gracefully - Wrapped preferences retrieval in `try/except` to catch `AccountNotificationPreferencesNotFoundError`. - Skips adding `notification_preferences` field if preferences are not yet created. - Avoids breaking the `/accounts/:id` endpoint when preferences are missing. * Remove `account_id` from notification preferences in API response - When returning `notification_preferences`, remove `account_id` field to avoid redundancy. - Keeps API responses clean by excluding internal identifiers from nested objects. - Applied to both GET and PUT endpoints handling notification preferences. * Move `AccountNotificationPreferenceReader` import to module level - Removed local import inside `create_or_update_account_notification_preferences` method. - Imported `AccountNotificationPreferenceReader` at the top of the module for clarity and efficiency. * Include `account_id` in notification preferences API response - Removed code that removed `account_id` from `asdict` output before returning JSON. - Updated tests to check for `account_id` presence and value in the response. - Improves transparency by showing which account’s preferences are being returned. * Make `account_id` mandatory when sending emails and SMS - Updated `EmailService.send_email_for_account` and `SMSService.send_sms_for_account` to require `account_id`. - Removed optional handling and always check user preferences. - Updated `NotificationService` to pass `account_id` explicitly. - Simplified logic by removing `None` checks. - Ensures user notification preferences are always respected. * Update tests to verify `account_id` propagation in notifications - Adapted `create_otp` calls in tests to pass `account_id`. - Updated email & SMS mock assertions to check `account_id` is included. - Verified recipient and message content remain correct. - Ensures new mandatory `account_id` is correctly handled across the stack. * Rename type to `CreateOrUpdateAccountNotificationPreferencesParams` - Renamed dataclass to clearly indicate it's used for request parameters. - Updated all usages in `AccountService`, notification service, writers, and tests. - Ensured consistent naming between API layer, service layer, and tests. * Refactor writer: clean imports and remove redundant fields - Reformatted multi-import of notification types for readability. - Removed manual setting of `active`, `created_at`, and `updated_at` when creating preferences. - These fields are now handled implicitly by the data layer. * Set default `None` for `id` field in preferences model - Updated `AccountNotificationPreferencesModel` to default `id` to `None`. - Simplifies creating new preference instances when inserting into the database. - Keeps existing default values for notification fields unchanged. * Unify PATCH method and remove separate PUT endpoint - Removed separate `put` method; all partial updates now handled by `patch`. - Adjusted router to register `PATCH` for notification preferences. - Updated tests to use `PATCH` instead of `PUT`. - Simplifies API and better aligns with RESTful design by consistently using PATCH for partial updates. * Refactor `patch` method into helper methods - Split logic for account update and notification preferences into `_handle_account_update` and `_handle_notification_preferences_update`. - Added `_validate_notification_preferences` helper to centralize type checks. - Keeps `patch` method clean and easier to read by delegating responsibilities. * Use `Optional[str]` for patch method parameters - Updated `patch` method signature to explicitly allow `None` for `id` and `account_id`. - Improves code clarity and static analysis by making optional nature of parameters explicit. * Simplify SMS mock assertions in account tests - Removed intermediate `call_args` variable. - Accessed `mock_send_sms.call_args.kwargs` directly in assertions. - Keeps tests clear and concise while maintaining the same verification logic. * Update test to expect successful PATCH and check response - Changed expected status from 401 to 200. - Added assertions to verify updated fields in the response. - Confirmed `account_id` in response matches target account. * Update test to expect successful response for unauthenticated preference fetch - Changed status code assertion from 401 to 200, reflecting new expected behavior. - Removed check for access token error code. - Added assertions for specific notification preferences fields in the JSON response. * Revise invalid token test to expect 200 response with preference data - Updated expected status code from 401 to 200, indicating a shift in handling invalid tokens. - Added assertions to check the returned notification preferences and `account_id`. - Suggests a new behavior where preferences are accessible despite token issues. * Refactor notification preferences to be explicitly optional - Changed `CreateOrUpdateAccountNotificationPreferencesParams` fields to `Optional[bool]` instead of defaulting to True. - Updated API to require at least one preference field when updating to avoid silent defaults. - Writer now defaults missing fields to True only on insert, ensuring existing logic stays consistent. - Update method selectively updates only fields provided, preventing unintended overwrites. * Added type hint for update_data and imported typing module. * Added test cases for notification preferences API and service * "Update condition in _handle_notification_preferences_update method to check for None request_data instead of empty dictionary." * `Update SMSService.send_sms call to use send_sms_for_account method` * `Update test_otp_whitelist_api.py to use send_sms_for_account instead of send_sms` * `Refactor account view and authentication service to update notification preferences method name` * "Remove unused code in TestAccountPasswordReset class" * Update notification error codes and imports in notification module * Update AccountNotificationPreferenceUtil method names to be consistent * Removed redundant try block in AccountNotificationPreferenceWriter.create_or_update_account_notification_preferences method. * Removed unused imports and code, simplified patch method in account_view.py * Refactor account notification preferences update endpoint in account router and view * Added functionality to include account notification preferences in account view response * Removed test_update_notification_preferences_all_false test case * Added new method update_account_notification_preferences to AccountView class. * Remove 'self' parameter from update_account_notification_preferences method * Refactor AccountNotificationPreferenceWriter: rename methods and add underscore prefix
jalantechnologies#273) * Chore: Bump CI workflow to v3.2.2 and skip Temporal rollout in preview * Chore: Add missing newline (EOL) at end of post-deploy.sh
* docs: add backend architecture doc * refactor: update doc as per feedback
* Added account deletion functionality * Remove unused imports and AccountAlreadyDeletedError from various modules * Removed unused import and adjusted line count in account/types.py * Removed logging statements from account deletion methods * Refactor initiate_account_deletion method to return None and remove unnecessary return statements * Refactored delete_account_with_otp method to remove try-except block and moved exception handling to the OTP verification step. * Refactor account deletion logic in AccountWriter * Removed account deletion functionality and related code * Refactor account routes in account_router.py to use a constant for the account ID URL pattern. * Refactor account deletion logic to return Account instead of AccountDeletionResult * Removed account deletion initializer and related hooks and registry. * Removed AccountReader.check_phone_number_not_exist call in AccountWriter. * Removed unused import and added check for existing phone number in AccountWriter * Update message in AccountInvalidPasswordError class to include 'you’ve' instead of 'you've'. * Update delete method in AccountView to return a success message instead of the deleted account object. * Added test cases for account deletion in test_account_api.py and test_account_service.py * Removed test_delete_account_unauthorized_access_different_account test case * Added test case to verify account creation with same phone number after deletion * Added deletion result object and updated API and service to return deletion result instead of account object * Refactored delete method in AccountView to return a 204 status code with no response body. * Update account_writer.py: change delete_account return type and update_at field * Added two new indexes to AccountRepository: active_username_index and active_phone_number_index. * Removed unused import and datetime call, removed unnecessary method call in delete_account method * "Added newline at end of file in account_service.py" * Removed unused import statement in account_service.py * Refactor DeletionResult to AccountDeletionResult in account module * Update test_account_api.py to assert 204 status code and empty response body for account deletion
* Added TaskRestApiServer and registered task blueprint to api_blueprint * Refactor pagination parameters in TaskReader class * Added import from typing and modified type hint for task_id in TaskView.get method * Added getattr to access request attributes in TaskView class methods * Readded app.register_blueprint(api_blueprint) after task_blueprint registration * Removed two index creation commands in TaskRepository's on_init_collection method. * Update method signatures to use keyword-only arguments * Added TaskDeletionResult and updated delete_task methods to return TaskDeletionResult * Update TaskWriter.delete_task method to use params in TaskReader.get_task_for_account call * Added pagination to task API endpoints * Refactor task reader and service to use GetPaginatedTasksParams instead of GetAllTasksParams * Added test files * Changed None checks for request_data to is None in TaskView class * Update test_task_api.py to match expected API response structure * Refactor task pagination and size handling in TaskReader and TaskView * Refactor TaskReader and TaskView to handle pagination parameters * Removed test_no_request_body method from test_task_api.py * Refactor TaskView to use pagination_params and total_count directly in response data * Refactor test code for task module: extract common helpers and assertions into base test class * Added null checks for data in client requests and improved error handling in assert_error_response method. * Refactor test setup and teardown methods in base test task and remove unused imports. * Removed debug print statements from assert_error_response method * Refactor variable names in TaskView class: task_params -> create_task_params, update_params -> update_task_params * Refactor TaskModel: Remove default id value and adjust from_bson method * Update task types and reader to use PaginatedTasksResult instead of PaginationResult * Removed PaginationParams from imports and type hints in task_reader.py and task_service.py * Added partial filter expression to 'active_account_id_index' in TaskRepository's on_init_collection method. * Refactor task retrieval to use GetTaskForAccountParams instead of GetTaskParams * Added SortDirection enum and updated PaginationParams and TaskReader to use it * Added GetPaginatedTasksParams dataclass to types.py * `Refactor pagination parameters and constants in application and task modules` * Refactor task_service.py and task/types.py to remove PaginatedTasksResult type alias * Refactor task API endpoints to include account ID in URL and modify test cases accordingly * Fixed id field in TaskModel class * Refactor task service to simplify API and remove unused constant - Removed `DEFAULT_BATCH_SIZE` constant from pagination constants as it was unused. - Renamed `GetTaskForAccountParams` to `GetTaskParams` for clearer naming. - Simplified method names by dropping `_for_account` suffix (e.g., `get_task_for_account` → `get_task`). - Updated related imports, tests, and usage across service, reader, writer, and view layers. - Adjusted field order in `from_bson` and `convert_task_bson_to_task` methods to improve readability.
…nces (jalantechnologies#283) * fix: bypass notification preferences for authentication emails and SMS - Resolves account creation failure for non-whitelisted phone numbers - OTP SMS and password reset emails now bypass notification preferences - Prevents AccountNotificationPreferencesNotFoundError during authentication flows - Maintains existing behavior for whitelisted numbers using default OTP - Authentication-related notifications sent regardless of user preferences * Refactor notification preference checks in email and SMS services * Added default notification preferences creation for new accounts * Fixed AccountService._create_default_notification_preferences method calls to use account_id instead of account.id * Removed test_get_account_with_no_existing_notification_preferences * Removed test_get_notification_preferences_throws_error_when_none_exist method * Refactored create_account_by_username_and_password and create_account_by_phone_number methods in AccountService * Added tests for automatic creation of notification preferences when creating accounts by username or phone number * Added missing import and type in test_access_token_api.py and test_password_reset_token_api.py * Update import statements in test_access_token_api.py
…vice to improve code readability (jalantechnologies#286) * refactor(auth): extract implementation details from AuthenticationService - Create AccessTokenUtil to handle JWT generation and verification logic - Move email sending logic to PasswordResetTokenUtil.send_password_reset_email() - Move token verification logic to PasswordResetTokenUtil.verify_password_reset_token() - Clean AuthenticationService to show only public API methods - Update test files to use new utility method locations * Refactored verify_password_reset_token method in AuthenticationService to use PasswordResetTokenReader instead of PasswordResetTokenUtil * Refactored password reset email sending logic from PasswordResetTokenUtil to AuthenticationService * Update password_reset_token_util.py: no changes in the function implementation
…nologies#285) * fix: temporal deployment in preview * upgrade ci version to v3.2.3
…alantechnologies#289) * docs: add CLI tool setup instructions and manual cron testing steps * docs: add guide for running scripts in production * docs:remove extra lines and update installation guide * docs: undo changes in deployment.md
…gnostics (jalantechnologies#303) * chore(ci): add pre- and post-deploy hooks for capacity check and diagnostics * update workflow files * updated pre-deploy.sh * updated post-deploy.sh * finalizing the pr * change * change * change * feat(post-deploy): add -service and temporal-service to critical service diagnostics * refactor(deploy-scripts): keep logic but rewrite for clarity and onboarding * fix(post-deploy): add events fallback and conditionally check temporal service * revert(post-deploy): restore original service check and remove events fallback * revert(post-deploy): restore original service check and remove events fallback * revert(post-deploy): restore original service check and remove events fallback
…successful test execution (jalantechnologies#377)
* docs: add frontend architecture documentation * docs: add frontend architecture doc to readme * fix: resolve issue with mermaid diagram * docs: add overview to frontend architecture doc * docs: add explanatory paragraph for each section * docs: add video explanation for fe architecture
* feat: add permanent preview app * feat: test permanent_preview workflow on feature branch * feat: update README with environment & urls * feat: revert to main branch * feat: add workers-dashboard endpoints to README
* fix: update permanent preview domain * chore: test updated domain on feature branch * fix: revert to main branch
…s#411) * chore: update app reference to flask-react-template * chore: update README with updated endpoints * chore: fix cronjob metadata.name * chore: update paths on README * chore: fix paths on README * chore: update app name
…nd deployment (jalantechnologies#437) * chore: update app_name to flask-react-app in workflows * chore: add ready_for_review event type on ci.yml and cd.yml * chore: preview url commenting on PRs * chore: remove preview url commenting and add envs in cd.yml * chore: update ci version to v3.2.6
Contributor
|
This looks like a PR in response to assessment that we generally ask as part of our interview process. As instructed in the assessment, please raise PRs against your fork, do not raise PRs against the original repo. For now, we are closing the PR, and recommend you to raise the PR against your own repo and send that link as part of your assessment. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
A few sentences describing the overall goals of the pull request's commits. In case you are creating or updating new endpoints, please document request, response schema.
Database schema changes
Please document any change in database schema made part of this PR.
Tests
Automated test cases added
Manual test cases run
For each manual test case, list the steps to test or reproduce the PR.