Skip to content

This is the REST API for your InvoicesManager if you want to host it yourself.

License

Notifications You must be signed in to change notification settings

Invoices-Manager/Invoices-Manager-API

Repository files navigation

Invoices Manager - API (written in C# DOTNET6.0)

Important Info!

The program may contain errors, if any are found, please report them!

The server / api does not encrypt the data. It manages the data as it receives it, so you should encrypt the data before sending it to the api.

Application description:

Are you also tired of having all your invoices (and other documents) only on one PC? Although nowadays everything has a cloud.
Now it's over, so you can use your Invoices Manager as usual, which now
has a cloud function, and this is the API you need to host it.

Setup:

Needed to start the API and manage the database afterwards.

1.) Install the latest version of .NET 6 SDK

Needed to manage the database.

2.) Install the dotnet ef tool via dotnet tool install --global dotnet-ef

Just a test if everything is installed correctly.

3.) Run dotnet ef in your terminal, if you see an unicorn, everything is installed correctly.

Is the source from the api

4.) Clone the repository (from the main branch) (Recommended way if you want to simply update the API via Git)
or
download the source code in the release section

Is needed if you downloaded it from the release section

5.) Extract the archive and delete the archive

Configure the Conf for the API

6.) Open the appsettings.json file

7.) Change the DefaultConnection to your database connection string

8.) Change the SymmetricSecurityKey to your own SymmetricSecurityKey

9.) Change the Issuer to your own Issuer

10.) Change the Audience to your own Audience

11.) Change the Expiration to your own Expiration (in minutes)

12.) Save and close the file

Configure / Generate the database | This will generate all tables and columns in your database on the latest version

13.) Run dotnet ef migrations add firstInit in your terminal. (of course in the project folder)

14.) Run dotnet ef database update in your terminal. (of course in the project folder)

Start the API | This will start the api on port 5000 for all ip's

Change the port if you want to

--configuration : Sets the configuration mode. Possible values are Debug or Release.

--verbosity : Sets the level of detail of the console output. Possible values are quiet, minimal, normal, detailed and diagnostic.

15.) Run the dotnet run --urls=http://0.0.0.0:5000 --configuration Release --verbosity minimal to start the api.

Features:

✔️ 100% free and open source
✔️ Easy to use
✔️ JWT Authentication
✔️ Cloud function
✔️ Easy to host
✔️ Easy Documentation
✔️ Postman Collection
✔️ Invoice, Note & User function
✔️ Disallow to create new users (in appsettings.json)

API documentation:

Press here to see the documentation

CHANGELOG

Version structure (X.Y.Z.W)

X = Major version

Y = Minor version (big updates)

Z = Minor version (small updates)

W = Revision version (bug fixes)

v1.0.5.1

  • Security Patch (Dependency System.IdentityModel.Tokens.Jwt(CVE-2024-21319))

v1.0.5.0

  • add a function to allow or disallow the creation of new users (in appsettings.json)
  • add a dockerfile (for those who want to docker it)

v1.0.4.0

  • The money total is now a string instant of a double (for the encryption)

  • The Postman is updated belong to the new changes

  • The API Doc is updated belong to the new changes

      !!! THAT MEANS YOU HAVE TO DO STEP 13. and 14. FROM THE LIST ABOVE, IF YOU UPDATE UR API  !!!
      !!! name the migrations something with "version1040" but not "firstInit", because this migration already exists. !!!
    

v1.0.3.2 (HOTFIX)

  • Tokens are no longer hashed, because it broked the logic for "DeleteOldTokens"

  • Hasher class was deleted, is no longer needed

  • The table "logins" has changed (CreationDate is useless, is already in the token)

      !!! THAT MEANS YOU HAVE TO DO STEP 13. and 14. FROM THE LIST ABOVE, IF YOU UPDATE UR API  !!!
      !!! name the migrations something with "version1040" but not "firstInit", because this migration already exists. !!!
    

v1.0.3.3

  • FIX: The API needs a FileID from the client and should not create it by itself

v1.0.3.1

  • The Salt will be send at the who am i query

v1.0.3.0

  • Ram usage improved
  • Response time improved

v1.0.2.1

  • The Endpoint "GET /api/v01/User" (create user) now is an POST endpoint (C# does not allow a body in a get request)

v1.0.2.0

  • The API will now be started from the source code and not from the compiled version
  • FIX: The user controller tried to find a hashed token with an unhashed one when logging off

v1.0.1.0

  • JWT are now saved hashed in the database

v1.0.0.0

  • Set Up the whole project
  • Add JWT Authentication
  • Add 3 Controllers (User, Invoice, Note)
  • Add 17 endpoints
  • Add Postman Collection