EdwinVW / pitstop

This repo contains a sample application based on a Garage Management System for Pitstop - a fictitious garage. The primary goal of this sample is to demonstrate several software-architecture concepts like: Microservices, CQRS, Event Sourcing, Domain Driven Design (DDD), Eventual Consistency.
Apache License 2.0
1.08k stars 472 forks source link

Error while sending data through POST method #144

Closed odidev closed 1 year ago

odidev commented 1 year ago

Hi @EdwinVW,

It is giving Error 500 while trying to POST data to workshop management service through swagger UI. I have used the below sample data to POST where I have already registered customer with ID IDs760480 and vehicle with License Number 703-64-800.

"date": "2023-07-20T00:00:00",
 "jobs": [
 {
 "id": "122d4e9f-ba3b-4279-91f0-04bd696724ba",
 "startTime": "2023-07-20T08:00:00",
 "endTime": "2023-07-20T10:00:00",
 "vehicle": {
 "licenseNumber": "703-64-800",
 "brand": "Kia",
 "type": "Convertible",
 },
 "customer": {
 "customerId": "IDs760480",
 "name": "Tonya Boyd",
 "telephoneNumber": "001-908-693-6629x6863"
 },
 "description": "Fix Engine issue",
 "actualStartTime": null,
 "actualEndTime": null,
 "notes": null,
 "status": "Planned"

If available, May I get exact format of some sample data available already to POST to workshop management service.

Thanks.

EdwinVW commented 1 year ago

Hi @odidev.

You must specify the date of the workshop-planning on the URL. The JSON in the request should eb something like this:

{
  "jobId": "ec7432f4-f2a0-4534-8a7a-1b6a4b649dfb",
  "startTime": "2023-07-21T13:00:00",
  "endTime": "2023-07-21T14:00:00",
  "customerInfo": {
    "item1": "06d54189ecf549f983c6078cd9d300ae",
    "item2": "John Doe",
    "item3": "1234567890"
  },
  "vehicleInfo": {
    "item1": "81-XX-32",
    "item2": "Ford",
    "item3": "Fiesta"
  },
  "description": "General Maintenance",
  "messageId": "f1734ba1-82bb-46e8-bd77-8f46f6b3a741",
  "messageType": "PlanMaintenanceJob"
}

Obsiously, the Customer Id (item1 in the customerInfo tuple) and Vehicle Id (item1 in the vehicleInfo tuple) must correspond to an existing customer and vehicle.

This is the Curl command that I used to do a successful request using the Swagger UI:

curl -X 'POST' \
  'http://localhost:49659/api/WorkshopPlanning/2023-07-21/jobs' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -d '{
  "jobId": "ec7432f4-f2a0-4534-8a7a-1b6a4b649dfb",
  "startTime": "2023-07-21T13:00:00",
  "endTime": "2023-07-21T14:00:00",
  "customerInfo": {
    "item1": "06d54189ecf549f983c6078cd9d300ae",
    "item2": "John Doe",
    "item3": "1234567890"
  },
  "vehicleInfo": {
    "item1": "81-XX-32",
    "item2": "Ford",
    "item3": "Fiesta"
  },
  "description": "General Maintenance",
  "messageId": "f1734ba1-82bb-46e8-bd77-8f46f6b3a741",
  "messageType": "PlanMaintenanceJob"
}'

I hope this helps.

odidev commented 1 year ago

Thanks for the quick response @EdwinVW. It helped and now I am able to POST workshop data as well.

Also, if it's not too much to ask for can you also suggest how to clear the customer/vehicle data from webapp portal which gets stored there when we register any new customer/vehicle.

EdwinVW commented 1 year ago

Hi @odidev.

In the repo there's a SQL script to remove all the data. Editing or deleting data through the UI is not implemented (and will not be implemented). It would not add anything to the sample.