Commit graph

33 commits

Author SHA1 Message Date
Max
8fdd1a3a6c feat(robot): add workspace support to robot management
- Introduced a new `workspace` field across various robot-related structures, including `CreateRobotRequest`, `UpdateRobotRequest`, and `RobotResponse`, allowing for better organization and management of robots within specific workspaces.
- Updated database queries and response mappings to accommodate the new workspace field, ensuring seamless integration with existing functionalities.
- Enhanced agent execution context to include workspace information, improving the contextual awareness of agents during operations.
- Added tests to validate the creation and updating of robots with workspace data, ensuring robust functionality and backward compatibility.
2026-03-28 16:59:52 +08:00
Max
bf8d82f022 Add Yao authentication source and OAuth email handling
- Introduce `YaoAuthSource` and `OAuthEmail` fields in various structures to capture authentication source and OAuth email during user login and registration processes.
- Update `SignIDToken`, `GetInfo`, and `Map` functions to include new claims for Yao authentication source.
- Modify login context to preserve authentication source and OAuth email across different user flows.
- Enhance token issuance to include authentication source and OAuth email in claims for better tracking and user context.
- Ensure proper handling of OAuth email for third-party logins without affecting user profile email.

This change improves the user experience by providing clearer context on authentication methods used during login and registration processes.
2026-02-07 19:44:10 +08:00
Max
d7dc5dfd3f Fix error handling in invitation resend test
- Updated the `TestInvitationResend` function to properly handle errors when sending the invitation request, ensuring that any failures are reported during the test execution.
- This change improves the reliability of the test by providing clearer feedback on issues encountered during the invitation process.
2025-10-29 09:52:57 +08:00
Max
481a6edbd5 Enhance team invitation functionality with locale support
- Updated the invitation resend process to accept a locale parameter, allowing for locale-specific email formatting and invitation link generation.
- Modified the `teamInvitationResend` function to include locale handling, ensuring proper configuration based on the user's locale.
- Enhanced the `toString` utility function to support time formatting based on locale, improving date presentation in emails.
- Added new utility functions for locale-specific time formatting, ensuring consistent user experience across different regions.
- Expanded tests to validate the new locale handling in invitation processes, ensuring comprehensive coverage for various scenarios.
2025-10-29 09:28:55 +08:00
Max
7549a890e5 Refactor team configuration tests to remove uploader and avatar agent assertions
- Removed assertions for the uploader and avatar agent fields in the team configuration tests, as these fields are no longer preserved in the public configuration.
- Updated the GetTeamConfigPublic function to reflect the changes in the TeamConfig structure, ensuring only relevant fields are included in the public configuration.
- Adjusted test cases to maintain coverage while aligning with the updated configuration structure.
2025-10-28 17:22:44 +08:00
Max
bf452ba1d3 Add member profile retrieval functionality
- Introduced a new endpoint `GET /teams/:team_id/members/:member_id/profile` to allow users to retrieve member profile information, including display name, bio, avatar, and email.
- Implemented the `GinMemberGetProfile` handler to process profile retrieval requests with appropriate authentication and error handling.
- Added business logic in `memberGetProfile` to ensure only authenticated users can access their own profile data.
- Expanded test cases in `TestMemberProfileGet` to validate various scenarios for profile retrieval, ensuring comprehensive coverage for authentication and data validation.
2025-10-28 16:18:52 +08:00
Max
af02a21f65 Implement member profile update functionality
- Added a new endpoint `PUT /teams/:team_id/members/:member_id/profile` to allow members to update their profile information, including display name, bio, avatar, and email.
- Introduced `UpdateMemberProfileRequest` structure to handle profile update requests.
- Enhanced the `GinMemberUpdateProfile` handler to process profile updates with appropriate validation and error handling.
- Implemented business logic in `memberUpdateProfile` to ensure only the member can update their own profile.
- Expanded test cases to validate the new profile update functionality, ensuring comprehensive coverage for various update scenarios.
2025-10-28 11:49:01 +08:00
Max
8ffa767dfe Add logo support to team creation and update functionality
- Enhanced the team creation and update processes to include an optional logo field, allowing teams to have custom logos.
- Updated the CreateTeamRequest and UpdateTeamRequest structures to accommodate the new logo field.
- Modified the GinTeamCreate and GinTeamUpdate handlers to handle logo data appropriately.
- Expanded test cases for team creation and updates to validate logo handling, ensuring comprehensive coverage for scenarios involving logos.
2025-10-27 17:46:25 +08:00
Max
7572f99ba0 Enhance robot member functionality with avatar support
- Added avatar field to CreateRobotMemberRequest and UpdateRobotMemberRequest structures, allowing for avatar URL or file ID during member creation and updates.
- Updated GinMemberCreateRobot and GinMemberUpdateRobot handlers to process avatar information, ensuring it is included in the member data.
- Expanded test cases for member creation and updates to validate avatar handling, including scenarios for updating only the avatar without affecting other fields.
- Enhanced team configuration tests to verify preservation of uploader and avatar agent fields, improving overall test coverage and reliability.
2025-10-27 16:45:10 +08:00
Max
26b690246d Refactor test case for member update to remove unnecessary whitespace
- Cleaned up the `TestMemberUpdateRobot` function by removing redundant blank lines, improving code readability and maintainability.
2025-10-27 13:43:27 +08:00
Max
1e01ed768e Implement robot member update functionality with comprehensive validation
- Added the `UpdateRobotMember` method to handle updates for robot members, including validation for member existence, type checks, and email uniqueness.
- Introduced a new `UpdateRobotMemberRequest` structure to facilitate updates via the API, allowing for modifications to various fields such as `robot_email`, `status`, and `autonomous_mode`.
- Enhanced the `GinMemberUpdateRobot` handler to process update requests, ensuring proper authentication and error handling for various scenarios.
- Expanded test coverage with new test cases for the robot member update functionality, validating successful updates, error conditions, and edge cases.
- Refactored existing member management logic to integrate the new update capabilities, improving overall system robustness and user experience.
2025-10-27 12:05:11 +08:00
Max
7de562f80d Update robot member functionality with new fields and validation
- Introduced the `robot_email`, `authorized_senders`, and `email_filter_rules` fields to the robot member model, enhancing the configuration options for robot members.
- Updated the member creation and existence check logic to ensure the uniqueness of `robot_email` globally, improving data integrity.
- Refactored API endpoints and request/response structures to accommodate the new fields, ensuring consistency across the member management system.
- Enhanced test cases to validate the new robot member features, including scenarios for email uniqueness and configuration updates, improving overall test coverage and reliability.
2025-10-27 11:34:07 +08:00
Max
772c00e095 Enhance member listing functionality with advanced filtering and sorting
- Introduced a new MemberListRequest structure to support advanced filtering options such as status, member_type, role_id, email, and display_name.
- Updated the GinMemberList handler to parse and validate query parameters, improving user experience with clearer error messages for invalid inputs.
- Enhanced the memberList function to handle advanced filtering and sorting, allowing for more flexible and efficient member retrieval.
- Added comprehensive test cases to validate new filtering and sorting functionalities, ensuring robust coverage and reliability in member listing scenarios.
- Refactored existing member response structures to include new fields and improve data representation.
2025-10-26 14:10:04 +08:00
Max
420a17f844 Enhance member model and team management with is_owner field
- Added the is_owner field to the member model to indicate if a member is the team owner, improving clarity and performance for queries related to team ownership.
- Updated the team creation process to automatically set the is_owner field for the creator of the team, ensuring accurate member status upon creation.
- Refactored related tests to verify the correct assignment of the is_owner field, enhancing test coverage and reliability in team membership scenarios.
- Removed redundant permission and restriction fields from the member model to streamline the data structure and improve maintainability.
2025-10-26 12:25:15 +08:00
Max
f71ce2ac9a Implement existence checks for various entities in update functions
- Added functions to check the existence of invitation codes, members, OAuth accounts, roles, teams, and user types before performing updates, enhancing error handling and user feedback.
- Updated relevant update functions to utilize these existence checks, ensuring accurate error messages when no changes are made or when entities do not exist.
- Refactored tests to validate the new existence check logic, improving overall test coverage and reliability.
2025-10-26 11:09:07 +08:00
Max
5f6f8d7911 Enhance member management with member_id and email checks
- Introduced member_id as a unique identifier for members, improving data integrity and consistency across member operations.
- Updated member-related functions to utilize member_id instead of internal IDs, enhancing API usability and clarity.
- Implemented email existence checks for team members, allowing for better validation during member creation and updates.
- Refactored existing tests to accommodate changes in member identification and email validation, ensuring comprehensive coverage and reliability.
- Added new API endpoint for checking if an email exists within a team, improving user experience during member management.
2025-10-26 09:49:45 +08:00
Max
fd10a058b1 Implement robot member creation and validation
- Introduced a new endpoint for creating robot members, enhancing the member model to include fields specific to robots such as email, system prompt, and autonomous mode.
- Refactored existing member creation logic to accommodate robot-specific requirements and ensure email uniqueness within teams.
- Updated request and response structures to support the new robot member functionality, improving API consistency.
- Added comprehensive test cases to validate the new robot member creation process, including scenarios for required fields, duplicate emails, and invalid inputs.
2025-10-26 09:04:22 +08:00
Max
0abb8c7d3b Update user status in test cases from "enabled" to "active"
- Modified the user creation functions in entry_test.go and invitation_test.go to use "active" as the status value instead of "enabled", aligning with the valid enum values for user status.
- This change ensures consistency across user-related tests and improves clarity regarding user status representation.
2025-10-25 14:59:57 +08:00
Max
ddf8fd7a32 Refactor test utilities and enhance access token handling
- Introduced ObtainAccessTokenWithRootPermission function to streamline the creation of test users with root permissions, ensuring consistent access token generation for tests.
- Updated various test cases to utilize the new function, improving clarity and reducing redundancy in access token acquisition.
- Enhanced team configuration retrieval to expose public settings while hiding sensitive information, improving security in API responses.
2025-10-25 13:26:51 +08:00
Max
481323104a Implement deep copy for entry configuration to prevent global config corruption
- Added a new function, createPublicEntryConfig, to create a deep copy of EntryConfig without sensitive data, ensuring that global configuration remains intact when returning public config.
- Updated entry verification logic to utilize EntryVerificationStatus for clearer status handling during user verification.
- Enhanced tests to verify that the global config is not modified after multiple requests for public entry configuration, addressing a critical bug related to captcha secret exposure.
2025-10-15 19:32:40 +08:00
Max
c4ecda54e9 Refactor captcha handling in tests and core functionality
- Updated captcha test cases to utilize the new CaptchaGet function for retrieving captcha answers, improving test reliability.
- Refactored CaptchaMake and CaptchaValidate functions to leverage a new utils package for better encapsulation and maintainability.
- Enhanced error handling and logging in captcha-related processes, contributing to a more robust user experience during authentication.
- Streamlined the captcha generation process by integrating with the utils.captcha package, ensuring consistency across the codebase.
2025-10-15 15:43:16 +08:00
Max
d1a9e5c892 Refactor user authentication to unify entry configuration handling
- Renamed and updated functions and tests to replace 'login' terminology with 'entry', reflecting the unified handling of login and registration processes.
- Removed deprecated login configuration functions and structures, streamlining the codebase.
- Enhanced test coverage for entry configuration retrieval and validation, ensuring comprehensive testing of the new unified approach.
- Improved error handling and logging for entry configuration scenarios, contributing to a better user experience during authentication.
2025-10-15 11:16:54 +08:00
Max
721f47c345 Enhance invitation acceptance flow with invitation ID support
- Updated the AcceptInvitation method to require both invitation ID and token, improving the invitation acceptance process.
- Modified related tests to accommodate the new invitation ID parameter, ensuring comprehensive coverage of acceptance scenarios.
- Enhanced the invitation acceptance endpoint to validate invitation ID, providing clearer error handling for invalid or expired invitations.
- Refactored tests to include detailed scenarios for accepting invitations, including success and failure cases, ensuring robust testing of the invitation flow.
2025-10-14 11:58:20 +08:00
Max
cf42d255d3 Enhance invitation handling and team configuration tests
- Updated the invitation creation response to return complete invitation details, including the invitation token.
- Improved error handling when retrieving created invitations, ensuring fallback to ID return on failure.
- Modified team configuration tests to require authentication, reflecting recent API changes.
- Added access token retrieval for authenticated requests in team configuration tests, enhancing security and compliance.
2025-10-08 17:56:56 +08:00
Max
ca2344edb8 Refactor invitation handling and improve test coverage
- Updated invitation creation logic to support email invitations and customizable expiry durations.
- Enhanced tests for invitation creation, including scenarios for registered and unregistered users, and handling of missing email requirements.
- Refactored API endpoints to use consistent parameter naming for team IDs.
- Improved error handling and logging for invitation-related operations, ensuring clarity in failure cases.
- Added support for sending invitation emails through the messenger service, with appropriate templates and settings.
2025-10-08 16:16:49 +08:00
Max
d113adaa8a Refactor test files to improve readability and consistency
- Cleaned up whitespace in user configuration validation and environment variable extraction tests.
- Enhanced logging statements for better clarity during test execution.
- Standardized formatting across test cases to improve maintainability.
2025-10-07 10:32:35 +08:00
Max
9044d4c30a Enhance user login and team configuration management
- Updated login configuration tests to clarify endpoint descriptions.
- Introduced team configuration loading and retrieval functionality, including new endpoints for public access to team configurations.
- Refactored team management routes to standardize parameter usage and improve clarity.
- Added error handling for missing environment variables in client configuration.
- Implemented team configuration types and related structures for better organization and usability.
2025-10-07 10:23:43 +08:00
Max
b9a912b7d9 Enhance member invitation management and related functionality
- Introduced invitation_id handling for member management, allowing for unique identification of pending invitations.
- Added methods to create, update, and remove members by invitation_id, improving the invitation workflow.
- Updated member data structures and API responses to include invitation-related fields, enhancing clarity and usability.
- Implemented tests for invitation ID operations, ensuring robust validation and error handling.
- Refactored team access checks to streamline member management processes.
2025-09-23 17:47:43 +08:00
Max
35afc1d58c Add team ownership and membership checks in user management
- Introduced IsTeamOwner and IsTeamMember methods to verify user ownership and membership status within a team.
- Added CheckTeamAccess method to assess a user's access level, returning ownership and membership status.
- Enhanced user types with new MemberResponse and MemberDetailResponse structures for improved member management.
- Updated routing for team member management to utilize new handler functions for clarity and consistency.
2025-09-23 16:14:42 +08:00
Max
9aff88d2fc Add team member removal functionality and related tests
- Implemented RemoveAllTeamMembers method in DefaultUser to delete all members from a team during team deletion.
- Added TestTeamDeleteMemberCleanup to verify that all members are removed when a team is deleted.
- Refactored team creation and deletion logic to ensure proper member management and error handling during these operations.
2025-09-23 11:24:57 +08:00
Max
5a894c11ab Add authorized info handling and session ID retrieval in OAuth guard
- Introduced methods to set and retrieve authorized information from the context, enhancing the OAuth guard functionality.
- Added a new `AuthorizedInfo` type to encapsulate user-related data such as subject, client ID, user ID, and scope.
- Implemented session ID retrieval from various sources (cookies, headers, query strings) to improve session management.
- Updated test utilities to support the creation of test users and access tokens, ensuring comprehensive testing of OAuth functionalities.
2025-09-23 10:22:52 +08:00
Max
54d7120626 Fix formatting in OAuth authorization test for improved readability
- Removed unnecessary blank line in TestUserOAuthAuthorizationURLParameters to enhance code clarity and maintain consistency in test formatting.
2025-09-18 09:11:09 +08:00
Max
a6e1f6e382 Add user configuration loading and update authentication routes
- Integrated user configuration loading in the OpenAPI server initialization to enhance user management capabilities.
- Migrated authentication routes from /signin to /login, updating handler functions for clarity and consistency.
- Adjusted OAuth provider routes to reflect new paths, improving the overall routing structure for user authentication.
2025-09-18 09:02:54 +08:00