Coder Social home page Coder Social logo

asp.net-mongodb-docker-k8s's Introduction

Overview

  • A classic DDD with CQRS-ES, Hypermedia API and Ubiquitous unit test project based on EventFlow. It's targeted to ASP.NET Core 2.2 and can be deployed to docker and k8s.
  • Based on EventFlow
  • Wiki is in progress

How to Run

Running the container

Then spin up a new container using docker-compose

docker-compose up

Note: add a -d to run the container in background

An API service and mssql will run in docker

Run in local

This project based on .NET Core SDK 2.2.103, please install corresponding SDK for your operating system:

After installing, please run below command to make sure current .NET Core version is 2.2.103 dotnet --version

The EventStore and ReadModel are based on EF Core and connect to MSSQL, before run this service please update EventStore connect string and ReadModel connect string in settings.json under RestAirline.Api project. After set connect string two database will be migrated automatically by the API service.

Run the API

1. Try to input home api link in Postman:

GET http://localhost:61200/api/home/


2. Select Journeys

Journey items should come from another micro-service named flight availability, for now let's build a journey in the api automatically for convenience. So you need not pass any journey id to this api.

POST api/booking/journeys

add journey

3. Add passenger

We can get request body schema from last Api response become the whole Api is designed by Hypermedia. The api definition is totally described by last api response under resourceCommands\addPassengerCommand:

"addPassengerCommand": 
{
    "bookingId": "booking-352cb1f3-0f68-4e04-a2f7-24036eb53ce7",
    "name": null,
    "passengerType": 0,
    "age": 0,
    "email": null,
    "postUrl": {
        "uri": "/api/booking/booking-352cb1f3-0f68-4e04-a2f7-24036eb53ce7/passenger"
    }
}

Obviously the endpoint is:

http://localhost:61100/api/booking/booking-352cb1f3-0f68-4e04-a2f7-24036eb53ce7/passenger

The payload schema is:

{
	"bookingId": "booking-352cb1f3-0f68-4e04-a2f7-24036eb53ce7",
    "name": null,
    "passengerType": 0,
    "age": 0,
    "email": null,
}

bookingId is filled already, please try to fill other parameters, eg:

{
	"bookingId": "booking-352cb1f3-0f68-4e04-a2f7-24036eb53ce7",
    "name": "test",
    "passengerType": 0,
    "age": 22,
    "email": "[email protected]",
}

Send request:

POST api/{bookingId}/passenger

add booking

4. Get booking

According to response of last api, you can either get the booking by resourceLinks or post data by resourceCommand.

GET api/booking/{bookingId}

get booking

5. Update passenger Name

Business

The example is regarding online booking for an airline company. An airline company named 'RestAirline' is offering online booking.

  • After passenger submitted one of the available journey that means this passenger starting create an online booking.
  • passenger can submit multiple available journeys, every journey including a flight.
  • After passenger added journeys, he/she can add passengers.
  • Once passenger have been added in booking, passenger can update passenger name for each passenger.
  • passenger can submit available seats for each flight and each passenger, seat may just including seat number.
  • Once passenger submitted seats, passenger still can update seat.
  • After all of these steps, passenger have a chance to order insurance for all passenger some of them.
  • Last step is pay for all booking, if payment is successful then create a pnr(six digit) for this booking.
  • Online checkin is allowed for all the flights. Passenger can checkin at below time window:

2h <= timeWindow <= departure time - 30m

  • Passenger can do online checkin, after this step passenger start to his/her journey.

Possible Domain

There are four possible Domains for above business: But let's focus on Booking for now and mock other two domains even if you can hardcode data from these two domains.

domain

asp.net-mongodb-docker-k8s's People

Watchers

James Cloos avatar  avatar

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.