Code Monkey home page Code Monkey logo

aiof-api's Introduction

Overview

All in one finance API

Build Status

Documentation

aiof API overall documentation

Application

On a high level, the API is a CRUD application for aiof data. It is based on a multi-tenant pattern with user_id. This is enforced by the interface ITenant which gets dependency injected. Even though User A is authenticated and authorized (via JWT), they can't access data for User B who is the same, authorization-wise, to user A. Thus, the authentication and authorization process flow is as follows:

  • Is User Authenticated?
  • Is User Authorized to access this Endpoint? Are they in the correct Role?
  • Does access to the data the User is trying to get need to be controlled? If yes
  • Then, user_id gets extracted from the JWT claim and EF Core uses QueryFilters to filter the data a User can access - in the current scenario, only their own

How to run it

In order to fully run it locally, the recommended way is to use docker-compose. That pulls down all the Docker images needed and you will have the full microservices architecture locally in order to get a JWT from aiof-auth and add it to your requests to this API

Local

From the root project directory

dotnet run -p .\aiof.api.core\

Or change directories and run from the core .csproj

cd .\aiof.api.core\
dotnet run

Make API calls to

http://localhost:5001

Docker

There are 2 ways to run it through Docker. One is pulling the remote image and the other is building the image locally

Docker local

Build the image from Dockerfile.local

docker build -t aiof-api:latest -f Dockerfile.local .

You can now use your locally built aiof-api:latest in any docker-compose.yml configuration. This is extremely helpful when you change logic in the API and you need to run this custom code locally for other microservices depending on it

Docker remote

Pull the latest image from Docker Hub

docker pull gkama/aiof-api:latest

Run it

docker run -it --rm -e ASPNETCORE_ENVIRONMENT='Development' -p 8000:80 gkama/aiof-api:latest

Make API calls to

http://localhost:8000/

(Optional) Clean up none images

docker rmi $(docker images -f dangling=true -q)

Docker compose

From the project root directory

docker-compose up

EF Core migrations

Migrations are managed in the ef-migrations branch

dotnet ef migrations add {migration name} -s .\aiof.api.core -p .\aiof.api.data
dotnet ef migrations script -p .\aiof.api.data
dotnet ef migrations script {migration name} -s .\aiof.api.core -p .\aiof.api.data
dotnet ef migrations remove -s .\aiof.api.core -p .\aiof.api.data

aiof-api's People

Contributors

gkama avatar

Stargazers

 avatar

Watchers

 avatar  avatar

aiof-api's Issues

clean up Asset entity

clean up any remnants of Asset entity as it has moved to aiof-asset microservice

  • remove AssetRepository
  • remove any dependency injection with AssetRepository
  • remove any /asset endpoints
  • remove any Asset unit tests
  • remove FakeDataManager assets data
  • update AiofContext to use new Asset entity with the asset scehma -> asset.Asset
  • test the changes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.