Commit Graph

458 Commits

Author SHA1 Message Date
Mazyar ec3737e341 Merge branch 'develop' into TM-309 2025-12-08 12:08:44 +03:30
Nima Nakhsotin f514ac97ea Merge pull request 'send confirmation email after form submission' (#10) from TM-316 into develop
Reviewed-on: https://repo.ravanertebat.com/TM/tm_back/pulls/10
Reviewed-by: Nima Nakhsotin <n.nakhostin@ravanertebat.com>
2025-12-08 10:16:45 +03:30
Nima Nakhsotin 03ea86ca6a Merge branch 'develop' into TM-316 2025-12-08 10:16:23 +03:30
Nima Nakhsotin a67faf1ef0 Merge pull request 'xss validation' (#11) from TM-306 into develop
Reviewed-on: https://repo.ravanertebat.com/TM/tm_back/pulls/11
Reviewed-by: Nima Nakhsotin <n.nakhostin@ravanertebat.com>
2025-12-08 10:15:00 +03:30
Mazyar 7fb182f180 xss validation 2025-12-07 23:52:17 +03:30
Mazyar fbf99177a9 send confirmation email after form submission 2025-12-07 10:52:31 +03:30
Mazyar b01c0f9368 added hcaptcha 2025-12-05 18:10:05 +03:30
Nima Nakhsotin b8a10f355e Merge pull request 'tendsign scraper' (#8) from scraper into develop
Reviewed-on: https://repo.ravanertebat.com/TM/tm_back/pulls/8
Reviewed-by: Nima Nakhsotin <n.nakhostin@ravanertebat.com>
2025-12-03 10:16:41 +03:30
Mazyar 5e777ceec8 scraper sdk 2025-12-01 11:06:09 +03:30
Nima Nakhsotin d94fa34941 Merge branch 'develop' into scraper 2025-11-30 12:48:31 +03:30
Nima Nakhostin 00fabe8a30 Enhance Notice Repository with Additional Indexes
- Added new indexes for the notices collection in the notice repository to improve query performance.
- Introduced indexes for `processing_metadata.processed` and `main_classification`, optimizing data retrieval and management.
2025-11-30 12:43:51 +03:30
Mazyar b6546eb2bb tendsign scraper 2025-11-30 02:58:08 +03:30
Nima Nakhostin d57bf95c70 Update CMSForm Country Field Validation
- Modified the validation rule for the Country field in the CMSForm struct to ensure it requires exactly 3 characters, enhancing input validation consistency.
- This change improves the robustness of the form handling by enforcing stricter validation criteria.
2025-11-29 12:50:56 +03:30
Nima Nakhostin bb974ad1ce Enhance TED Scraper Initialization and Error Handling
- Updated the InitTEDScraper function to return a scheduler instance, allowing for better error handling during initialization.
- Added error logging for failed scheduler initialization and job scheduling, improving robustness.
- Implemented graceful shutdown for the scheduler in the main function, ensuring proper resource management during application termination.
2025-11-29 10:21:35 +03:30
Nima Nakhostin e2e9159ac3 Update GetUnProcessedNotices to filter by main_classification and change sort order
- Modified the GetUnProcessedNotices method in the notice repository to include a filter for main_classification set to "72000000".
- Changed the sort order from ascending to descending for the created_at field, improving the retrieval of unprocessed notices.
2025-11-29 10:11:51 +03:30
Nima Nakhsotin c1e1e211e5 Merge pull request 'changed search inquiry response to grt meta outside of the data' (#7) from inquiry-response into develop
Reviewed-on: https://repo.ravanertebat.com/TM/tm_back/pulls/7
Reviewed-by: Nima Nakhsotin <n.nakhostin@ravanertebat.com>
2025-11-25 12:56:09 +03:30
Mazyar 5062c19242 changed search inquiry response to grt meta outside of the data 2025-11-25 12:53:17 +03:30
Nima Nakhostin c8efa2c068 Refactor Scraper Dockerfile and Remove Entrypoint Script
- Removed the entrypoint.sh script from the scraper Dockerfile to streamline the build process.
- Updated the Dockerfile to directly set the ENTRYPOINT to the scraper build executable, simplifying the container startup.
- This change enhances maintainability by reducing the number of files and improving clarity in the Docker configuration.
2025-11-23 14:20:01 +03:30
Nima Nakhostin 10fd53af41 Refactor Scraper Configuration and Command Line Handling
- Removed command line flag parsing for date range scraping in the scraper's main function.
- Introduced configuration fields for one-time scraping and date range (FromDate, ToDate) in the ScraperConfig struct.
- Updated the main function to utilize the new configuration fields, improving the clarity and maintainability of the scraping logic.
- This change enhances the scraper's functionality by centralizing configuration management and reducing command line complexity.
2025-11-23 14:17:45 +03:30
Nima Nakhostin afb32a9fa3 Enhance CMS Entity with JSON Tags
- Added JSON tags to all fields in the CMS entity and its related sections (heroSection, chartSection, cardSection, contactSection, footerSection) to ensure proper serialization and deserialization in API responses.
- This change improves the API's usability by providing clear JSON representations of the CMS data structure.
2025-11-23 14:07:10 +03:30
Nima Nakhostin f1bdacdc98 Refactor Scraper Dockerfile and Add Entrypoint Script
- Replaced inline entrypoint script creation in the Dockerfile with a separate entrypoint.sh file for better maintainability and clarity.
- The new entrypoint script handles one-time scraping with date range support, improving the scraper's functionality and usability.
2025-11-23 13:48:27 +03:30
Nima Nakhostin 1f6d3fd1cb Enhance Scraper Dockerfile and Notice Entity
- Added an entrypoint script to the scraper Dockerfile to handle one-time scraping with date range support.
- Introduced a new ContentXML field in the Notice entity to store XML content, improving data structure for notices.
- Updated the scraper logic to map XML content to the tender entity, enhancing data processing capabilities.
2025-11-23 13:27:04 +03:30
m.nazemi 61a4465f50 Merge pull request 'added UUID to card and form field' (#6) from TM-290 into develop
Reviewed-on: https://repo.ravanertebat.com/TM/tm_back/pulls/6
2025-11-15 10:52:36 +03:30
Mazyar ba06595ab0 added UUID to card and form field 2025-11-15 10:51:04 +03:30
Nima Nakhostin a3472f432d Fix Middleware Usage in CMS Routes
- Corrected the middleware usage in the CMS routes by ensuring the AuthMiddleware is applied correctly.
- This change enhances the security of the CMS endpoints by enforcing authentication for all CMS-related operations.
2025-11-09 10:28:09 +03:30
Nima Nakhostin 265ea4a7c6 Enhance Swagger Documentation for CMS API
- Updated Swagger documentation to include new fields: CompanyName, Country, and Language, improving clarity and usability for API consumers.
- Added a new Type field with enumerations for Company and Organization, enhancing data categorization in the CMS API.
- Reflected changes in the definitions for CMS entities, ensuring accurate representation of the API structure and expected inputs/outputs.
- Improved examples in the documentation to provide better guidance for developers integrating with the CMS API.
2025-11-09 10:21:41 +03:30
Nima Nakhostin a363078d6f Enhance CMS Entity and Forms with Type Field
- Added a new Type field to the CMS entity to differentiate between Company and Organization types, improving data categorization.
- Updated the CMSForm to include validation for the Type field, ensuring proper input handling.
- Modified the ToResponse method to include the Type field in the CMSResponse, enhancing the API response structure.
- Adjusted the copyFormToEntity method in the CMS service to handle the new Type field, maintaining data integrity based on the selected type.
- Enhanced Swagger documentation to reflect the changes in the CMS API, providing clear examples for the new Type field.
2025-11-09 10:21:25 +03:30
Nima Nakhostin 1a56070556 Add MinIO Package for Object Storage Management
- Introduced a comprehensive MinIO package for managing object storage, including support for hierarchical document storage and general file management.
- Implemented core components such as Config, ConnectionManager, and Service, following Clean Architecture principles.
- Added functionality for file uploads, downloads, bucket management, and structured logging, enhancing usability and maintainability.
- Included detailed error handling and validation for configuration and operations, ensuring robustness.
- Updated documentation with usage examples and configuration guidelines to facilitate integration and understanding of the package's functionality.
2025-11-09 09:52:09 +03:30
Nima Nakhostin 9fe86d4f8e Update CMS Entity and Forms to Include New Fields
- Added new fields to the CMS entity: CompanyName, Country, and Language, enhancing the data structure for better content management.
- Updated the CMSForm to include validation and examples for the new fields, ensuring proper input handling.
- Modified the copyFormToEntity method in the CMS service to map the new fields from the form to the entity, maintaining data integrity.
- Enhanced Swagger documentation to reflect the changes in the CMS API, providing clear examples for the new fields.
2025-11-09 09:24:23 +03:30
n.nakhostin 7fc6568d02 Implement Tender ID and Project Name Generation in Notice Worker
- Refactored the NoticeWorker to generate unique tender IDs using the PBL naming convention (SCDYYNNN format) and project names based on client and opportunity details.
- Introduced methods for generating tender IDs and project names, including logic for extracting client and opportunity names, ensuring consistency and clarity in naming.
- Updated the Tender entity to include a new ProjectName field, enhancing the data structure for better project identification.
- Added MongoDB indexing for the new project_name field to optimize query performance.
- Improved error handling and logging during the tender ID generation process, ensuring robustness in the worker's functionality.
2025-11-04 17:17:46 +03:30
n.nakhostin 08116981f4 Enhance Scraper with One-Time Date Range Functionality
- Added command line flags for specifying a date range and a one-time scraping mode in the scraper's main function.
- Implemented validation for the date inputs to ensure both dates are provided and correctly formatted.
- Introduced a new RunOneTimeScraping function to handle the one-time scraping logic, including context management and error handling.
- Updated the TED scraper initialization to support both scheduled and one-time scraping modes, improving flexibility in data retrieval.
- Enhanced logging to provide clear feedback on the scraping process and any errors encountered.
2025-11-04 16:53:31 +03:30
n.nakhostin fafccd0d74 Refactor Worker Initialization to Integrate GLM SDK
- Updated the worker initialization process to include the new GLM SDK, enhancing the worker's capabilities for translation tasks.
- Modified the InitWorker function and NewNoticeWorker constructor to accept the GLM service, ensuring a cohesive integration.
- Implemented the GLM service initialization and logging for successful setup, improving maintainability and usability.
- Updated the NoticeWorker to utilize the GLM SDK for translating notice titles and descriptions, enhancing functionality and user experience.
2025-11-04 16:51:45 +03:30
n.nakhostin a5d3a94c97 Add GLM SDK Implementation
- Introduced a new GLM SDK for interacting with the GLM (Zhipu AI) API, designed for chat completions and text generation tasks.
- Implemented core components including Client, Service, and SDK layers following Clean Architecture principles.
- Added configuration management, error handling, and structured logging for improved usability and maintainability.
- Included comprehensive documentation and usage examples to facilitate integration and understanding of the SDK's functionality.
- Enhanced the API with features such as chat completion, streaming responses, and model management, ensuring robust interaction with the GLM service.
2025-11-04 16:09:44 +03:30
n.nakhostin dae8eb44e2 Add Documentation Copy Step in Dockerfile
- Added a step in the Dockerfile to copy the documentation files from the build stage to the final image.
- This change ensures that the documentation is included in the Docker image, improving accessibility for users and developers.
2025-11-04 11:55:37 +03:30
n.nakhostin cdd636485d Update Swagger Documentation for CMS Endpoints
- Refactored API paths to replace "companies" with "cms" for better alignment with CMS management functionality.
- Updated descriptions, parameters, and responses for CMS-related endpoints to reflect new functionality, including search, create, retrieve, update, and delete operations.
- Enhanced the Swagger documentation to include detailed definitions for CMS entities, forms, and responses, ensuring comprehensive API specifications.
- Improved consistency in naming conventions and descriptions across the CMS API endpoints.
2025-11-04 11:15:48 +03:30
n.nakhostin 9a444a1e7d Add CMS Management Functionality
- Introduced a new CMS management feature, including the ability to create, retrieve, update, search, and delete CMS entries.
- Implemented the CMS entity, repository, service, and handler layers following Clean Architecture principles.
- Added API endpoints for CMS operations in Swagger documentation, ensuring comprehensive API specifications.
- Enhanced error handling and validation for CMS data, improving robustness and user experience.
- Updated the main application to initialize the CMS repository and service, integrating them into the existing system.
2025-11-03 13:20:58 +03:30
n.nakhostin 875447ac58 Add Contact Management Functionality
- Introduced a new contact management feature, including the ability to create, retrieve, search, update, and delete contact messages.
- Implemented the Contact entity, repository, service, and handler layers following Clean Architecture principles.
- Added API endpoints for contact operations in Swagger documentation, ensuring comprehensive API specifications.
- Enhanced error handling and validation for contact data, improving robustness and user experience.
- Updated the main application to initialize the contact repository and service, integrating them into the existing system.
2025-10-25 18:15:39 +03:30
n.nakhostin 889a56a9f9 Update Notification Handler to Send Notifications Asynchronously
- Modified the Send method in the NotificationHandler to dispatch notifications asynchronously by using a goroutine, improving responsiveness and allowing the handler to return immediately after initiating the send process.
- This change enhances the user experience by not blocking the request while the notification is being sent, ensuring smoother operation of the API.
2025-10-20 11:57:37 +03:30
n.nakhostin 7b09291271 Improve Error Handling in GetOJS Function
- Enhanced the GetOJS function to include error handling for reading the response body and parsing CSV records, ensuring that errors are properly returned instead of being ignored.
- Added a check to ensure that the CSV records contain data, returning a meaningful error if the calendar is empty, which improves robustness and clarity in error reporting.
2025-10-20 11:42:08 +03:30
n.nakhostin eead4b05d8 Refactor Worker Initialization to Remove Ollama SDK Dependency
- Removed the Ollama SDK from the worker initialization process, simplifying the worker's dependencies and enhancing maintainability.
- Updated the InitWorker function and NewNoticeWorker constructor to reflect the removal of the Ollama SDK, ensuring a cleaner and more focused implementation.
- Commented out the Ollama model listing logic for potential future use, maintaining clarity in the main function while reducing unnecessary complexity.
2025-10-20 11:32:50 +03:30
n.nakhostin 729c73a8af Refactor Notification Service to Handle Optional Image and Link Fields
- Updated the Send method in the notification service to handle optional image and link fields more gracefully by using local variables.
- Improved logging to ensure that the correct values are sent in the notification context, enhancing clarity and maintainability of the notification process.
- This change ensures that nil values for image and link do not cause dereferencing issues, improving overall robustness of the notification sending logic.
2025-10-20 09:38:13 +03:30
n.nakhostin 01d3826003 Remove assets copy step from Dockerfile for worker service to streamline build process 2025-10-18 10:20:04 +03:30
n.nakhostin 10a9081c68 Add Worker Build Step and Dockerfile for Background Processing
- Introduced a new build step in the Drone CI configuration for the worker service, enabling automated Docker image creation.
- Added a Dockerfile for the worker service, defining the build process and dependencies, ensuring a streamlined deployment for background tasks.
- Enhanced the overall CI/CD pipeline to support the new worker service, improving the project's build and deployment capabilities.
2025-10-18 09:07:46 +03:30
n.nakhostin 69d201479f Merge branch 'feature/ai-translator' into develop 2025-10-18 09:04:32 +03:30
n.nakhostin 8e5308b70b Refactor NoticeWorker to Enhance Tender Creation Logic
- Updated the ToTender method to accept a tender instance, allowing for direct population of tender fields from the notice entity.
- Simplified the tender creation and update process by checking if the tender ID is zero, streamlining the logic for handling tender entities.
- Removed the commented-out code related to AI translation, improving code clarity and maintainability.
- Enhanced error logging for tender creation and update failures, ensuring better visibility into potential issues during processing.
2025-10-18 09:02:11 +03:30
n.nakhostin 952986331a Enhance Notification and User Models with New Fields and Update Swagger Documentation
- Added 'image' and 'link' fields to the NotificationRequest and NotificationResponse structures, improving the flexibility of notification content.
- Updated the 'created_at', 'updated_at', and 'schedule_at' fields to use integer types for Unix timestamps, ensuring consistency in time handling.
- Expanded the tender status enumeration to include 'closed', 'modified', 'suspended', and 'published', enhancing the representation of tender states.
- Reflected these changes in the Swagger documentation, ensuring accurate API specifications for clients.
2025-10-16 16:47:36 +03:30
n.nakhostin fe3ed00a24 Update SearchForm in Feedback Module to Use Query Parameters
- Modified the SearchForm struct to utilize query parameters for feedback search criteria, enhancing API consistency and usability.
- Updated validation tags accordingly to reflect the new query parameter structure, ensuring proper validation during request handling.
2025-10-16 16:20:47 +03:30
n.nakhostin 0747908873 Add AlertMail Configuration and Enhance TED Scraper Notification Logic
- Introduced AlertMail configuration in both scraper and worker bootstrap files, allowing for customizable email notifications.
- Updated the TED scraper to utilize the AlertMail configuration for sending completion notifications, improving flexibility in notification management.
- Enhanced error logging in the worker's main function to capture issues when listing Ollama models, ensuring better visibility into potential failures.
- Refactored notification sending logic to check for a valid AlertMail before dispatching emails, ensuring notifications are only sent when configured.
- Improved overall structure and readability of the bootstrap configuration files, aligning with best practices for maintainability.
2025-10-16 16:20:23 +03:30
n.nakhostin 1c3ad648c1 Implement Worker Service and Refactor Tender Initialization
- Introduced a new worker service with a dedicated main entry point for handling background tasks, including MongoDB connection management and notification service initialization.
- Added a bootstrap package to manage application configuration, logging, and service initialization for the worker.
- Implemented a NoticeWorker to process unprocessed notices and create corresponding tender entities, enhancing the integration of notice management within the tender system.
- Refactored the tender service to remove the Ollama SDK dependency, streamlining the service initialization in the main application.
- Enhanced the notice repository with a method to retrieve unprocessed notices, improving data handling capabilities.
2025-10-05 16:17:41 +03:30
n.nakhostin 02157693af Refactor TED Scraper Initialization in Main Application
- Moved the initialization of the notification service to follow the MongoDB connection setup for better organization.
- Added comments to clarify the initialization sequence of services, including the TED scraper.
- Removed commented-out code related to stopping the scheduler to clean up the main function.
- Enhanced the overall readability and structure of the main application entry point.
2025-10-04 15:25:40 +03:30