Skip to content

1christianfelix/CarCar

Repository files navigation

CarCar

Team:

  • Brandon Moore - Services
  • Christian Felix - Sales

Design

Project Diagram

Project CarCar design

How to run the application

  1. Clone the repository:
    https://gitlab.com/1christianfelix1/car-car

  2. Run Docker and run the following commands to build and start the Docker container

docker volume create beta-data
docker-compose build
docker-compose up

  1. Make and apply migrations
docker exec -it «api-container-name» bash
python manage.py makemigrations
python manage.py migrate

  1. Once everything is loaded, you can view the application at:
    http://localhost:3000/

Service microservice

General Overview

This application serves the purpose of:

  • Managing and tracking automobile service appointments
  • Providing user with the ability to create appointments through a user-friendly form
  • View a comprehensive list of scheduled appointments

Front-End

On the front-end, users can also access features to mark appointments as canceled or completed and add information related to technicians via a dedicated form. In addition, the application offers a service history view.

Back-End

The back-end functionality encompasses creating appointments and technicians, along with persisting their details.

To further enhance the user experience, the application integrates with an inventory microservice that leverages the VIN to verify whether the automobile has been sold by the dealership.

Polling

Every 60 seconds, the Service microservice polls the Inventory microservice for automobile updates

RestFul API (PORT 8080):

Appointments

Action Method URL
List All Appointments GET http://localhost:8080/api/appointments/
List Appointments Output

Output:

{
	"appointments": [
		{
			"id": 2,
			"vin": "JT2BB5BA8BCBZRU2Z",
			"owner": "bob",
			"date_and_time": "2023-03-10T23:42:00+00:00",
			"technician": {
				"name": "sdfsf",
				"id": 1,
				"employee_number": 32
			},
			"reason": "sdasd",
			"vip": false,
			"finished": true
		},
		{
			"id": 3,
			"vin": "JT2BB5BA8BCBZRU2Z",
			"owner": "da",
			"date_and_time": "2023-03-03T22:51:00+00:00",
			"technician": {
				"name": "sdfsf",
				"id": 1,
				"employee_number": 32
			},
			"reason": "wqeq",
			"vip": false,
			"finished": true
		},
		{
			"id": 4,
			"vin": "JT2BB5BA8BCBZRU2Z",
			"owner": "bob",
			"date_and_time": "2023-03-08T09:53:00+00:00",
			"technician": {
				"name": "sdfsf",
				"id": 1,
				"employee_number": 32
			},
			"reason": "ewrwer",
			"vip": false,
			"finished": true
		}
	]
}

Technicians:

Action Method URL
List Technicians GET http://localhost:8080/api/technicians/
Create a Technician POST http://localhost:8080/api/technicians/
Show Technician Details GET http://localhost:8080/api/technicians/:id/
List Technicians Output

Output:

{
	"technicians": [
		{
			"name": "sdfsf",
			"id": 1,
			"employee_number": 32
		}
	]
}
Create Technician Input/Output

Input:

{
	"name": "bob",
	"employee_number": 1891
}

Output:

{
	"name": "bob",
	"id": 2,
	"employee_number": 1891
}
Show Technicians Details Output

Output:

{
	"name": "sdfsf",
	"id": 1,
	"employee_number": 32
}

Sales microservice

General Overview

The sales application allows users to manage and view data surrounding sales:

  • Add Customers and new Sales People through forms
  • Record and track the history of sales between Customer, Sales Person, and the Automobile
  • Filter the history of sales records by sales person

Front-End

The front-end interface of the Sales service provides the user with forms to add Sales People, Customers, and create Sale Records. Some forms contain dropdown menus that allow the user to identify and use known records.

The user also has access to view a detailed list of all sales records or records by a certain sales person.

Back-End

Every model in the back-end has a relationship with the Sales Record model. The sales service also utilizes data from the inventory service in order to create relationships between sales records and automobiles. This data was fetched by polling the Inventory API, uniquely identified by VIN numbers and ten associated with an Automobile Value Object within the Sales microservices.

Polling

The Polling rate from Sales to Inventory has been reduced to 5 seconds from the original 60 seconds. This is to match the polling rate of the self-updating dropdown menu for automobiles when creating a Sales Record. The dropdown will reflect newly added automobiles every 5 seconds and will show a disclaimer if there are no vehicles for sale.

