Introduce new apis and frontend to mp_web_app#1
Merged
IvanPartsunev merged 49 commits intomainfrom Nov 14, 2025
Merged
Conversation
…presigned URL functionality
… for layout and UI - Introduced admin and news management pages with CRUD functionality. - Added reusable components: `Pagination`, `Table`, `AdminLayout`, `ConfirmDialog`, `GalleryImageCard`, and `NewsCard`. - Enhanced navigation with an "Admin Panel" button for admin users. - Improved AuthContext for handling auth failures and better session management.
…actor JWT utilities - Implemented `useToast` hook for toast notifications. - Updated API base URL handling for development environment. - Enhanced API client with improved 401 error handling, token refresh logic, and silent logout on refresh failures. - Added `decodeJwt` and `getUserRole` utilities for JWT parsing and role extraction.
- Updated and added dependencies for Radix UI components, including `@radix-ui/react-checkbox`, `@radix-ui/react-dialog`, and `@radix-ui/react-select`. - Included new libraries like `next-themes` for theme handling and `sonner` for toast notifications. - Addressed version upgrades for existing packages to ensure compatibility and performance improvements.
…h handling - Added `Unsubscribe` page with email and token validation, API integration, and user feedback. - Enhanced dialogs with descriptions for better user guidance in user and news management pages. - Improved AuthContext with periodic auth checks, silent token refresh, and session consistency across tabs. - Updated API client to handle token expiration, refresh failures, and session invalidation more reliably.
…ement logic - Changed email button background color for consistency with new design. - Adjusted verification and unsubscribe link generation for better routing. - Improved cookie handling to conditionally set domain only in production environments.
…d update user model - Forced new array reference in `setUsers` for triggering React re-render. - Updated edit dialog logic to clear form data and reset selected user on close. - Added `active` field to `User` model for better user state tracking. - Adjusted `fetchUsers` flow to ensure proper state reset after user updates.
…ty listeners - Removed silent token refresh logic and related async `checkAuth` functionality. - Simplified `checkAuth` to only verify token existence without API calls. - Cleaned up unused imports and redundant logic for better maintainability. - Eliminated periodic auth checks and visibility listeners for consistency across sessions.
- Added lightweight token validation using `news/get` API on mount. - Automatically updates login state based on token validity or refresh status. - Handles 401 errors by clearing token and updating state accordingly.
…and remove unused `operations.py` - Updated imports across modules to reflect the change from `database.operations` to `database.repositories`. - Removed `operations.py` in favor of modularized repository implementations. - Added comprehensive tests for auth, news, and user operations to ensure functionality after changes. - Simplified repository structure for better maintainability and scalability.
…and remove unused `operations.py` - Updated imports across modules to reflect the change from `database.operations` to `database.repositories`. - Removed `operations.py` in favor of modularized repository implementations. - Added comprehensive tests for auth, news, and user operations to ensure functionality after changes. - Simplified repository structure for better maintainability and scalability.
- Added tests for `_create_file_name`, `_validate_metadata`, and `_check_file_allowed_to_user` functions. - Improved filename validation by adding checks for invalid extensions, special character removal, and custom name handling. - Updated `conftest.py` with mock AWS credentials for better isolation. - Included `httpx` in `requirements-test.txt` for HTTP client testing.
- Introduced `setup.sh` script for automated environment setup and dependency management. - Migrated from Poetry to Hatchling for build and dependency management in `pyproject.toml`. - Updated dependencies, dev dependencies, and ignored files for better project organization. - Added `uv.lock` for workspace dependency tracking.
- Added support for `Authorization` header in `news/get` API, maintaining legacy token query param for backward compatibility. - Implemented token refresh flow in frontend, updating news fetching logic to retry with refreshed tokens. - Improved error handling with retry options for news fetching. - Updated pagination component with localized text for "Previous" and "Next" buttons.
…espace - Reordered imports across multiple modules for consistency and PEP8 compliance. - Replaced `List` and `Dict` with modern `list` and `dict` typing annotations. - Removed excessive and redundant whitespace for better code readability. - Improved minor formatting issues in test files and routers.
… max warnings, and adjust dependencies - Replaced all instances of `@ts-ignore` with `@ts-expect-error` for explicit error handling in dynamic imports and utility functions. - Increased ESLint `--max-warnings` limit from 0 to 100 to reduce CI enforcement strictness during linting. - Updated `package.json` dev dependencies, including combining `@typescript-eslint` plugins and adding `globals`.
- Added `.npmrc` to configure pnpm behavior and improve dependency management. - Introduced `tsconfig.node.json` for TypeScript compilation targeting Node.js modules. - Added `eslint.config.js` with customization for React, TypeScript, and plugin rules. - Committed `pnpm-lock.yaml` for consistent dependency resolution and version control.
…ponents - Added contact information card with address, email, and phone details. - Integrated Google Maps iframe for location visualization. - Introduced a "About Us" section highlighting company history and activities. - Improved layout with responsive grid structure and enhanced visual presentation.
- Added `Board` and `Control` components to display members dynamically.
- Integrated API endpoints (`/board-members` and `/control-members`) for fetching respective member data.
- Updated `UserManagement` roles display with localized labels ("УС" & "КС").
- Enhanced UI structure with cards and tables for member details presentation.
- Removed `mp-web-app` module and integrated components directly into the backend and frontend directories. - Updated navigation component with sticky behavior and improved styling. - Replaced `UploadsRepository` with `FileMetadataRepository` across file operations for improved consistency. - Refactored `UserCodeRepository` references to `MemberRepository`, aligning with updated user/member model changes. - Enhanced news cards and mobile navigation styles for better user experience. - Added `aws-cdk-lib` and `constructs` as dev dependencies in `pyproject.toml` for infrastructure management.
- Updated environment variables, tests, models, and routers to use `member_code` instead of `user_code`. - Adjusted frontend components and registration flows to align with the renamed field. - Refactored `MemberRepository` methods and logic to incorporate the terminology change. - Updated Makefile installation commands for clarity and to remove redundant comments.
…r repository usage - Deleted `Member` model and associated logic from user operations and routers. - Consolidated member validation functions within `members.operations`. - Updated `User` model fields to allow optional `email` and `phone` entries. - Removed deprecated `create_members` API endpoint and corresponding methods. - Simplified import paths and removed redundant dependencies.
- Introduced `member_create` and `members_upload` API endpoints for member management. - Added `members.routers` and `operations` modules to handle member-related requests. - Integrated member router into the main API application. - Enabled file type validation for member list uploads with `.pdf` support.
- Renamed `members_upload` API endpoint to `sync_members_list` for clarity. - Added CSV file support for member list uploads, replacing the previous PDF validation. - Implemented functions for CSV parsing, normalization, and syncing members in the database. - Improved code structure by splitting logic into reusable functions and handling bulk updates/deletions efficiently. - Updated models and validation to ensure data integrity during synchronization.
…ackend - Refactored frontend components to adhere to consistent formatting, including adjustments to destructuring, indentation, and whitespace. - Updated backend test files for improved readability and alignment with project standards. - Removed redundant code and ensured cleaner JSX and TypeScript syntax in various components. - Standardized usage of inline JSX elements and simplified logic where applicable. - Ensured consistency in import statements and type definitions throughout.
…ion usages - Added custom exception classes across the backend for improved error handling and clarity. - Refactored operations and routers to raise domain-specific exceptions instead of relying on `HTTPException`. - Enhanced error translation in API endpoints for consistent HTTP responses. - Updated imports and dependencies to integrate the new exceptions module seamlessly. - Improved maintainability and readability by decoupling generic HTTP exceptions from business logic.
- Added `members_list`, `member_update`, and `member_delete` API endpoints for enhanced member management. - Implemented backend operations for listing, updating, and deleting members in the database. - Introduced new domain-specific exceptions (`MemberNotFoundError`, `ValidationError`) for improved error handling. - Updated routing and operation logic to support robust CRUD functionality in the members module.
…esponse - Introduced `MemberPublic` model to provide limited member details (first_name, last_name, proxy). - Enhanced `members_list` endpoint to support a `proxy_only` filter for selective member retrieval. - Modified response to conditionally return either full member details or public model based on user roles. - Updated `list_members` operation to handle proxy-based filtering logic.
- Introduced custom exception classes across backend modules (`news`, `members`, `files`, `gallery`, `mail`) to improve error clarity. - Added detailed exception messages and contextual information (e.g., IDs, file names, allowed formats) to support debugging.
- Introduced `ProductModel` for product data representation. - Added product CRUD API endpoints: `product_list`, `product_create`, `product_update`, and `product_delete` to manage product entries. - Implemented `ProductRepository` with DynamoDB integration for product operations. - Integrated product router into the main API application with a `/api/product` prefix. - Updated backend stack to include `products_table` for product storage.
…ntend
- Renamed multiple API endpoints for consistency, aligning with RESTful conventions (e.g., replacing "/upload" with "/create", "/get" with "/list").
- Updated routes to use path parameters instead of query parameters for better RESTful design (e.g., "/delete?news_id=" to "/delete/{news_id}").
- Adjusted affected backend routers, operations, and exception handling to comply with new routes.
- Revised frontend API calls and logic to match the updated endpoint paths.
- Enhanced code readability and maintainability across backend and frontend.
- Moved `DatabaseError` to a dedicated `database.exceptions` module for better organization and reusability. - Removed redundant `DatabaseError` definitions from multiple backend modules. - Updated import statements across all affected files to reference the new centralized module.
- Replaced `ProductModel` with `Product` for cleaner data representation. - Added `ProductUpdate` model for update-specific validations. - Implemented detailed CRUD operations with robust DynamoDB integration. - Introduced `ProductNotFoundError` for precise error handling. - Refined product-related endpoints to align with new models and operations.
- Adjusted multiple import statements for consistency and alignment with project standards. - Applied uniform formatting to improve code readability and organization. - Removed redundant line breaks and trailing commas in several files.
- Introduced detailed exceptions like `UserNotFoundError`, `NewsNotFoundError`, and `ProductNotFoundError` for clearer error handling. - Updated operations and routers across modules to raise domain-specific exceptions. - Simplified HTTP response handling by translating custom exceptions into appropriate status codes. - Adjusted related tests, imports, and error messages for consistency.
- Added S3 bucket, CloudFront distribution, and OAI for secure and optimized access to gallery uploads. - Updated gallery operations to use CloudFront URLs with a fallback to S3 presigned URLs. - Enhanced `get_gallery_images` to optionally include URLs for images. - Updated `BackendStack` to pass CloudFront domain and distribution ID to backend application. - Enabled cache invalidation permissions for CloudFront distribution in backend Lambda.
- Renamed API endpoints in files and users modules for consistency (`get_files` -> `list`, `list-users` -> `list`). - Streamlined gallery operations by embedding image URLs directly in responses, removing redundant presigned URL fetch logic. - Replaced static content in Products page with dynamic `ProductsTable` component.
- Replaced `float` fields in `Product` and `ProductUpdate` models with `Decimal` for improved precision handling. - Added `json_encoders` and `from_attributes` configs to models for custom serialization and attribute mapping. - Updated `create_product` operation to return the created product instance. - Fixed key casing in `scan` operation to correctly retrieve DynamoDB Items.
…management - Updated Navigation menu to consolidate "За нас" and "Списъци" sections for improved usability. - Introduced `ProductsTable` component with dynamic content and integrated pagination. - Enhanced `FilesTable`, `GalleryImageCard`, and `Dialog` components with improved styling and responsive layouts. - Added `ProductsManagement` and `DocumentsManagement` modules to the admin panel. - Refined member list and proxies pages to fetch data dynamically via API. - Standardized visual appearance with updated `Card` and `Table` components. - Adjusted CSS styles for a consistent design theme across the app.
…ce Makefile - Removed redundant React imports across multiple components for optimization. - Standardized default prop values in `ProductsTable` and `FilesTable` components. - Enhanced Makefile with frontend deployment and CloudFront cache invalidation tasks. - Updated dependencies and lock files to improve consistency.
…ntend deployment - Switched `API_BASE_URL` in `app-config.ts` to the production domain. - Updated Makefile to sync frontend assets to the updated S3 bucket path.
- Passed `PRODUCTS_TABLE_NAME` environment variable to the backend Lambda. - Granted read/write permissions to the backend Lambda for the Products table.
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
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.
Product Management & Infrastructure Enhancements
This PR introduces comprehensive product management capabilities and infrastructure improvements:
Key Features:
Added full CRUD operations for product management with Decimal support for pricing
Integrated CloudFront for optimized upload handling and gallery operations
Implemented member management API with CSV sync support and proxy-based filtering
Enhanced navigation structure and UI components across the application
Infrastructure & Refactoring:
Migrated to domain-specific exceptions, replacing generic HTTPException usage throughout
Centralized error handling with DatabaseError and custom exception types
Standardized API endpoints and routes across backend and frontend
Added Products table support in BackendStack with production deployment configuration
Optimized imports and code formatting across modules
Technical Improvements:
Updated API base URL to production environment
Enhanced gallery image handling with simplified operations
Improved type safety and removed unused dependencies
Standardized default props and cleaned up unused imports