Commit Graph

146 Commits

Author SHA1 Message Date
n.nakhostin 96d3b4fb9c Refactor Tender Entity and TED Parser for Clarity and Consistency
- Updated the Tender entity to remove redundant comments on Unix timestamp fields, enhancing code readability.
- Renamed the AwardedEntity type to Awarded for improved clarity and consistency in naming conventions.
- Removed the transformPriorInformationNoticeToContractNotice method from TEDParser, streamlining the parser's functionality and reducing legacy code.
2025-09-28 11:59:24 +03:30
n.nakhostin f57e53bd9b Enhance Tender Entity and TED Parser with Status Management and Upsert Logic
- Added new fields to the Tender entity for handling cancellation, award, and suspension details, improving the entity's capability to manage tender statuses.
- Implemented a DetectNoticeStatus method in the TEDParser to identify the status of TED notices from XML data, enhancing the parser's functionality.
- Updated the ParseXML method to include notice status detection, ensuring accurate status representation in parsed documents.
- Introduced upsert logic in the TED scraper to handle tender records more effectively, allowing for updates or creation based on existing ContractIDs.
- Enhanced logging and error handling throughout the scraping process to improve traceability and robustness.
- Added a comprehensive usage example document to illustrate the new features and usage patterns for the TED XML parser and scraper.
2025-09-28 10:27:20 +03:30
n.nakhostin b40615ec99 Update TenderResponse Structure to Handle BuyerOrganization Safely
- Modified the ToResponse method in the Tender entity to create an OrganizationResponse instance for BuyerOrganization, ensuring safe access to its Name field.
- This change improves the robustness of the response structure by preventing potential nil dereference errors when BuyerOrganization is not set.
2025-09-27 13:24:33 +03:30
n.nakhostin ac7eb0385d Enhance Notification and User Services with Improved Error Handling and Data Consistency
- Updated GetByID methods in user and customer services to return specific "not found" errors for better clarity in error responses.
- Modified NotificationResponse structure to include a new Recipient field, allowing for more flexible recipient handling.
- Changed CreatedAt and UpdatedAt fields in NotificationResponse to use Unix timestamps (int64) for consistency across the application.
- Improved notification retrieval logic to handle potential nil values for user and customer lookups, ensuring robust data handling.
2025-09-27 11:40:17 +03:30
n.nakhostin 7110e55cf5 Update API Documentation and Swagger Configuration for Opplens
- Changed API title and version in Swagger documentation from "Tender Management API" to "Opplens API" with version 1.0.0.
- Updated contact information and terms of service URLs to reflect the new branding for Opplens.
- Added a new "Notification" tag in the Swagger documentation for public notification management operations.
- Adjusted the Swagger endpoint path for documentation to improve routing consistency.
- Enhanced response structure in notification handlers to include metadata, improving clarity in API responses.
2025-09-27 10:57:30 +03:30
n.nakhostin 939f940499 Enhance Customer Module with Validation and Username Handling
- Introduced a new ValidationService for customer operations to ensure valid username formats.
- Updated customer service and handler to utilize the new validation service, enhancing input validation during registration and updates.
- Modified CreateCustomerForm and UpdateCustomerForm to enforce username validation rules.
- Adjusted repository indexing to improve search efficiency by refining the text index for customer data.
- Ensured consistent handling of usernames across the customer module, improving overall data integrity and user experience.
2025-09-24 12:57:23 +03:30
n.nakhostin 080c1d18e5 Normalize Username Handling in Customer and User Services
- Updated the Register, Update, and Login methods in both customer and user services to ensure usernames are consistently stored and processed in lowercase.
- Modified notification messages to reflect the lowercase username format, enhancing clarity and consistency in user communications.
- Improved username existence checks during registration and updates to prevent case-sensitive duplicates, ensuring a more robust user experience.
2025-09-24 12:29:49 +03:30
n.nakhostin a342da193e Refactor Feedback Module for Consistency and Clarity
- Updated feedback repository and service methods to use a consistent naming convention, changing `NewTenderRepository` and similar methods to `NewRepository`.
- Refactored feedback handler methods to improve clarity by renaming methods such as `ListFeedback` to `Search` and `GetFeedback` to `Get`.
- Enhanced feedback response structures to include detailed company and tender information, improving the clarity of feedback data returned to API consumers.
- Updated Swagger documentation to reflect changes in feedback response structures and endpoint paths, ensuring accurate representation of the API for consumers.
2025-09-24 12:20:19 +03:30
n.nakhostin cdf15c9d49 Update Notification API Endpoint Paths for Consistency
- Modified the route for marking notifications as seen to ensure a consistent and clear API structure.
- Updated the notification client to reflect the new endpoint path for marking all notifications as seen, enhancing clarity for API consumers.
- These changes improve the overall usability and maintainability of the notification API.
2025-09-23 13:35:00 +03:30
n.nakhostin 648865f6a6 Update Notification API Endpoints and Documentation
- Changed the endpoint for marking notifications as seen to improve clarity and consistency in the API structure.
- Updated the endpoint for marking all notifications as seen to a more descriptive path.
- Reflected these changes in the Swagger documentation, ensuring accurate representation of the updated API endpoints for consumers.
2025-09-23 10:33:46 +03:30
n.nakhostin e1ae090ff9 Refactor Notification Routes for Improved Endpoint Structure
- Updated the notification routes to enhance clarity and usability by changing the endpoint for marking notifications as seen.
- Introduced a new route for marking all notifications as seen, improving the API's functionality and user experience.
- Updated Swagger documentation to reflect the changes in endpoint paths, ensuring accurate API documentation for consumers.
2025-09-23 10:33:17 +03:30
n.nakhostin c2531a005e Implement ObjectID Conversion in GetByIDs Method of Company Repository
- Enhanced the GetByIDs method to convert string IDs to BSON ObjectIDs before querying the database, ensuring proper data type handling.
- This change improves the robustness of the method by preventing potential errors related to ID format mismatches during database operations.
2025-09-22 14:04:15 +03:30
n.nakhostin 5bd8c2b53d Enhance CORS Configuration in HTTP Server Initialization
- Updated the CORS middleware configuration in the HTTP server initialization to include additional allowed headers: Origin, Content-Type, Accept, and Authorization.
- This enhancement improves the flexibility and security of cross-origin requests, ensuring that necessary headers are accepted for proper API functionality.
2025-09-22 13:08:01 +03:30
n.nakhostin fe70c7170b Add Notification Filters and AllMarkSeen Endpoint to API Documentation
- Introduced new query parameters for filtering notifications by 'seen' status and 'priority' in the API documentation, enhancing the flexibility of notification retrieval.
- Added a new endpoint to mark all notifications as seen for a user, including detailed Swagger documentation for the new functionality.
- Updated existing API documentation to reflect the changes, ensuring clarity for API consumers and improving overall documentation quality.
2025-09-22 13:05:10 +03:30
n.nakhostin ef9ad22841 Refactor Customer Repository Login Method to Simplify Device Token Handling
- Removed the use of the slices package for checking existing device tokens during customer login.
- Updated the Login method to directly assign the device token to the customer, ensuring a more straightforward approach to managing device tokens.
- Enhanced code readability by eliminating unnecessary checks, streamlining the login process for customers.
2025-09-22 11:57:19 +03:30
n.nakhostin ddf4d9abc4 Enhance Customer Service with Notification Response Structures
- Introduced CustomerNotificationResponse struct to provide a detailed response format for customer notifications, improving the clarity of notification data.
- Updated the Customer service interface to include methods for searching and retrieving customers with notification-specific responses, enhancing the flexibility of customer data retrieval.
- Modified the Login method to accept a device token, allowing for better tracking of customer devices during login.
- Refactored existing methods to utilize the new notification response structure, ensuring consistency across customer-related API responses.
- Enhanced error handling and logging in the service layer for improved traceability during customer searches and logins.
2025-09-22 11:47:31 +03:30
n.nakhostin 733d726df6 Add AllMarkSeen Functionality to Notification System
- Introduced the AllMarkSeen method in the notification service to mark all notifications as seen for a user, enhancing user experience by allowing bulk actions on notifications.
- Implemented the PublicAllMarkSeen handler to handle HTTP requests for marking all notifications as seen, ensuring proper request validation and response handling.
- Updated the notification client and SDK to support the new AllMarkSeen functionality, improving the overall API capabilities.
- Enhanced API documentation with Swagger comments for the new endpoint, ensuring clarity for API consumers.
2025-09-22 10:07:02 +03:30
n.nakhostin aef91b4711 Add Notification Filters for Seen and Priority
- Introduced new optional fields in the SearchForm for filtering notifications by 'seen' status and 'priority', enhancing the flexibility of notification retrieval.
- Updated the GetNotifications method in the notification service to accommodate the new filters, ensuring they are included in the query parameters.
- Enhanced the notification client to support the new filters in API requests, improving the overall functionality of the notification system.
- Updated API documentation with Swagger comments to reflect the new query parameters, ensuring clarity for API consumers.
2025-09-22 09:57:14 +03:30
n.nakhostin 928fab6b4a Merge branch 'main' of repo.ravanertebat.com:TM/tm_back 2025-09-21 15:17:31 +03:30
n.nakhostin 6f6cd1e2a1 Update CONTRIBUTORS.md to Reflect Developer Roles
- Removed duplicate entry for **sina_nokhostin** in the Web panel and landing frontend development sections.
- Consolidated contributions under **a.jamali** for both Web panel and landing frontend development, ensuring clarity in the contributors list.
2025-09-21 15:16:56 +03:30
n.nakhostin 4d7344421b Refactor Notification Sending Logic to Include Channel Checks
- Updated the Send method in the notification service to check for specified delivery channels (Push and Email) before sending notifications, enhancing the flexibility of the notification system.
- Utilized the slices package to streamline the channel checking process, improving code readability and maintainability.
- Ensured that notifications are only sent to recipients based on the selected channels, promoting more efficient notification delivery.
2025-09-21 15:05:01 +03:30
n.nakhostin 29bca402a4 Refactor Notification Sending Logic in Customer and User Services
- Updated the notification sending logic in the customer and user service layers to send emails synchronously instead of using goroutines, improving clarity and ensuring immediate feedback on notification processing.
- Ensured that all relevant service methods (Register, UpdateStatus, RequestResetPassword, ResetPassword) are updated to reflect these changes, promoting consistency in notification handling across services.
2025-09-21 14:59:40 +03:30
n.nakhostin 67b2058506 Refactor Notification Handler to Use Customer Context for User ID Retrieval
- Updated the CustomerNotifications and PublicMarkSeen methods in NotificationHandler to retrieve the customer ID from context instead of the user ID, aligning with the new customer-centric approach.
- This change enhances the integration between notifications and customer management, ensuring that notifications are correctly associated with customers.
- Maintained existing error handling for missing customer ID, ensuring robustness in the notification retrieval process.
2025-09-21 14:44:59 +03:30
n.nakhostin c22d98d4bb Integrate Notification SDK into Inquiry Service
- Updated the InquiryService to include a notification SDK for sending notifications upon inquiry creation, enhancing user engagement.
- Modified the NewInquiryService constructor to accept the notification SDK as a dependency, adhering to dependency injection principles.
- Refactored the Create method to send notifications with inquiry details, improving communication and response to inquiries.
- Cleaned up commented-out code related to duplicate inquiry checks for better readability and maintainability.
2025-09-21 12:23:26 +03:30
n.nakhostin 5906904caf Enhance Notification System with New API Endpoints and Response Structures
- Added new endpoints for marking notifications as seen and retrieving detailed notification information for both admin and user contexts, improving the flexibility of the notification system.
- Implemented the MarkSeen and ViewNotification methods in the NotificationHandler, ensuring proper handling of notification visibility and details retrieval.
- Updated the NotificationService interface to include methods for getting notification details and marking notifications as seen, enhancing service capabilities.
- Enhanced the notification response structures to include additional fields such as Image, Seen, and ScheduledAt, providing richer data in API responses.
- Updated API documentation with Swagger comments for the new endpoints and response formats, ensuring clarity for API consumers.
2025-09-21 11:26:54 +03:30
n.nakhostin 0f981880b5 Add MarkSeen Functionality to Notification System
- Implemented the MarkSeen method in the notification client to mark notifications as seen, enhancing user interaction with notifications.
- Added MarkSeenRequest and MarkSeenResponse structs to facilitate the request and response handling for marking notifications.
- Updated the NotificationService interface to include the new MarkSeen method, ensuring consistency across the service layer.
- Enhanced the SDK with a QuickMarkSeen convenience method for easier usage in client applications.
- Included logging for successful and failed attempts to mark notifications as seen, improving traceability and debugging capabilities.
2025-09-21 10:20:58 +03:30
n.nakhostin fc687b116a Enhance Customer Service with Company Loading Logic
- Added functionality to load associated companies for customers during registration and updates, improving the completeness of customer responses.
- Implemented error logging for failures in loading companies, ensuring better traceability of issues.
- Updated the response structure to include company information in customer responses, enhancing the API's usability and data richness.
- Removed the unused GetProfile method to streamline the service layer and improve code maintainability.
2025-09-21 10:09:06 +03:30
n.nakhostin d76d764387 Remove Password Field from UpdateCustomerForm for Enhanced Security
- Eliminated the Password field from the UpdateCustomerForm to improve security practices and reduce the risk of exposing sensitive information.
- Ensured that the form continues to validate other necessary fields, maintaining the integrity of customer updates.
2025-09-21 10:00:16 +03:30
n.nakhostin 19cd346b1c Enhance Notification Management with New Endpoints and Response Structures
- Added new endpoints for retrieving notifications for both admins and users, improving the flexibility of the notification system.
- Implemented query parameters for filtering notifications by status, method, event type, type, and recipient, enhancing usability.
- Introduced new response structures for notifications, including pagination information, to provide better data handling in API responses.
- Updated API documentation with Swagger comments for the new endpoints and response formats, ensuring clarity for API consumers.
- Refactored notification handling logic to support the new features, promoting a more robust notification management system.
2025-09-20 17:41:21 +03:30
n.nakhostin ab6eb3b3ed Refactor Notification Sending Logic to Use Goroutines
- Updated the Send method in NotificationHandler to send notifications asynchronously using goroutines, improving responsiveness and performance.
- Removed synchronous error handling for notification sending, allowing the API to return a success response immediately while processing the notification in the background.
2025-09-20 16:56:23 +03:30
n.nakhostin 9037cb5917 Refactor Notification Management and Enhance Customer Features
- Updated the notification handling logic to utilize a new SDK for sending notifications, improving the flexibility and scalability of the notification system.
- Introduced new methods in the notification service for sending notifications to users and customers based on various target audience types, enhancing the notification delivery capabilities.
- Added a new endpoint to assign companies to a customer, improving customer management functionalities.
- Refactored the customer entity and forms to replace 'CompanyIDs' with 'Companies', ensuring consistency across the data model.
- Enhanced API documentation with Swagger comments for the new endpoint and updated notification structures, ensuring clarity for API consumers.
2025-09-20 16:54:51 +03:30
n.nakhostin d2f7c6a1e5 Refactor Notification Email Structure in Customer and User Services
- Updated the email notification logic in the customer and user service layers to utilize the new notification Model struct, enhancing the clarity and consistency of notification requests.
- Modified the email content to include structured fields such as Title, Message, Type, Priority, and UserID, improving the overall notification management.
- Ensured that all relevant service methods (Register, UpdateStatus, RequestResetPassword, ResetPassword) are updated to reflect these changes, promoting a unified approach to notification handling.
2025-09-20 15:35:53 +03:30
n.nakhostin 0857314906 Enhance Notification Request Structure and Service Interface
- Updated the NotificationRequest struct to include new fields: Title, Type, Priority, and ScheduledAt, improving the flexibility and usability of notification requests.
- Implemented validation for the new ScheduledAt field to ensure it is a future timestamp or zero for immediate delivery.
- Refactored the NotificationService interface and SDK methods to accept a new Model struct, streamlining the parameters for sending notifications.
- Enhanced the builder pattern for constructing notification requests, adding methods for setting Title, Type, Priority, and ScheduledAt, promoting a fluent API design.
- Updated service methods for sending notifications (Email, SMS, Push, OTP) to utilize the new Model struct, ensuring consistency across notification types.
2025-09-20 15:29:00 +03:30
n.nakhostin c6801ef2f3 Add Assign Companies Feature for Customers
- Introduced a new endpoint to assign companies to a customer, enhancing the customer management capabilities.
- Implemented the AssignCompanies handler in the customer service layer, including validation and structured responses.
- Updated the routes to include the new PATCH /admin/v1/customers/{id}/companies endpoint, improving administrative functionalities.
- Enhanced API documentation with Swagger comments for the new endpoint, ensuring clarity for API consumers.
2025-09-20 10:35:28 +03:30
n.nakhostin 6dcee0bc4b Refactor Customer Entity and Forms to Use 'Companies' Field
- Updated the Customer entity to replace 'CompanyIDs' with 'Companies' for improved clarity and consistency.
- Modified CreateCustomerForm and UpdateCustomerForm to reflect the change from 'CompanyIDs' to 'Companies', ensuring proper validation and structured responses.
- Adjusted service methods to handle the new 'Companies' field, including registration and company assignment logic, enhancing the overall data model and API usability.
2025-09-20 10:32:21 +03:30
n.nakhostin dfcdef60d6 Add Device Token Support for Customer and User Entities
- Introduced a new DeviceToken field in both Customer and User entities to store device tokens for authentication and notifications.
- Updated LoginForm structures for both Customer and User to include an optional DeviceToken field, allowing clients to send device tokens during login.
- Enhanced the Login methods in the customer and user services to append the device token to the respective entities if it does not already exist, improving user session management and notification capabilities.
- Ensured proper validation and structured responses for the new DeviceToken field in the forms, maintaining compliance with best practices for API design.
2025-09-20 10:11:36 +03:30
n.nakhostin 00ad7e136d Enhance API Documentation for Notification Target Audience
- Added "target" field reference to the notification request and response structures in Swagger documentation, improving clarity for API consumers.
- Introduced "notification.TargetAudienceType" definition with enumerated values for target audience options, enhancing the API's usability and understanding.
- Updated related documentation files (YAML and JSON) to reflect these changes, ensuring consistency across all API documentation formats.
2025-09-17 16:05:33 +03:30
n.nakhostin a06dc5097e Integrate Notification Management into Tender Management System
- Added a new notification domain, including entities, services, handlers, and repositories to manage notifications effectively.
- Implemented CRUD operations for notifications, allowing for creation, retrieval, updating, and deletion of notifications via the API.
- Enhanced API documentation with Swagger comments for new notification endpoints, ensuring clarity for API consumers.
- Updated routes to include notification management, improving administrative capabilities within the web panel.
- Introduced validation for notification requests and responses, ensuring data integrity and proper error handling.
- Updated the go.mod file to include the latest version of the go-redis library, ensuring compatibility with the notification service.
2025-09-17 16:01:49 +03:30
n.nakhostin 6906577f6e Add Documentation for Contributors and Jira Task Creation
- Introduced a new CONTRIBUTORS.md file to outline the team structure and roles involved in the project, enhancing transparency and collaboration.
- Created a JIRA_TASK_RULES.md file detailing mandatory rules and standards for creating Jira tasks, ensuring consistency and clarity in task management.
- Included guidelines on task labels, sprint assignments, relationships, and structure to streamline the task creation process.
- Added critical reminders to emphasize the importance of proper task management practices within the team.
2025-09-17 10:31:38 +03:30
n.nakhostin b429bcd24f Add Role Assignment Feature for Customers
- Introduced a new role assignment feature for customers, allowing roles to be assigned as either 'admin' or 'analyst'.
- Updated the Customer entity to include a Role field, enhancing the data model to support role management.
- Created new request and response forms for role assignment, ensuring proper validation and structured responses.
- Implemented the AssignRole method in the customer service layer, handling role assignment logic and error management.
- Added a new AssignRole handler to process role assignment requests via the API, complete with Swagger documentation for clarity.
- Updated routes to include the new role assignment endpoint, improving the administrative capabilities of the system.
- Enhanced logging for role assignment operations to ensure traceability and debugging ease.
2025-09-17 10:15:14 +03:30
n.nakhostin 3af09693f8 Remove Password Field from Customer Response Structure
- Eliminated the password field from the CustomerResponse struct to enhance security and prevent sensitive information exposure in API responses.
- Updated the ToResponse method to reflect this change, ensuring compliance with best practices for handling user data.
2025-09-17 09:29:03 +03:30
n.nakhostin 108629278a Integrate Notification Service into Tender Management System
- Added a new notification service to handle various notification types (email, SMS, push, OTP).
- Implemented configuration for the notification service, allowing customization via environment variables.
- Updated user and customer services to utilize the notification service for sending welcome emails and status updates.
- Introduced a builder pattern for constructing notification requests, enhancing usability and flexibility.
- Enhanced error handling and logging for notification operations, ensuring robust service integration.
- Updated documentation to include usage examples and configuration details for the new notification SDK.
2025-09-16 15:35:36 +03:30
n.nakhostin 05a307e345 Enhance Configuration System with Environment Variable Priority Handling
- Updated the configuration loading mechanism to prioritize OS environment variables over .env file values, improving flexibility and security.
- Added a new function, GetEnvWithPriority, to explicitly check the source of configuration values.
- Revised documentation to reflect the new priority system, including detailed examples and usage instructions for mixed configuration approaches.
- Enhanced error handling for .env file loading, ensuring graceful handling of missing files without disrupting the application flow.
2025-09-15 14:52:12 +03:30
n.nakhostin c701053609 Add Password Reset Functionality and Update API Documentation
- Implemented password reset functionality, including endpoints for requesting a reset code, verifying the OTP, and resetting the password.
- Introduced new request and response forms for password reset operations, ensuring proper validation and structured responses.
- Enhanced the customer service layer to handle password reset requests, OTP verification, and password updates, utilizing Redis for temporary token storage.
- Updated Swagger and YAML documentation to include new API endpoints and their specifications, improving clarity for API consumers.
- Refactored the customer handler to manage new password reset routes, ensuring adherence to clean architecture principles.
2025-09-14 13:25:36 +03:30
n.nakhostin 5d721705b7 Update MongoDB Driver and Configuration for Company Entities
- Updated the MongoDB driver from v1.17.4 to v2.3.0, ensuring compatibility with the latest features and improvements.
- Refactored company-related entity and repository files to utilize the new driver, replacing `primitive.ObjectID` with `bson.ObjectID` for ID handling.
- Adjusted the configuration in `.drone.yml` to include the `main` branch in the trigger settings, enhancing CI/CD pipeline flexibility.
2025-09-09 18:53:39 +03:30
n.nakhostin 57c29dc58f Refactor Configuration System to Use Environment Variables
- Removed YAML configuration files for the scraper and web commands, transitioning to an environment-based configuration system.
- Updated configuration structs to utilize `env` tags for loading values from `.env` files, enhancing security and flexibility.
- Implemented reflection-based parsing for environment variables, ensuring type-safe configuration loading.
- Revised documentation to reflect the new configuration approach, including usage examples and best practices for environment variable naming conventions.
2025-09-09 18:19:42 +03:30
n.nakhostin 44d0f57082 Update Dockerfile to Correct Asset Copy Path
- Modified the Dockerfile to change the COPY command for web assets, ensuring the correct path is used to include assets from the cmd/web directory. This adjustment improves the organization and accessibility of web-related assets within the application.
2025-09-09 16:03:13 +03:30
n.nakhostin 6458211f12 Update Dockerfile to Copy Web Assets
- Modified the Dockerfile to change the COPY command for assets, now including the entire web assets directory instead of just the flags. This adjustment improves the organization and accessibility of web-related assets within the application.
2025-09-09 14:56:50 +03:30
n.nakhostin b445bb297f Remove Authentication Middleware from Admin Flags Routes
- Eliminated the authentication middleware from the admin flags routes, simplifying access to flag-related endpoints for administrative purposes. This change enhances the usability of the admin interface while maintaining the integrity of other secured routes.
2025-09-09 14:53:07 +03:30
n.nakhostin a8a08b33f6 Update Dockerfile to Include Flags Assets
- Added a new COPY command in the Dockerfile to include SVG flag assets from the go-builder stage, enhancing the application's asset management and visual representation of country flags.
2025-09-09 14:49:06 +03:30