For each model, there exist a view to create, delete, and list.

RestFul API (PORT 8090):

Sales Person:

Action Method URL
List Sales People GET http://localhost:8090/api/sales_person/
Create a Sales Person POST http://localhost:8090/api/sales_person/
Delete a Sales Person DELETE http://localhost:8090/api/sales_person/:id/
List Sales People Output

Output:

{
	"sales_people": [
		{
			"href": "/api/sales_person/1/",
			"name": "Christian Felix",
			"employee_number": "1"
		},
		{
			"href": "/api/sales_person/2/",
			"name": "Jeff",
			"employee_number": "2"
		},
    ]
}
Create Sales People Input/Output

Input:

{
	"name": "Jeff",
	"employee_number": "1"
}

Output:

{
	"href": "/api/sales_person/1/",
	"name": "Jeff",
	"employee_number": "1",
	"id": 1
}
Delete Sales Person Output

Output:

{
	"Deleted": true
}

Customer

Action Method URL
List Customers GET http://localhost:8090/api/customer/
Create a Custom POST http://localhost:8090/api/customer/
Delete a Customer DELETE http://localhost:8090/api/customer/:id/
List Customer Output

Output:

{
	"customers": [
		{
			"href": "/api/customer/1/",
			"name": "billy",
			"address": "1",
			"phone_number": "111-222-3333"
		}
	]
}
Create Customer Input/Output

Input:

{
	"name": "billy",
	"address": "2 house",
	"phone_number": "111-222-3333"
}

Output:

{
	"href": "/api/customer/1/",
	"name": "billy",
	"address": "2 house",
	"phone_number": "111-222-3333",
	"id": 1
}
Delete Sales Person Output

Output:

{
	"Deleted": true
}

Sales Record

Action Method URL
List Sales Records GET http://localhost:8090/api/sales_records/
Create Sales Record POST http://localhost:8090/api/sales_records/
Delete Sales Record DELETE http://localhost:8090/api/sales_records/:id/
List Sales Records Output

Output:

{
	"sales_records": [
		{
			"href": "/api/sales_records/1/",
			"sale_price": "40000",
			"sales_person": {
				"href": "/api/sales_person/1/",
				"name": "Jeff",
				"employee_number": "1"
				"id": 1
			},
			"customer": {
				"href": "/api/customer/1/",
				"name": "billy",
				"address": "1",
				"phone_number": "111-222-3333"
				"id": 1
			},
			"automobile": {
				"import_href": "/api/automobiles/2C3CCAFJ7CH100286/",
				"color": "yellow",
				"year": 2013,
				"vin": "1C3CC5FB2AN120174",
				"sold": true
			}
		}
    ]
}
Create Sales Record Input/Output

Input:

{
	"sale_price": "40000",
	"sales_person": 1,
	"customer": 1,
	"automobile": "1C3CC5FB2AN120174"
}

Output:

{
	"href": "/api/sales_records/1/",
	"sale_price": "40000",
	"sales_person": {
		"href": "/api/sales_person/1/",
		"name": "Jeff",
		"employee_number": "1"
		"id": 1
	},
	"customer": {
		"href": "/api/customer/1/",
		"name": "billy",
		"address": "1",
		"phone_number": "111-222-3333"
		"id": 1
	},
	"automobile": {
		"import_href": "/api/automobiles/1C3CC5FB2AN120174/",
		"color": "yellow",
		"year": 2013,
		"vin": "1C3CC5FB2AN120174",
		"sold": true
	}
}
Delete Sales Record Output

Output:

{
	"Deleted": true
}

Inventory

General Overview

The inventory service provides users the ability to create/update, delete, list, and view details for Manufacturers, VehicleModels, and Automobiles.

Manufacturers

Action Method URL
List manufacturers GET http://localhost:8100/api/manufacturers/
Create a manufacturer POST http://localhost:8100/api/manufacturers/
Get a specific manufacturer GET http://localhost:8100/api/manufacturers/:id/
Update a specific manufacturer PUT http://localhost:8100/api/manufacturers/:id/
Delete a specific manufacturer DELETE http://localhost:8100/api/manufacturers/:id/
Create and Update Manufacturer Input

