Code Monkey home page Code Monkey logo

challenge-call-center's Introduction

Calls Web Service

A service to manage call resources, each representing a phone call between two numbers. Calls Web Service is a Java Spring-boot application, with a view layer served by Thymeleaf. The web service exposes some operations (create, read, delete) via a REST controller. Additionally, the service can be run in a docker container alongside with a MariaDB container.

Running the application via gradle

Building and running unit tests:

gradlew clean build

To run the application, in the project root folder run the command below. A local mariaDB instance should be first configured.

gradlew run

Running the application via docker

Building the docker image using the Jib gradle plugin.

gradlew jibDockerBuild --image=call-center-server

Spinning up the docker containers. In the project root folder (default location of the docker-compose.yml file) run:

docker-compose up

To remove the data volume:

docker volume rm challenge-call-center_db_data

Usage and Configuration

By default, the application will run on port 9000. The different operations are mapped to:

  • /call-center/calls/create
  • /call-center/calls/createMany
  • /call-center/calls/delete/{id}
  • /call-center/calls/list
  • /call-center/calls/statistics

The HTML pages are mapped as below. Generate and clear are dev tools, allowing the user to easily generate and clear all data.

  • /
  • /createForm
  • /create
  • /createMany
  • /delete/{id}
  • /list
  • /statistics
  • /clear
  • /generate

For the create operations, an object (or list of objects for the createMany) is expected with the following format:

{
    "callerNumber": "+351 919293284",
    "calleeNumber": "+351 919293186",
    "type": "Inbound",
    "startTime": 1615116875,
    "endTime": 1615117554
}

The prices of the calls can be configured via the following properties:

challenge.call-center.call.first-five-minutes-cost=0.10
challenge.call-center.call.cost-per-minute-after-five-minutes=0.05

Testing and Generating data

The web service can be tested via any API client like Postman or Insomnia. A file 'Insomnia_Tests.json' is already provided with this project with a sample test case for each operation.

Testing data can be easily generated via a JSON generator. The example below works for https://www.json-generator.com/

[
  '{{repeat(1000)}}',
    {
      callerNumber: '+351 {{phone("9192932xx")}}',
      calleeNumber: '+351 {{phone("9192931xx")}}',
      type: '{{random("Inbound", "Outbound")}}',
      startTime:  '{{Math.round(date(new Date(2020, 0, 1), new Date()).getTime()/1000)}}',
      endTime(tags) {
        return this.startTime + tags.integer(0,999);
      }
    }
]

challenge-call-center's People

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.