Good morning, good afternoon or good night. This project is a manager of the Etec Aristotle Ferreira School Library collection
In this repository there will be three projects:
Currently is partially complete the GIB internal API made in GRPC. It is possible to perform the unit tests of the project.
You can run the API in two ways: using the machine environment or using docker. It is preferable to use docker if it has already installed or is unable to install the requirements for execution in the machine environment.
It may be that, due to bandwidth, take time to install images and packages.
To execute in a local environment, there are the following requirements:
It is necessary that before execution configure the file ./src/LivrEtec.GIB.Servidor/appsettings.json
I recommend copying the AppSettings.modelo.json file, filling the authkey property with a string that serves as the authentication key and the connection string according to your mysql server. Use as an example the AppSettings file used in Docker.
After configuring the project, you open the project in Visual Studio and choose the Livretec.gib.servator as an initiation project, or run on a terminal emulator in the ./src/LivrEtec.GIB.Servidor
dotnet runAn error may occur if it has not configured AppSettings correctly, such as connection string or invalid port. In case of any error, feel comfortable to post an
To run the server using docker is simple, just run the following command in the ./src folder
docker compose --profile backend up --buildAs stated earlier, as it is necessary to download the images and packages Nuget may take minutes to download depending on your internet band.
After executing the project, he will inform the doors he is listening to. As SSL certificates are not yet configured, it is recommended to use http standards.
To make calls to the API, choose the GRPC customer your choice.
Some alternatives are insomnia or postman.
The Proto API file is at ./src/livretec.gib/protos/acervo.proto.
After that, it is necessary to log in to API through a Request for login in GerenciamentoSessao . Login is required to name login and password hash, but the first time starting the server, it will create a user with a user with admin:senha and id 1.
The password hash needs to be generated as follows:
md5(senha + id).
So the Request should be as follows:
{
"IdUsuario" : 1 ,
"HashSenha" : " 92f20dafc5e5ac1c66820903c492cc04 "
} And then it will return the JWT token, which should be added to Header as follows: Authorization: Bearer <JWT Token>
Okay, now you will have access to the rest of the API as an administrator.
Just as the GIB API is possible to test in the local environment and docker, however, you can do some tests without a installed MySQL server.
The tests are divided into two:
To perform only local tests, simply have installed the .NET 6.0.0 and in the folder ./src/ perform the following command:
dotnet test LivrEtec.sln --filter Category=local If you are using Visual Studio open the test manager and run the local test category
To also perform remote tests you must first run the GIB server. Once you have executed, you need to create and configure the ./src/LivrEtec.Testes/appsettings.json file.
Copy the AppSettings.modelo.json file, and fill in with the same information that filled the GIB server AppSettings, as well as adding the server link, if the link appears in this format:
http://[::]:21312means the same ashttp://localhost:21312
And after configuring the server and tests to execute the project just run the following command in the ./src/ directory
dotnet test LivrEtec.slnIn Visual Studio just open the test manager and click run.
If you want to use the docker, just go to the folder ./src/ and run the containers with the following command:
docker compose --profile teste up --buildThe
--buildis to ensure that the container is executed with the latest code.
After running the tests, the database container will continue to run. If you want to come out automatically after the tests, add
--exit-code-from appas a flag in the command.
The design is available at https://figma.com/community/file/1176031299741420547
All help is welcome if you want to collaborate. We recommend that you first go to (wiki) [./ wiki/projects-of-projects] and read a little to get the project overview, and then look for (./ ISSUES] any problem that interests you. If you find a project fork, make your modifications and then make a pull for the project. Make sure that before you do the Pull Request, you have created the tests for your new implementations, and that you are passing on all tests.
For more information about the project, see our documentation.
Welcome :)