Input:

{
  "name": "Chrysler"
}
Create, Update, Getting a specific Manufacturer Output

Output:

{
  "href": "/api/manufacturers/1/",
  "id": 1,
  "name": "Chrysler"
}
Listing Manufacturer Output

Output:

{
  "manufacturers": [
    {
      "href": "/api/manufacturers/1/",
      "id": 1,
      "name": "Daimler-Chrysler"
    }
  ]
}

VehicleModels

Action Method URL
List vehicle models GET http://localhost:8100/api/models/
Create a vehicle model POST http://localhost:8100/api/models/
Get a specific vehicle model GET http://localhost:8100/api/models/:id/
Update a specific vehicle model PUT http://localhost:8100/api/models/:id/
Delete a specific vehicle model DELETE http://localhost:8100/api/models/:id/
Create and Update Vehicle Input

Input:

{
  "name": "Sebring",
  "picture_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/71/Chrysler_Sebring_front_20090302.jpg/320px-Chrysler_Sebring_front_20090302.jpg",
  "manufacturer_id": 1
}
Updating a Vehicle Input

Input:

{
  "name": "Sebring",
  "picture_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/71/Chrysler_Sebring_front_20090302.jpg/320px-Chrysler_Sebring_front_20090302.jpg"
}
Create, Update, Getting a specific Vehicle Model Output

Output:

{
  "href": "/api/models/1/",
  "id": 1,
  "name": "Sebring",
  "picture_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/71/Chrysler_Sebring_front_20090302.jpg/320px-Chrysler_Sebring_front_20090302.jpg",
  "manufacturer": {
    "href": "/api/manufacturers/1/",
    "id": 1,
    "name": "Daimler-Chrysler"
  }
}
Listing Vehicle Model Output

Output:

{
  "models": [
    {
      "href": "/api/models/1/",
      "id": 1,
      "name": "Sebring",
      "picture_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/71/Chrysler_Sebring_front_20090302.jpg/320px-Chrysler_Sebring_front_20090302.jpg",
      "manufacturer": {
        "href": "/api/manufacturers/1/",
        "id": 1,
        "name": "Daimler-Chrysler"
      }
    }
  ]
}
Action Method URL
List automobiles GET http://localhost:8100/api/automobiles/
Create an automobile POST http://localhost:8100/api/automobiles/
Get a specific automobile GET http://localhost:8100/api/automobiles/:vin/
Update a specific automobile PUT http://localhost:8100/api/automobiles/:vin/
Delete a specific automobile DELETE http://localhost:8100/api/automobiles/:vin/
Creating an Automobile Input

Input:

{
  "color": "red",
  "year": 2012,
  "vin": "1C3CC5FB2AN120174",
  "model_id": 1
}
Getting Details of an Automobile Output

Output:

{
  "href": "/api/automobiles/1C3CC5FB2AN120174/",
  "id": 1,
  "color": "yellow",
  "year": 2013,
  "vin": "1C3CC5FB2AN120174",
  "model": {
    "href": "/api/models/1/",
    "id": 1,
    "name": "Sebring",
    "picture_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/71/Chrysler_Sebring_front_20090302.jpg/320px-Chrysler_Sebring_front_20090302.jpg",
    "manufacturer": {
      "href": "/api/manufacturers/1/",
      "id": 1,
      "name": "Daimler-Chrysler"
    }
  }
}
Updating an Automobile Input

Input:

{
  "color": "red",
  "year": 2012
}
Listing Automobiles Output

Output:

{
  "autos": [
    {
      "href": "/api/automobiles/1C3CC5FB2AN120174/",
      "id": 1,
      "color": "yellow",
      "year": 2013,
      "vin": "1C3CC5FB2AN120174",
      "model": {
        "href": "/api/models/1/",
        "id": 1,
        "name": "Sebring",
        "picture_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/71/Chrysler_Sebring_front_20090302.jpg/320px-Chrysler_Sebring_front_20090302.jpg",
        "manufacturer": {
          "href": "/api/manufacturers/1/",
          "id": 1,
          "name": "Daimler-Chrysler"
        }
      }
    }
  ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published