Giter VIP home page Giter VIP logo

telephone-booking-operator's Introduction

Telephone Taxi Booking Operator

Yêu cầu

Bài tập nhóm: Thực hiện module đặt xe từ hệ thống tổng đài theo mô tả bên dưới

  • Chọn loại topology theo kiến trúc Event-Driven : Mediator/Broker
  • Vẽ flow tương ứng với loại Topology đã chọn tương ứng với đặc tả
  • Code theo đặc tả
  • Deadline : 16/08/2023-Nộp trên moodle

Cấu trúc folder

├── reception-service (S1)
├── location-service (S2)
├── booking-service (S3)
├── client
├── doc (tài liệu)
├── docker (file docker compose)
└── README.md

Hướng dẫn docker

Yêu cầu trước tiên

  • Đã tải Docker, Docker Desktop, Docker Compose
  • Kiểm tra bằng cách gõ cmd (này check các images có trong docker)
docker images
  • Nếu có lỗi thì có thể cần chạy docker trước (khởi động Docker Desktop)

Chạy docker compose:

  • Gõ lệnh cmd tại thư mục gốc để bulild (tải image, chuẩn bị container,...)
docker compose build
  • Gõ lệnh cmd để chạy (có thể thêm -d ở cuối để chạy background)
docker compose up -d
  • Theo dõi docker container tại Docker Desktop (xem log)
  • Đợi một chút cho toàn bộ container chạy thì vào http:\\localhost:4000 để truy cập giao diện tổng đài

Mô hình

architecture-model

Micro-Kernel(Plug-In)

mirco-kernel

  • Thay đổi map service plugin tại GeoModule ở location-service/src/geocoding/geocoding.module.ts
 {
  provide: 'MAP_SERVICE',
  inject: [HttpService, ConfigService],
  useFactory: (
    httpService: HttpService,
    configService: ConfigService,
  ): MapService => {
    // thay đổi map service plugin tại đây bằng lớp map service phù hợp
    return new GoongService(httpService, configService);
  },
},
  • Dễ dàng tạo thêm plugin map service bằng cách kế thừa MapService
import { HttpService } from '@nestjs/axios';
import { ConfigService } from '@nestjs/config';

export class Coordinates {
  lat: number;
  long: number;
}

export class MapData {
  place_id: string;
  address: string;
}

export class MapDataDetail extends MapData {
  coordinates: Coordinates;
}

export abstract class MapService {
  abstract host: string;
  protected httpService: HttpService;
  protected configService: ConfigService;

  constructor(httpService: HttpService, configService: ConfigService) {
    this.httpService = httpService;
    this.configService = configService;
  }

  abstract geocoding(address: string): Promise<MapData[]>;
  abstract getPlaceDetail(placeId: string): Promise<MapDataDetail>;
}

telephone-booking-operator's People

Contributors

thaichihien avatar pnkhang20 avatar

Watchers

 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.