Improve authentication functionality, error handling, setup functions, add client and handler, new test file and test cases
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Improve error handling and SDK error testing. The code now includes signal handling, error wrapping, checking for contained errors, and testing HTTP error responses. Additionally, assertions have been added to ensure the expected behavior is met.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Expand filters to check for test changes
This is because sometimes SDK tests failed to pass on push to main
because for PR we were only testing directory changes.
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
* Fix failing SDK tests by adding authz
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
* Rename pipeline to workflow
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
* Rename push branch to main
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
---------
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
* Refactor codegen to include pubsub
The commit includes changes to files related to messaging using the PubSub pattern.
It introduces a new step for checking PubSub updates and generating mocks.
Additionally, a new file for autogenerated mock code has been added.
Function and test case modifications have been made, including the use of mock implementations and checking for expected errors.
The commit also defines a mock implementation of a publisher-subscriber system using websockets.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Add error check for authentication
modify error handling, and return 401 status code in updateClientSecret function
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Change output dir for generated mocks
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix(errors): Fix nil pointer error in NewSDKError
In the NewSDKError function, a check is added to handle the case where the input error is nil. Previously, if the error was nil, the function would panic. This fix ensures that the function returns nil instead of panicking when the input error is nil.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(sdk-mock): Add mock functions for SDK testing
This commit adds a set of mock functions for the software development kit (SDK) to facilitate testing. These functions simulate the behavior of the actual functions in the SDK and have defined input parameters and return values. The code also includes error handling logic and checks for different return types.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* test: use sdk mocked interface
* feat(workflow): check for generated files
The commit modifies the check-proto GitHub workflow to check-generated files. It checks for changes in specific paths and verifies the protobuf files and generated mocks. The code also includes checking if the SDK mock is up to date, installing a tool, generating mocks, and displaying an error message if the mocks are different. The tool we use is: https://github.com/vektra/mockery.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(mocks): Add copyright notice to mocks.go
Added a copyright notice to the mocks.go file in the pkg/sdk/go directory for clarity and attribution.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(build): Add target for generating mocks
Added a new target to the Makefile for generating mocks using the mockery tool. The target checks if the mockery tool is installed and then runs the "go generate" command to generate mocks for the codebase..
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Improve error messages in check-generated-files.yml
In this commit, I have made changes to the check-generated-files.yml file. Specifically, I have updated the error messages to provide more information about the issue. Instead of simply stating that the proto file and generated Go file are out of sync, the error message now includes a more detailed explanation and a suggestion for resolving the issue. Additionally, I have also added error messages for the generated mocks for the SDK. These error messages provide information about the sync issue and suggest running the necessary commands to resolve it. This commit aims to improve the clarity of error messages and help developers quickly identify and fix sync issues in the codebase.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat: API layer for search
Implement the API layer for search. This includes the following:
- API endpoints for search
- Logging
- Metrics
- Tracing
* fix(api): fix default order in common.go
The default order in the common.go file was set to "updated_by" instead of "updated_at". This commit fixes the default order to "updated_at" to ensure accurate sorting.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* test: Add test function for search clients
The test function creates a new service with mock dependencies and tests various scenarios, including authorized and invalid tokens. It also checks the response and error values. The test function sets up mock calls and asserts expected values.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* refactor(users): remove search endpoint
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(service): Add new "invitations" service
This commit adds a new service called "invitations" to the existing file. The service includes the necessary imports and initializes components for its functionality. It also includes configuration settings and a Docker Compose file. Additionally, instructions for deploying and using the service are provided, along with a function to create an HTTP handler.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* docs(api): invitation api
The commit adds documentation for an API that allows users to manage invitations. It includes information about the endpoints, parameters, data types, and components used in the API. The documentation also outlines the properties and specifications of the Invitation object. This commit provides a comprehensive overview of the API's functionality and structure.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix: accept invitation to take in domain
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* refactor(invitations): rename domain to domainID
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Authorize on id(domain+user) rather than user
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* refactor(clients): deprecate RetrieveNames
Remove RetrieveNames and modify RetrieveAllBasicInfo to replace it. Remove sensitive information when retrieving basic information
* change from if statement to switch
Co-authored-by: Dušan Borovčanin <borovcanindusan1@gmail.com>
---------
Co-authored-by: Dušan Borovčanin <borovcanindusan1@gmail.com>