estatedocflow / estatedocflow.api

0 stars 0 forks source link

Runner Availability API #11

Open estatedocflow opened 6 months ago

estatedocflow commented 6 months ago

Description

Develop an API endpoint to allow runners (service providers) to set their availability for real estate service bookings. This API will enable runners to update their schedules, making their availability visible to customers through the booking platform.

Requirements

  1. Runner Availability Endpoint:

Develop a POST endpoint /api/availability for runners to set their availability. Input parameters:

Endpoint Details

Endpoint: POST /api/availability

Request Body:
{
  "runnerId": "123",
  "startDate": "2024-05-15",
  "endDate": "2024-05-31",
  "availableSlots": [
    {
      "date": "2024-05-15",
      "startTime": "10:00 AM",
      "endTime": "12:00 PM"
    },
    {
      "date": "2024-05-17",
      "startTime": "2:00 PM",
      "endTime": "4:00 PM"
    }
  ]
}

Response: HTTP Status: 201 Created upon successful availability update. 400 Bad Request for invalid requests.

Response Body:
{
  "message": "Availability updated successfully."
}

Endpoint: GET /api/availability to retrieve runner availability for the shared calendar.

Dtos

public class RunnerAvailabilityDto
{
    public string RunnerId { get; set; }
    public DateTime StartDate { get; set; }
    public DateTime EndDate { get; set; }
    public List<AvailableSlotDto> AvailableSlots { get; set; }
}

public class AvailableSlotDto
{
    public DateTime Date { get; set; }
    public string StartTime { get; set; }
    public string EndTime { get; set; }
}
public class ApiResponseDto
{
    public string Message { get; set; }
}

Additional Notes

The implementation should ensure secure handling of runner IDs and availability data, with proper validation and error handling to maintain data integrity. The API should be designed to accommodate various availability settings (e.g., recurring schedules) and scale to handle multiple runners efficiently.

Tasks

Develop the /api/availability endpoint with validation and persistence logic. Test the API thoroughly to validate functionality and error handling.

Riya2993 commented 5 months ago

public class RunnerAvailabilityDto { public string RunnerId { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } public List AvailableSlots { get; set; } }

RunnerId is foreign key ? If there is foreign key then which table to related ?