Provides services to hwsc-app-gateway-svc for CRUD document, and indexing file metadata in MongoDB and ElasticSearch.
The proto file and compiled proto buffers are located in hwsc-api-blocks and hwsc-api-blocks lib.
- Gets the current status of the service.
- Creates a document in MongoDB.
- Returns the Document.
- Retrieves all the MongoDB documents for a specific user with the given UUID.
- Returns a collection of Documents.
- (completely) Updates a MongoDB document using DUID and UUID.
- Returns the updated Document.
- Deletes a MongoDB document using DUID.
- Returns the deleted Document.
- Adds a new FileMetadata in a MongoDB document using a given url, DUID.
- Returns the updated Document.
- Deletes a FileMetadata in a MongoDB document using a given FUID, DUID.
- Returns the updated Document.
- Retrieves all the unique fields values required for the front-end drop-down filter.
- Returns the QueryTransaction
- Queries the MongoDB server with the given query parameters.
- Returns a collection of Documents.
- GoLang version go 1.12
- GoLang Modules go mod
- Go Source Code Linter golint
- mongo-go-driver beta 1.0.0-rc1
- Docker
- [Optional] If a new proto file and compiled proto buffer exists in hwsc-api-blocks, update dependency
$ go get -u <package name>
- Refer to hwsc-dev-ops to run DB locally
- Grab prod/dev/test config file from Slack
- Run main
$ go run main.go
- Refer to hwsc-dev-ops to run DB locally
$ generate_container.sh
- Find your image
$ docker images
- Acquire
env.list
configuration $ docker run --env-file ./env.list -it -p 50051:50051 <imagename>
- Optional: run
$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container id>
to find the proper address, and updateenv.list
- Place DB migration source codes to be tested in
test_fixtures/mongodb/
$ cd service
- The unit test will programmatically run the test container and DB migration as required
- For command-line summary,
$ go test -cover -v -failfast -race
- For comprehensive summary,
$ bash unit_test.sh
- If applicable, copy and push the new DB migration source codes in hwsc-dev-ops under
test
for integration testing
- Refer to hwsc-dev-ops for running integration test
- Ensure the service is tested using the built container in DockerHub