diff --git a/interoperability/solidarity-api/oas.yaml b/interoperability/solidarity-api/oas.yaml deleted file mode 100644 index 90fe3cb..0000000 --- a/interoperability/solidarity-api/oas.yaml +++ /dev/null @@ -1,1227 +0,0 @@ -openapi: 3.0.0 -info: - title: Solidarity Mobility API - version: 1.0.0 -servers: - # Added by API Auto Mocking Plugin - - description: SwaggerHub API Auto Mocking - url: https://virtserver.swaggerhub.com/salimbouaram12/SOLIDARITYCOOPGO/1.0.0 - - url: / -paths: - /passenger: - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PassengerTripRequest' - required: true - responses: - "201": - description: Trip Request Created - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Create a Passenger Trip Request - tags: - - Passenger Trip Request - /driver_journeys: - get: - description: Route used to retrieve a collection of punctual planned outward - driver journeys matching the provided criteria. - operationId: getDriverJourneys - parameters: - - description: Latitude of searched departure point. - explode: true - in: query - name: departureLat - required: true - schema: - type: number - style: form - - description: Longitude of searched departure point. - explode: true - in: query - name: departureLng - required: true - schema: - type: number - style: form - - description: Departure datetime using a UNIX UTC timestamp in seconds. - explode: true - in: query - name: departureDate - required: true - schema: - type: integer - style: form - - description: The operator's FQDN. - explode: true - in: query - name: operator - required: true - schema: - type: string - style: form - responses: - "200": - content: - application/json: - schema: - items: - oneOf: - - $ref: '#/components/schemas/PunctualDriverJourney' - - $ref: '#/components/schemas/RegularDriverJourney' - title: DriverJourneys - type: array - description: Ok. Request processed successfully. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Search for matching punctual planned outward driver journeys. - tags: - - Search - /driver_regular_availabilities: - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DriverRegularAvailabilitiesRequest' - required: true - responses: - "201": - description: Regular driver availabilities set successfully. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Set Regular Driver Availabilities - tags: - - Driver Availability and Schedule - /driver_punctual_availabilities: - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DriverPunctualAvailabilitiesRequest' - required: true - responses: - "201": - description: Punctual driver availabilities set successfully. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Set Punctual Driver Availabilities - tags: - - Driver Availability and Schedule - /messages: - post: - description: Route used to allow a user to connect back to the owner of a retrieved - journey through a texte message. - operationId: postConnections - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/postConnections_request' - responses: - "201": - description: Successful operation. - "404": - description: The targeted journey or user no more exists. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Send a message to the owner of a retrieved journey. - tags: - - Interact - /bookings: - get: - description: "Route used to filter and retrieve bookings based on the specified\ - \ status, type, and ID." - operationId: filterBookingsByStatus - parameters: - - description: The operator's FQDN. - explode: true - in: query - name: operator - required: true - schema: - type: string - style: form - - description: The status of the bookings to filter. - explode: true - in: query - name: status - required: true - schema: - enum: - - WAITING_DRIVER_CONFIRMATION - - WAITING_PASSENGER_CONFIRMATION - - CONFIRMED - - CANCELLED - - COMPLETED_PENDING_VALIDATION - - VALIDATED - type: string - style: form - - explode: true - in: query - name: filterType - required: true - schema: - enum: - - driver - - passenger - type: string - style: form - - description: The ID (UUID) used. - explode: true - in: query - name: Id - required: true - schema: - format: uuid - type: string - style: form - responses: - "200": - content: - application/json: - schema: - items: - $ref: '#/components/schemas/Booking' - type: array - description: "Successful operation. Bookings matching the specified status,\ - \ type, and ID." - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: "No bookings found for the specified status, type, and ID." - summary: "Filter and retrieve bookings by status, type, and ID." - tags: - - Bookings Filter - post: - description: "Route used to synchronize a Booking request initiated by a platform\ - \ to the second platform involved in the shared punctual outward journey.\ - \ While posting a new Booking, its status must always be set first as `status=WAITING_CONFIRMATION`." - operationId: postBookings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/BookingRequest' - responses: - "201": - content: - application/json: - schema: - $ref: '#/components/schemas/Booking' - description: Successful operation. A new Booking has been created. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Create a punctual outward Booking request. - tags: - - Interact - /bookings/{bookingId}: - get: - description: "Route used to retrieve the details of an existing Booking request.\ - \ Can only be used by the operator having created the Booking request. This\ - \ route is provided to check if the Booking object state is similar between\ - \ two operators, but its usage should be required to handle the full use case\ - \ of a booking." - operationId: getBookings - parameters: - - description: The operator's FQDN. - explode: true - in: query - name: operator - required: true - schema: - type: string - style: form - - explode: false - in: path - name: bookingId - required: true - schema: - $ref: '#/components/schemas/bookingId' - style: simple - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/Booking' - description: Successful operation. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/getBookings_404_response' - description: "This Booking object no more exists. Error code can be among\ - \ `missing_journey, missing_booking, missing_user` ." - summary: Retrieves an existing Booking request. - tags: - - Interact - patch: - description: "Route used to update the status of an existing Booking request.\ - \ Should be used usually just to confirm, cancel, etc. an existing Booking." - operationId: patchBookings - parameters: - - description: The operator's FQDN. - explode: true - in: query - name: operator - required: true - schema: - type: string - style: form - - explode: false - in: path - name: bookingId - required: true - schema: - $ref: '#/components/schemas/bookingId' - style: simple - - description: New status of the Booking. - explode: true - in: query - name: status - required: true - schema: - $ref: '#/components/schemas/bookingStatus' - style: form - - description: Free text content of a message. The message can contain explanations - on the status change. - explode: true - in: query - name: message - required: false - schema: - maxLength: 500 - type: string - style: form - responses: - "200": - description: Successful operation. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/getBookings_404_response' - description: "The targeted journey, booking or user no more exists. Error\ - \ code can be among `missing_journey, missing_booking, missing_user`\ - \ ." - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/getBookings_404_response' - description: Conflict. This booking has already the new status requested. - Error code is `status_already_set`. - summary: Updates status of an existing Booking request. - tags: - - Interact -components: - parameters: - departureLat: - description: Latitude of searched departure point. - explode: true - in: query - name: departureLat - required: true - schema: - type: number - style: form - departureLng: - description: Longitude of searched departure point. - explode: true - in: query - name: departureLng - required: true - schema: - type: number - style: form - arrivalLat: - description: Latitude of searched arrival point. - explode: true - in: query - name: arrivalLat - required: true - schema: - type: number - style: form - arrivalLng: - description: Longitude of searched arrival point. - explode: true - in: query - name: arrivalLng - required: true - schema: - type: number - style: form - departureDate: - description: Departure datetime using a UNIX UTC timestamp in seconds. - explode: true - in: query - name: departureDate - required: true - schema: - type: integer - style: form - departureTimeOfDay: - description: "Departure time of day represented as [RFC3339 partial-time](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6)." - example: 07:30:00 - explode: true - in: query - name: departureTimeOfDay - required: true - schema: - format: partial-time - type: string - style: form - timeDelta: - description: Time margin in seconds. The retrieved journeys must match the given - time parameters within a +`timeDelta` / -`timeDelta` interval . - explode: true - in: query - name: timeDelta - required: false - schema: - default: 900 - type: integer - style: form - minDepartureDate: - description: Minimum date of departure for the returned journeys. Datetime using - a UNIX UTC timestamp in seconds. - explode: true - in: query - name: minDepartureDate - required: false - schema: - type: integer - style: form - maxDepartureDate: - description: Maximum date of departure for the returned journeys. Datetime using - a UNIX UTC timestamp in seconds. - explode: true - in: query - name: maxDepartureDate - required: false - schema: - type: integer - style: form - departureRadius: - description: Search radius in kilometers around the departure point. - explode: true - in: query - name: departureRadius - required: false - schema: - default: 1.0 - type: number - style: form - arrivalRadius: - description: Search radius in kilometers around the arrival point. - explode: true - in: query - name: arrivalRadius - required: false - schema: - default: 1.0 - type: number - style: form - count: - description: "Maximum number of returned results. If missing, all matching results\ - \ are returned." - explode: true - in: query - name: count - required: false - schema: - type: integer - style: form - responses: - BadRequest: - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - Unauthorized: - description: Unauthorized. You must authenticate. - TooManyRequests: - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - InternalServerError: - description: Internal Server Error. Please try again later. - schemas: - PunctualDriverJourney: - allOf: - - $ref: '#/components/schemas/DriverTrip' - - $ref: '#/components/schemas/JourneySchedule' - - properties: - price: - $ref: '#/components/schemas/Price' - driver_departure_Address: - type: string - - punctual_availabilities: - $ref: '#/components/schemas/PunctualAvailabilitySlot' - - - type: object - RegularDriverJourney: - allOf: - - $ref: '#/components/schemas/DriverTrip' - - $ref: '#/components/schemas/JourneySchedule' - - properties: - price: - $ref: '#/components/schemas/Price' - driver_departure_Address: - type: string - regular_availabilities: - $ref: '#/components/schemas/RegularAvailabilitySlot' - - - - type: object - Price: - example: - amount: 9.301444 - currency: currency - type: FREE - properties: - amount: - description: "Carpooling passenger cost estimate. In the case of integrated\ - \ booking by API, amount expected by the carpooling operator." - format: float - type: number - currency: - description: ISO 4217 code representing the currency of the price. - type: string - type: object - Car: - example: - model: model - brand: brand - properties: - model: - description: Model of the car. - type: string - brand: - description: Brand of the car. - type: string - type: object - User: - example: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - properties: - id: - description: User's identifier. It MUST be unique for a given `operator`. - type: string - operator: - description: The operator identifier. MUST be a Fully Qualified Domain Name - (example carpool.mycity.com) owned by the operator or a Partially Qualified - Domain Name (example operator.org) owned and exclusively operated by the - operator. Operators SHOULD always send the same value. - type: string - alias: - description: User's alias. - type: string - firstName: - description: User's first name. - type: string - lastName: - description: User's last name. - type: string - grade: - description: User's grade from 1 to 5. - maximum: 5 - minimum: 1 - type: integer - picture: - description: User's profile picture absolute URL. - type: string - gender: - description: User's gender. 'O' stands for 'Other'. - enum: - - F - - M - - O - type: string - verifiedIdentity: - description: "true if the identity of this user has been verified by the\ - \ operator or a third party; and the firstName, lastName, birthdate have\ - \ been confirmed as identitical to an official identity proof document.\ - \ Can be left empty if the information is not available." - type: boolean - required: - - alias - - id - - operator - type: object - DriverTrip: - allOf: - - properties: - user: - $ref: '#/components/schemas/User' - car: - $ref: '#/components/schemas/Car' - required: - - user - type: object - type: object - PassengerTripRequest: - example: - departure_address: departure_address - preferences: - music: true - luggageSize: 3 - smoking: true - animals: true - isTalker: true - destination_address: destination_address - departure_longitude: 5.637376656633329 - destination_latitude: 6.027456183070403 - departure_date: 2 - destination_longitude: 1.4658129805029452 - user: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - departure_latitude: 5.962133916683182 - properties: - user: - $ref: '#/components/schemas/User' - destination_address: - type: string - destination_latitude: - format: double - type: number - destination_longitude: - format: double - type: number - departure_address: - type: string - departure_latitude: - format: double - type: number - departure_longitude: - format: double - type: number - departure_date: - description: Departure datetime using a UNIX UTC timestamp in seconds. - type: integer - preferences: - $ref: '#/components/schemas/Preferences' - required: - - departure_address - - departure_date - - departure_latitude - - departure_longitude - - destination_address - - destination_latitude - - destination_longitude - - user - type: object - Preferences: - example: - music: true - luggageSize: 3 - smoking: true - animals: true - isTalker: true - properties: - smoking: - description: "If driver journey, specifies if the driver allows smoking\ - \ in the car." - type: boolean - animals: - description: "If driver journey, specifies if the driver allows animals\ - \ in the car." - type: boolean - music: - description: "If driver journey, specifies if the driver enjoys music in\ - \ the car." - type: boolean - isTalker: - description: "If driver journey, specifies if the driver enjoys talking\ - \ with passengers." - type: boolean - luggageSize: - description: |- - If driver journey, specifies the size of allowed luggages. - From very small (1) to very big (5). - maximum: 5 - minimum: 1 - type: integer - type: object - bookingId: - description: "Booking id is common between both operators, and must be created\ - \ as a [UUID](https://datatracker.ietf.org/doc/html/rfc4122) by whoever initiates\ - \ the booking. Usage of a [4 UUID](https://datatracker.ietf.org/doc/html/rfc4122#section-4.4)\ - \ generation algorithm is advised." - format: uuid - type: string - passengerId: - format: uuid - type: string - driverId: - format: uuid - type: string - JourneySchedule: - properties: - driver_departure_Date: - description: Driver pickup datetime as a UNIX UTC timestamp in seconds. - format: long - type: number - required: - - driver_departure_Date - type: object - BookingRequest: - example: - driverId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - passengerId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - operator: operator - status: null - properties: - id: - description: "Booking id is common between both operators, and must be created\ - \ as a [UUID](https://datatracker.ietf.org/doc/html/rfc4122) by whoever\ - \ initiates the booking. Usage of a [4 UUID](https://datatracker.ietf.org/doc/html/rfc4122#section-4.4)\ - \ generation algorithm is advised." - format: uuid - type: string - passengerId: - format: uuid - type: string - driverId: - format: uuid - type: string - status: - $ref: '#/components/schemas/bookingStatus' - operator: - type: string - required: - - driverId - - id - - operator - - passengerId - - status - type: object - Booking: - example: - passengerDropLng: 5.637376656633329 - distance: 7 - passengerDropLat: 5.962133916683182 - passengerPickupDate: 0.8008281904610115 - passengerDropAddress: passengerDropAddress - passengerPickupAddress: passengerPickupAddress - passengerPickupLng: 1.4658129805029452 - duration: 2 - driver: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - passenger: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - car: - model: model - brand: brand - passengerPickupLat: 6.027456183070403 - price: - amount: 9.301444 - currency: currency - type: FREE - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - status: null - properties: - id: - description: "Booking id is common between both operators, and must be created\ - \ as a [UUID](https://datatracker.ietf.org/doc/html/rfc4122) by whoever\ - \ initiates the booking. Usage of a [4 UUID](https://datatracker.ietf.org/doc/html/rfc4122#section-4.4)\ - \ generation algorithm is advised." - format: uuid - type: string - driver: - $ref: '#/components/schemas/User' - passenger: - $ref: '#/components/schemas/User' - passengerPickupDate: - description: Passenger pickup datetime as a UNIX UTC timestamp in seconds. - format: long - type: number - passengerPickupLat: - description: Latitude of the passenger pick-up point. - format: double - type: number - passengerPickupLng: - description: Longitude of the passenger pick-up point. - format: double - type: number - passengerDropLat: - description: Latitude of the passenger drop-off point. - format: double - type: number - passengerDropLng: - description: Longitude of the passenger drop-off point. - format: double - type: number - passengerPickupAddress: - description: String representing the pickup-up address. - type: string - passengerDropAddress: - description: String representing the drop-off address. - type: string - status: - $ref: '#/components/schemas/bookingStatus' - duration: - description: Carpooling duration in seconds. - type: integer - distance: - description: | - Carpooling distance in meters. - type: integer - price: - $ref: '#/components/schemas/Price' - car: - $ref: '#/components/schemas/Car' - required: - - driver - - id - - passenger - - passengerDropLat - - passengerDropLng - - passengerPickupDate - - passengerPickupLat - - passengerPickupLng - - price - - status - type: object - bookingStatus: - default: WAITING_DRIVER_CONFIRMATION - description: Status of the booking. - enum: - - WAITING_DRIVER_CONFIRMATION - - WAITING_PASSENGER_CONFIRMATION - - CONFIRMED - - CANCELLED - - COMPLETED_PENDING_VALIDATION - - VALIDATED - type: string - DriverRegularAvailabilitiesRequest: - example: - preferences: - music: true - luggageSize: 3 - smoking: true - animals: true - isTalker: true - address: address - car: - model: model - brand: brand - availabilities: - - dayOfWeek: MON - startTime: startTime - endTime: endTime - - dayOfWeek: MON - startTime: startTime - endTime: endTime - latitude: 0.8008281904610115 - radius: 1 - user: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - longitude: 6.027456183070403 - properties: - address: - description: The address or location description. - type: string - latitude: - description: The latitude coordinate of the location. - format: double - type: number - longitude: - description: The longitude coordinate of the location. - format: double - type: number - radius: - description: The radius around the location. - format: int32 - type: integer - availabilities: - items: - $ref: '#/components/schemas/RegularAvailabilitySlot' - type: array - user: - $ref: '#/components/schemas/User' - preferences: - $ref: '#/components/schemas/Preferences' - car: - $ref: '#/components/schemas/Car' - required: - - address - - availabilities - - latitude - - longitude - - radius - - user - type: object - DriverPunctualAvailabilitiesRequest: - example: - preferences: - music: true - luggageSize: 3 - smoking: true - animals: true - isTalker: true - address: address - car: - model: model - brand: brand - availabilities: - - date: 5 - startTime: startTime - endTime: endTime - - date: 5 - startTime: startTime - endTime: endTime - latitude: 0.8008281904610115 - radius: 1 - user: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - longitude: 6.027456183070403 - properties: - address: - description: The address or location description. - type: string - latitude: - description: The latitude coordinate of the location. - format: double - type: number - longitude: - description: The longitude coordinate of the location. - format: double - type: number - radius: - description: The radius around the location. - format: int32 - type: integer - availabilities: - items: - $ref: '#/components/schemas/PunctualAvailabilitySlot' - type: array - user: - $ref: '#/components/schemas/User' - preferences: - $ref: '#/components/schemas/Preferences' - car: - $ref: '#/components/schemas/Car' - required: - - address - - availabilities - - latitude - - longitude - - radius - - user - type: object - RegularAvailabilitySlot: - example: - dayOfWeek: MON - startTime: startTime - endTime: endTime - properties: - dayOfWeek: - description: Day of the week for regular scheduling. - enum: - - MON - - TUE - - WED - - THU - - FRI - - SAT - - SUN - type: string - startTime: - description: Start time for regular scheduling (RFC3339 partial-time). - format: partial-time - type: string - endTime: - description: End time for regular scheduling (RFC3339 partial-time). - format: partial-time - type: string - required: - - dayOfWeek - - endTime - - startTime - type: object - PunctualAvailabilitySlot: - example: - date: 5 - startTime: startTime - endTime: endTime - properties: - date: - description: UNIX UTC timestamp in seconds. - type: integer - startTime: - description: Start time for punctual scheduling (RFC3339 partial-time). - format: partial-time - type: string - endTime: - description: End time for punctual scheduling (RFC3339 partial-time). - format: partial-time - type: string - required: - - date - - endTime - - startTime - type: object - _passenger_post_400_response: - properties: - error: - type: string - type: object - postConnections_request: - properties: - from: - $ref: '#/components/schemas/User' - to: - $ref: '#/components/schemas/User' - message: - description: "Free text content of a message. The message can contain all\ - \ the details (phone number, email, etc.) allowing the recipient to call\ - \ back the sender in order to carpool with him/her." - maxLength: 500 - type: string - recipientCarpoolerType: - default: DRIVER - description: Defines if the recipient of this message is either the driver - or the passenger. - enum: - - DRIVER - - PASSENGER - type: string - driverJourneyId: - description: ID of the Driver's journey to which the message is related - (if any). Unique given the `Driver`'s `operator` property. - maxLength: 255 - minLength: 1 - type: string - passengerJourneyId: - description: ID of the Passenger's journey to which the message is related - (if any). Unique given the `Passenger`'s `operator` property. - maxLength: 255 - minLength: 1 - type: string - bookingId: - allOf: - - $ref: '#/components/schemas/bookingId' - description: ID of the booking to which the message is related (if any) - required: - - from - - message - - recipientCarpoolerType - - to - type: object - getBookings_404_response: - properties: - error: - description: Explain why the request couldn't be processed. - type: string - type: object diff --git a/interoperability/solidarity-api/server/.openapi-generator-ignore b/interoperability/solidarity-api/server/.openapi-generator-ignore deleted file mode 100644 index 7484ee5..0000000 --- a/interoperability/solidarity-api/server/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/interoperability/solidarity-api/server/.openapi-generator/FILES b/interoperability/solidarity-api/server/.openapi-generator/FILES deleted file mode 100644 index 207a723..0000000 --- a/interoperability/solidarity-api/server/.openapi-generator/FILES +++ /dev/null @@ -1,40 +0,0 @@ -.openapi-generator-ignore -Dockerfile -README.md -api/openapi.yaml -go.mod -go/api.go -go/api_bookings_filter.go -go/api_bookings_filter_service.go -go/api_driver_availability_and_schedule.go -go/api_driver_availability_and_schedule_service.go -go/api_interact.go -go/api_interact_service.go -go/api_passenger_trip_request.go -go/api_passenger_trip_request_service.go -go/api_search.go -go/api_search_service.go -go/error.go -go/helpers.go -go/impl.go -go/logger.go -go/model__passenger_post_400_response.go -go/model_booking.go -go/model_booking_request.go -go/model_booking_status.go -go/model_car.go -go/model_driver_journey.go -go/model_driver_punctual_availabilities_request.go -go/model_driver_regular_availabilities_request.go -go/model_driver_trip.go -go/model_get_bookings_404_response.go -go/model_journey_schedule.go -go/model_passenger_trip_request.go -go/model_post_connections_request.go -go/model_preferences.go -go/model_price.go -go/model_punctual_availability_slot.go -go/model_regular_availability_slot.go -go/model_user.go -go/routers.go -main.go diff --git a/interoperability/solidarity-api/server/.openapi-generator/VERSION b/interoperability/solidarity-api/server/.openapi-generator/VERSION deleted file mode 100644 index 73a86b1..0000000 --- a/interoperability/solidarity-api/server/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.0.1 \ No newline at end of file diff --git a/interoperability/solidarity-api/server/api/openapi.yaml b/interoperability/solidarity-api/server/api/openapi.yaml deleted file mode 100644 index 6e477c8..0000000 --- a/interoperability/solidarity-api/server/api/openapi.yaml +++ /dev/null @@ -1,1238 +0,0 @@ -openapi: 3.0.0 -info: - title: Solidarity Mobility API - version: 1.0.0 -servers: -- url: / -paths: - /passenger: - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PassengerTripRequest' - required: true - responses: - "201": - description: Trip Request Created - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Create a Passenger Trip Request - tags: - - Passenger Trip Request - /driver_journeys: - get: - description: Route used to retrieve a collection of punctual planned outward - driver journeys matching the provided criteria. - operationId: getDriverJourneys - parameters: - - description: Latitude of searched departure point. - explode: true - in: query - name: departureLat - required: true - schema: - type: number - style: form - - description: Longitude of searched departure point. - explode: true - in: query - name: departureLng - required: true - schema: - type: number - style: form - - description: Latitude of searched arrival point. - explode: true - in: query - name: arrivalLat - required: true - schema: - type: number - style: form - - description: Longitude of searched arrival point. - explode: true - in: query - name: arrivalLng - required: true - schema: - type: number - style: form - - description: Departure datetime using a UNIX UTC timestamp in seconds. - explode: true - in: query - name: departureDate - required: true - schema: - type: integer - style: form - - description: The operator's FQDN. - explode: true - in: query - name: operator - required: true - schema: - type: string - style: form - responses: - "200": - content: - application/json: - schema: - items: - $ref: '#/components/schemas/DriverJourney' - title: DriverJourneys - type: array - description: Ok. Request processed successfully. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Search for matching punctual planned outward driver journeys. - tags: - - Search - /driver_regular_availabilities: - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DriverRegularAvailabilitiesRequest' - required: true - responses: - "201": - description: Regular driver availabilities set successfully. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Set Regular Driver Availabilities - tags: - - Driver Availability and Schedule - /driver_punctual_availabilities: - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DriverPunctualAvailabilitiesRequest' - required: true - responses: - "201": - description: Punctual driver availabilities set successfully. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Set Punctual Driver Availabilities - tags: - - Driver Availability and Schedule - /messages: - post: - description: Route used to allow a user to connect back to the owner of a retrieved - journey through a texte message. - operationId: postConnections - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/postConnections_request' - responses: - "201": - description: Successful operation. - "404": - description: The targeted journey or user no more exists. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Send a message to the owner of a retrieved journey. - tags: - - Interact - /bookings: - get: - description: "Route used to filter and retrieve bookings based on the specified\ - \ status, type, and ID." - operationId: filterBookingsByStatus - parameters: - - description: The operator's FQDN. - explode: true - in: query - name: operator - required: true - schema: - type: string - style: form - - description: The status of the bookings to filter. - explode: true - in: query - name: status - required: true - schema: - enum: - - WAITING_DRIVER_CONFIRMATION - - WAITING_PASSENGER_CONFIRMATION - - CONFIRMED - - CANCELLED - - COMPLETED_PENDING_VALIDATION - - VALIDATED - type: string - style: form - - explode: true - in: query - name: filterType - required: true - schema: - enum: - - driver - - passenger - type: string - style: form - - description: The ID (UUID) used. - explode: true - in: query - name: Id - required: true - schema: - format: uuid - type: string - style: form - responses: - "200": - content: - application/json: - schema: - items: - $ref: '#/components/schemas/Booking' - type: array - description: "Successful operation. Bookings matching the specified status,\ - \ type, and ID." - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: "No bookings found for the specified status, type, and ID." - summary: "Filter and retrieve bookings by status, type, and ID." - tags: - - Bookings Filter - post: - description: "Route used to synchronize a Booking request initiated by a platform\ - \ to the second platform involved in the shared punctual outward journey.\ - \ While posting a new Booking, its status must always be set first as `status=WAITING_CONFIRMATION`." - operationId: postBookings - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/BookingRequest' - responses: - "201": - content: - application/json: - schema: - $ref: '#/components/schemas/Booking' - description: Successful operation. A new Booking has been created. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - summary: Create a punctual outward Booking request. - tags: - - Interact - /bookings/{bookingId}: - get: - description: "Route used to retrieve the details of an existing Booking request.\ - \ Can only be used by the operator having created the Booking request. This\ - \ route is provided to check if the Booking object state is similar between\ - \ two operators, but its usage should be required to handle the full use case\ - \ of a booking." - operationId: getBookings - parameters: - - description: The operator's FQDN. - explode: true - in: query - name: operator - required: true - schema: - type: string - style: form - - explode: false - in: path - name: bookingId - required: true - schema: - $ref: '#/components/schemas/bookingId' - style: simple - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/Booking' - description: Successful operation. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/getBookings_404_response' - description: "This Booking object no more exists. Error code can be among\ - \ `missing_journey, missing_booking, missing_user` ." - summary: Retrieves an existing Booking request. - tags: - - Interact - patch: - description: "Route used to update the status of an existing Booking request.\ - \ Should be used usually just to confirm, cancel, etc. an existing Booking." - operationId: patchBookings - parameters: - - description: The operator's FQDN. - explode: true - in: query - name: operator - required: true - schema: - type: string - style: form - - explode: false - in: path - name: bookingId - required: true - schema: - $ref: '#/components/schemas/bookingId' - style: simple - - description: New status of the Booking. - explode: true - in: query - name: status - required: true - schema: - $ref: '#/components/schemas/bookingStatus' - style: form - - description: Free text content of a message. The message can contain explanations - on the status change. - explode: true - in: query - name: message - required: false - schema: - maxLength: 500 - type: string - style: form - responses: - "200": - description: Successful operation. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - "401": - description: Unauthorized. You must authenticate. - "429": - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - "500": - description: Internal Server Error. Please try again later. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/getBookings_404_response' - description: "The targeted journey, booking or user no more exists. Error\ - \ code can be among `missing_journey, missing_booking, missing_user`\ - \ ." - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/getBookings_404_response' - description: Conflict. This booking has already the new status requested. - Error code is `status_already_set`. - summary: Updates status of an existing Booking request. - tags: - - Interact -components: - parameters: - departureLat: - description: Latitude of searched departure point. - explode: true - in: query - name: departureLat - required: true - schema: - type: number - style: form - departureLng: - description: Longitude of searched departure point. - explode: true - in: query - name: departureLng - required: true - schema: - type: number - style: form - arrivalLat: - description: Latitude of searched arrival point. - explode: true - in: query - name: arrivalLat - required: true - schema: - type: number - style: form - arrivalLng: - description: Longitude of searched arrival point. - explode: true - in: query - name: arrivalLng - required: true - schema: - type: number - style: form - departureDate: - description: Departure datetime using a UNIX UTC timestamp in seconds. - explode: true - in: query - name: departureDate - required: true - schema: - type: integer - style: form - departureTimeOfDay: - description: "Departure time of day represented as [RFC3339 partial-time](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6)." - example: 07:30:00 - explode: true - in: query - name: departureTimeOfDay - required: true - schema: - format: partial-time - type: string - style: form - timeDelta: - description: Time margin in seconds. The retrieved journeys must match the given - time parameters within a +`timeDelta` / -`timeDelta` interval . - explode: true - in: query - name: timeDelta - required: false - schema: - default: 900 - type: integer - style: form - minDepartureDate: - description: Minimum date of departure for the returned journeys. Datetime using - a UNIX UTC timestamp in seconds. - explode: true - in: query - name: minDepartureDate - required: false - schema: - type: integer - style: form - maxDepartureDate: - description: Maximum date of departure for the returned journeys. Datetime using - a UNIX UTC timestamp in seconds. - explode: true - in: query - name: maxDepartureDate - required: false - schema: - type: integer - style: form - departureRadius: - description: Search radius in kilometers around the departure point. - explode: true - in: query - name: departureRadius - required: false - schema: - default: 1.0 - type: number - style: form - arrivalRadius: - description: Search radius in kilometers around the arrival point. - explode: true - in: query - name: arrivalRadius - required: false - schema: - default: 1.0 - type: number - style: form - count: - description: "Maximum number of returned results. If missing, all matching results\ - \ are returned." - explode: true - in: query - name: count - required: false - schema: - type: integer - style: form - responses: - BadRequest: - content: - application/json: - schema: - $ref: '#/components/schemas/_passenger_post_400_response' - description: Bad Request. See error message. - Unauthorized: - description: Unauthorized. You must authenticate. - TooManyRequests: - description: Too Many Requests. Please slow down. - headers: - Retry-After: - explode: false - schema: - type: integer - style: simple - InternalServerError: - description: Internal Server Error. Please try again later. - schemas: - DriverJourney: - allOf: - - $ref: '#/components/schemas/DriverTrip' - - $ref: '#/components/schemas/JourneySchedule' - - properties: - price: - $ref: '#/components/schemas/Price' - type: object - type: object - Price: - example: - amount: 9.301444 - currency: currency - type: FREE - properties: - type: - description: |- - Either « FREE », « PAYING » or « UNKNOWN ». « UNKNOWN » is given - when it should be « PAYING » but we cannot set the price yet. - enum: - - FREE - - PAYING - - UNKNOWN - type: string - amount: - description: "Carpooling passenger cost estimate. In the case of integrated\ - \ booking by API, amount expected by the carpooling operator." - format: float - type: number - currency: - description: ISO 4217 code representing the currency of the price. - type: string - type: object - Car: - example: - model: model - brand: brand - properties: - model: - description: Model of the car. - type: string - brand: - description: Brand of the car. - type: string - type: object - User: - example: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - properties: - id: - description: User's identifier. It MUST be unique for a given `operator`. - type: string - operator: - description: The operator identifier. MUST be a Fully Qualified Domain Name - (example carpool.mycity.com) owned by the operator or a Partially Qualified - Domain Name (example operator.org) owned and exclusively operated by the - operator. Operators SHOULD always send the same value. - type: string - alias: - description: User's alias. - type: string - firstName: - description: User's first name. - type: string - lastName: - description: User's last name. - type: string - grade: - description: User's grade from 1 to 5. - maximum: 5 - minimum: 1 - type: integer - picture: - description: User's profile picture absolute URL. - type: string - gender: - description: User's gender. 'O' stands for 'Other'. - enum: - - F - - M - - O - type: string - verifiedIdentity: - description: "true if the identity of this user has been verified by the\ - \ operator or a third party; and the firstName, lastName, birthdate have\ - \ been confirmed as identitical to an official identity proof document.\ - \ Can be left empty if the information is not available." - type: boolean - required: - - alias - - id - - operator - type: object - DriverTrip: - allOf: - - properties: - user: - $ref: '#/components/schemas/User' - car: - $ref: '#/components/schemas/Car' - required: - - user - type: object - type: object - PassengerTripRequest: - example: - departure_address: departure_address - preferences: - music: true - luggageSize: 3 - smoking: true - animals: true - isTalker: true - destination_address: destination_address - departure_longitude: 5.637376656633329 - destination_latitude: 6.027456183070403 - departure_date: 2 - destination_longitude: 1.4658129805029452 - user: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - departure_latitude: 5.962133916683182 - properties: - user: - $ref: '#/components/schemas/User' - destination_address: - type: string - destination_latitude: - format: double - type: number - destination_longitude: - format: double - type: number - departure_address: - type: string - departure_latitude: - format: double - type: number - departure_longitude: - format: double - type: number - departure_date: - description: Departure datetime using a UNIX UTC timestamp in seconds. - type: integer - preferences: - $ref: '#/components/schemas/Preferences' - required: - - departure_address - - departure_date - - departure_latitude - - departure_longitude - - destination_address - - destination_latitude - - destination_longitude - - user - type: object - Preferences: - example: - music: true - luggageSize: 3 - smoking: true - animals: true - isTalker: true - properties: - smoking: - description: "If driver journey, specifies if the driver allows smoking\ - \ in the car." - type: boolean - animals: - description: "If driver journey, specifies if the driver allows animals\ - \ in the car." - type: boolean - music: - description: "If driver journey, specifies if the driver enjoys music in\ - \ the car." - type: boolean - isTalker: - description: "If driver journey, specifies if the driver enjoys talking\ - \ with passengers." - type: boolean - luggageSize: - description: |- - If driver journey, specifies the size of allowed luggages. - From very small (1) to very big (5). - maximum: 5 - minimum: 1 - type: integer - type: object - bookingId: - description: "Booking id is common between both operators, and must be created\ - \ as a [UUID](https://datatracker.ietf.org/doc/html/rfc4122) by whoever initiates\ - \ the booking. Usage of a [4 UUID](https://datatracker.ietf.org/doc/html/rfc4122#section-4.4)\ - \ generation algorithm is advised." - format: uuid - type: string - passengerId: - format: uuid - type: string - driverId: - format: uuid - type: string - JourneySchedule: - properties: - passengerPickupDate: - description: Passenger pickup datetime as a UNIX UTC timestamp in seconds. - format: long - type: number - driverDepartureDate: - description: Driver departure datetime as a UNIX UTC timestamp in seconds. - format: long - type: number - type: - description: Type of journey. A dynamic journey is happening in real time. - enum: - - PLANNED - - DYNAMIC - - LINE - type: string - required: - - passengerPickupDate - - type - type: object - BookingRequest: - example: - driverId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - passengerId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - operator: operator - status: null - properties: - id: - description: "Booking id is common between both operators, and must be created\ - \ as a [UUID](https://datatracker.ietf.org/doc/html/rfc4122) by whoever\ - \ initiates the booking. Usage of a [4 UUID](https://datatracker.ietf.org/doc/html/rfc4122#section-4.4)\ - \ generation algorithm is advised." - format: uuid - type: string - passengerId: - format: uuid - type: string - driverId: - format: uuid - type: string - status: - $ref: '#/components/schemas/bookingStatus' - operator: - type: string - required: - - driverId - - id - - operator - - passengerId - - status - type: object - Booking: - example: - passengerDropLng: 5.637376656633329 - distance: 7 - passengerDropLat: 5.962133916683182 - passengerPickupDate: 0.8008281904610115 - passengerDropAddress: passengerDropAddress - passengerPickupAddress: passengerPickupAddress - passengerPickupLng: 1.4658129805029452 - duration: 2 - driver: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - passenger: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - car: - model: model - brand: brand - passengerPickupLat: 6.027456183070403 - price: - amount: 9.301444 - currency: currency - type: FREE - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - status: null - properties: - id: - description: "Booking id is common between both operators, and must be created\ - \ as a [UUID](https://datatracker.ietf.org/doc/html/rfc4122) by whoever\ - \ initiates the booking. Usage of a [4 UUID](https://datatracker.ietf.org/doc/html/rfc4122#section-4.4)\ - \ generation algorithm is advised." - format: uuid - type: string - driver: - $ref: '#/components/schemas/User' - passenger: - $ref: '#/components/schemas/User' - passengerPickupDate: - description: Passenger pickup datetime as a UNIX UTC timestamp in seconds. - format: long - type: number - passengerPickupLat: - description: Latitude of the passenger pick-up point. - format: double - type: number - passengerPickupLng: - description: Longitude of the passenger pick-up point. - format: double - type: number - passengerDropLat: - description: Latitude of the passenger drop-off point. - format: double - type: number - passengerDropLng: - description: Longitude of the passenger drop-off point. - format: double - type: number - passengerPickupAddress: - description: String representing the pickup-up address. - type: string - passengerDropAddress: - description: String representing the drop-off address. - type: string - status: - $ref: '#/components/schemas/bookingStatus' - duration: - description: Carpooling duration in seconds. - type: integer - distance: - description: | - Carpooling distance in meters. - type: integer - price: - $ref: '#/components/schemas/Price' - car: - $ref: '#/components/schemas/Car' - required: - - driver - - id - - passenger - - passengerDropLat - - passengerDropLng - - passengerPickupDate - - passengerPickupLat - - passengerPickupLng - - price - - status - type: object - bookingStatus: - default: WAITING_DRIVER_CONFIRMATION - description: Status of the booking. - enum: - - WAITING_DRIVER_CONFIRMATION - - WAITING_PASSENGER_CONFIRMATION - - CONFIRMED - - CANCELLED - - COMPLETED_PENDING_VALIDATION - - VALIDATED - type: string - DriverRegularAvailabilitiesRequest: - example: - preferences: - music: true - luggageSize: 3 - smoking: true - animals: true - isTalker: true - address: address - car: - model: model - brand: brand - availabilities: - - dayOfWeek: MON - startTime: startTime - endTime: endTime - - dayOfWeek: MON - startTime: startTime - endTime: endTime - latitude: 0.8008281904610115 - radius: 1 - user: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - longitude: 6.027456183070403 - properties: - address: - description: The address or location description. - type: string - latitude: - description: The latitude coordinate of the location. - format: double - type: number - longitude: - description: The longitude coordinate of the location. - format: double - type: number - radius: - description: The radius around the location. - format: int32 - type: integer - availabilities: - items: - $ref: '#/components/schemas/RegularAvailabilitySlot' - type: array - user: - $ref: '#/components/schemas/User' - preferences: - $ref: '#/components/schemas/Preferences' - car: - $ref: '#/components/schemas/Car' - required: - - address - - availabilities - - latitude - - longitude - - radius - - user - type: object - DriverPunctualAvailabilitiesRequest: - example: - preferences: - music: true - luggageSize: 3 - smoking: true - animals: true - isTalker: true - address: address - car: - model: model - brand: brand - availabilities: - - date: 5 - startTime: startTime - endTime: endTime - - date: 5 - startTime: startTime - endTime: endTime - latitude: 0.8008281904610115 - radius: 1 - user: - firstName: firstName - lastName: lastName - gender: F - grade: 1 - alias: alias - id: id - verifiedIdentity: true - operator: operator - picture: picture - longitude: 6.027456183070403 - properties: - address: - description: The address or location description. - type: string - latitude: - description: The latitude coordinate of the location. - format: double - type: number - longitude: - description: The longitude coordinate of the location. - format: double - type: number - radius: - description: The radius around the location. - format: int32 - type: integer - availabilities: - items: - $ref: '#/components/schemas/PunctualAvailabilitySlot' - type: array - user: - $ref: '#/components/schemas/User' - preferences: - $ref: '#/components/schemas/Preferences' - car: - $ref: '#/components/schemas/Car' - required: - - address - - availabilities - - latitude - - longitude - - radius - - user - type: object - RegularAvailabilitySlot: - example: - dayOfWeek: MON - startTime: startTime - endTime: endTime - properties: - dayOfWeek: - description: Day of the week for regular scheduling. - enum: - - MON - - TUE - - WED - - THU - - FRI - - SAT - - SUN - type: string - startTime: - description: Start time for regular scheduling (RFC3339 partial-time). - format: partial-time - type: string - endTime: - description: End time for regular scheduling (RFC3339 partial-time). - format: partial-time - type: string - required: - - dayOfWeek - - endTime - - startTime - type: object - PunctualAvailabilitySlot: - example: - date: 5 - startTime: startTime - endTime: endTime - properties: - date: - description: UNIX UTC timestamp in seconds. - type: integer - startTime: - description: Start time for punctual scheduling (RFC3339 partial-time). - format: partial-time - type: string - endTime: - description: End time for punctual scheduling (RFC3339 partial-time). - format: partial-time - type: string - required: - - date - - endTime - - startTime - type: object - _passenger_post_400_response: - properties: - error: - type: string - type: object - postConnections_request: - properties: - from: - $ref: '#/components/schemas/User' - to: - $ref: '#/components/schemas/User' - message: - description: "Free text content of a message. The message can contain all\ - \ the details (phone number, email, etc.) allowing the recipient to call\ - \ back the sender in order to carpool with him/her." - maxLength: 500 - type: string - recipientCarpoolerType: - default: DRIVER - description: Defines if the recipient of this message is either the driver - or the passenger. - enum: - - DRIVER - - PASSENGER - type: string - driverJourneyId: - description: ID of the Driver's journey to which the message is related - (if any). Unique given the `Driver`'s `operator` property. - maxLength: 255 - minLength: 1 - type: string - passengerJourneyId: - description: ID of the Passenger's journey to which the message is related - (if any). Unique given the `Passenger`'s `operator` property. - maxLength: 255 - minLength: 1 - type: string - bookingId: - allOf: - - $ref: '#/components/schemas/bookingId' - description: ID of the booking to which the message is related (if any) - required: - - from - - message - - recipientCarpoolerType - - to - type: object - getBookings_404_response: - properties: - error: - description: Explain why the request couldn't be processed. - type: string - type: object diff --git a/interoperability/solidarity-api/server/openapi/api_bookings_filter_service.go b/interoperability/solidarity-api/server/openapi/api_bookings_filter_service.go index 42fd44f..04e10a1 100644 --- a/interoperability/solidarity-api/server/openapi/api_bookings_filter_service.go +++ b/interoperability/solidarity-api/server/openapi/api_bookings_filter_service.go @@ -44,7 +44,7 @@ func (s *BookingsFilterAPIService) FilterBookingsByStatus(ctx context.Context, o if err != nil { fmt.Println(err) if strings.Contains(err.Error(), " no rows in result set") { - return Response(http.StatusBadRequest, "ID not found in the database"), nil + return Response(http.StatusBadRequest, "no related data recheck your parameters"), nil } else { return Response(http.StatusInternalServerError, nil), nil } diff --git a/interoperability/solidarity-api/server/openapi/api_driver_availability_and_schedule_service.go b/interoperability/solidarity-api/server/openapi/api_driver_availability_and_schedule_service.go index 5ae7270..7f448fa 100644 --- a/interoperability/solidarity-api/server/openapi/api_driver_availability_and_schedule_service.go +++ b/interoperability/solidarity-api/server/openapi/api_driver_availability_and_schedule_service.go @@ -19,6 +19,8 @@ import ( "solidarity-service/handler" "solidarity-service/internal" "solidarity-service/storage" + "solidarity-service/utils" + "strings" ) // DriverAvailabilityAndScheduleAPIService is a service that implements the logic for the DriverAvailabilityAndScheduleAPIServicer @@ -77,6 +79,9 @@ func (s *DriverAvailabilityAndScheduleAPIService) DriverPunctualAvailabilitiesPo driver.Car.Model = driverPunctualAvailabilitiesRequest.Car.Model err := s.storage.CreateDriver(driver) if err != nil { + if strings.Contains(err.Error(), utils.SQL_DUPLICATE) { + return Response(http.StatusBadRequest, "ID already in use"), nil + } return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error") } else { return Response(201, "Punctual driver availabilities set successfully"), nil @@ -120,6 +125,9 @@ func (s *DriverAvailabilityAndScheduleAPIService) DriverRegularAvailabilitiesPos driver.Car.Model = driverRegularAvailabilitiesRequest.Car.Model err := s.storage.CreateDriver(driver) if err != nil { + if strings.Contains(err.Error(), utils.SQL_DUPLICATE) { + return Response(http.StatusBadRequest, "ID already in use"), nil + } return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error") } else { return Response(201, "Regular driver availabilities set successfully"), nil diff --git a/interoperability/solidarity-api/server/openapi/api_interact_service.go b/interoperability/solidarity-api/server/openapi/api_interact_service.go index 55dcac2..f455218 100644 --- a/interoperability/solidarity-api/server/openapi/api_interact_service.go +++ b/interoperability/solidarity-api/server/openapi/api_interact_service.go @@ -18,6 +18,7 @@ import ( "solidarity-service/handler" "solidarity-service/internal" "solidarity-service/storage" + "solidarity-service/utils" "strings" ) @@ -44,7 +45,7 @@ func (s *InteractAPIService) GetBookings(ctx context.Context, operator string, b booking, err := s.storage.GetBooking(bookingId) if err != nil { if strings.Contains(err.Error(), " no rows in result set") { - return Response(http.StatusBadRequest, "ID not found in the database"), nil + return Response(http.StatusBadRequest, "no related data recheck your parameters"), nil } else { return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error") } @@ -114,7 +115,7 @@ func (s *InteractAPIService) PatchBookings(ctx context.Context, operator string, fmt.Println(err) if err != nil { if strings.Contains(err.Error(), " no rows in result set") { - return Response(http.StatusBadRequest, "ID not found in the database"), nil + return Response(http.StatusBadRequest, "no related data recheck your params"), nil } return Response(http.StatusInternalServerError, nil), nil } @@ -131,6 +132,9 @@ func (s *InteractAPIService) PostBookings(ctx context.Context, bookingRequest Bo booking.Operator = bookingRequest.Operator err := s.storage.CreateBooking(booking) if err != nil { + if strings.Contains(err.Error(), utils.SQL_DUPLICATE) { + return Response(http.StatusBadRequest, "ID already in use"), nil + } return Response(http.StatusInternalServerError, nil), errors.New("PostBookings internal server error") } passenger, err := s.storage.GetPassenger(booking.Passenger_id) diff --git a/interoperability/solidarity-api/server/openapi/api_passenger_trip_request_service.go b/interoperability/solidarity-api/server/openapi/api_passenger_trip_request_service.go index becc610..f7408c2 100644 --- a/interoperability/solidarity-api/server/openapi/api_passenger_trip_request_service.go +++ b/interoperability/solidarity-api/server/openapi/api_passenger_trip_request_service.go @@ -19,6 +19,8 @@ import ( "solidarity-service/handler" "solidarity-service/internal" "solidarity-service/storage" + "solidarity-service/utils" + "strings" ) // PassengerTripRequestAPIService is a service that implements the logic for the PassengerTripRequestAPIServicer @@ -73,6 +75,9 @@ func (s *PassengerTripRequestAPIService) PassengerPost(ctx context.Context, pass passenger.Preferences.Music = passengerTripRequest.Preferences.Music err := s.storage.CreatePassenger(passenger) if err != nil { + if strings.Contains(err.Error(), utils.SQL_DUPLICATE) { + return Response(http.StatusBadRequest, "ID already in use"), nil + } return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error") } else { return Response(201, "Trip request created"), nil diff --git a/interoperability/solidarity-api/server/solidarity_api.go b/interoperability/solidarity-api/server/solidarity_api.go index ae1a6d7..e604c53 100644 --- a/interoperability/solidarity-api/server/solidarity_api.go +++ b/interoperability/solidarity-api/server/solidarity_api.go @@ -36,5 +36,5 @@ func Run(cfg *viper.Viper, handler *handler.SolidarityServiceHandler, storage st router := openapi.NewRouter(BookingsFilterAPIController, DriverAvailabilityAndScheduleAPIController, InteractAPIController, PassengerTripRequestAPIController, SearchAPIController) - log.Fatal(http.ListenAndServe(":9999", router)) + log.Fatal(http.ListenAndServe(cfg.GetString("services.solidarity-api.address"), router)) } diff --git a/main.go b/main.go index 42cff29..0c8e476 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,6 @@ func main() { routing_service_type = cfg.GetString("routing.type") valhalla_base_url = cfg.GetString("routing.valhalla.base_url") ) - log.Info().Msg("Running " + service_name) storageService, err := storage.NewStorage(cfg) if err != nil { @@ -50,7 +49,7 @@ func main() { } if solidarity_api_enable { - log.Info().Msg("Running OCSS REST API") + log.Info().Msg("Running Interoperability REST API") go api.Run(cfg, handler, storageService) } diff --git a/servers/grpc/server/services.go b/servers/grpc/server/services.go index 795e1dd..7da5ea0 100644 --- a/servers/grpc/server/services.go +++ b/servers/grpc/server/services.go @@ -8,6 +8,8 @@ import ( "github.com/paulmach/orb/geojson" "solidarity-service/internal" "solidarity-service/servers/grpc/proto" + "solidarity-service/utils" + "strings" ) func (s *SolidarityServiceServerImpl) SetDriverRegularAvailabilities(ctx context.Context, req *proto.DriverRegularAvailabilities) (resp *proto.DriverAvailabilitiesResponse, err error) { @@ -76,6 +78,9 @@ func (s *SolidarityServiceServerImpl) SetDriverRegularAvailabilities(ctx context err = s.Handler.SetDriverAvailabilities(context.Background(), driver) if err != nil { + if strings.Contains(err.Error(), utils.SQL_DUPLICATE) { + err = errors.New("ID is already used") + } return &proto.DriverAvailabilitiesResponse{ Success: false, }, err @@ -151,6 +156,9 @@ func (s *SolidarityServiceServerImpl) SetDriverPunctualAvailabilities(ctx contex err = s.Handler.SetDriverAvailabilities(context.Background(), driver) if err != nil { + if strings.Contains(err.Error(), utils.SQL_DUPLICATE) { + err = errors.New("ID is already used") + } return &proto.DriverAvailabilitiesResponse{ Success: false, }, err @@ -172,6 +180,9 @@ func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *pr } passenger, driver, err := s.Handler.CreateBooking(context.Background(), bookingRequest) if err != nil { + if strings.Contains(err.Error(), utils.SQL_DUPLICATE) { + err = errors.New("ID is already used") + } return nil, err } duration, err := s.Handler.CalculateDurationBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address) @@ -180,7 +191,9 @@ func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *pr } distance := s.Handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address) priceType := proto.PriceType_FREE - resp = &proto.CreateBookingResponse{} + resp = &proto.CreateBookingResponse{ + Booking: &proto.Booking{}, + } resp.Booking = &proto.Booking{ Id: bookingRequest.ID, Driver: &proto.User{ @@ -239,6 +252,9 @@ func (s *SolidarityServiceServerImpl) UpdateBooking(ctx context.Context, req *pr bookingStatus := internal.BookingStatus(req.Status.String()) err = s.Handler.UpdateBooking(context.Background(), req.BookingId, bookingStatus) if err != nil { + if strings.Contains(err.Error(), utils.SQL_NO_ROWS) { + err = errors.New("invalid ID") + } return &proto.UpdateBookingResponse{ Success: false, }, err @@ -254,13 +270,18 @@ func (s *SolidarityServiceServerImpl) GetBooking(ctx context.Context, req *proto } booking, passenger, driver, err := s.Handler.GetBooking(context.Background(), req.BookingId) if err != nil { + if strings.Contains(err.Error(), utils.SQL_NO_ROWS) { + err = errors.New("invalid ID") + } return nil, err } duration, err := s.Handler.CalculateDurationBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address) if err != nil { duration = 0 } - resp = &proto.GetBookingResponse{} + resp = &proto.GetBookingResponse{ + Booking: &proto.Booking{}, + } distance := s.Handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address) priceType := proto.PriceType_FREE resp.Booking = &proto.Booking{ @@ -319,9 +340,14 @@ func (s *SolidarityServiceServerImpl) GetBookingsByStatus(ctx context.Context, r } bookings, err := s.Handler.GetBookingsByStatus(context.Background(), req.Status.String(), req.Type.String(), req.UserId) if err != nil { + if strings.Contains(err.Error(), utils.SQL_NO_ROWS) { + err = errors.New("invalid ID") + } return nil, err } - resp = &proto.GetBookingsByStatusResponse{} + resp = &proto.GetBookingsByStatusResponse{ + Booking: []*proto.Booking{}, + } responses := []*proto.Booking{} for _, v := range bookings { passenger, err := s.Handler.GetPassenger(context.Background(), v.Passenger.ID) @@ -404,7 +430,9 @@ func (s *SolidarityServiceServerImpl) DriverJourneys(ctx context.Context, req *p if err != nil { return nil, err } - resp = &proto.DriverJourneysResponse{} + resp = &proto.DriverJourneysResponse{ + DriverJourneys: []*proto.DriverJourney{}, + } response := []*proto.DriverJourney{} for _, v := range drivers { temp := &proto.DriverJourney{} @@ -536,9 +564,12 @@ func (s *SolidarityServiceServerImpl) SetPassengerTrip(ctx context.Context, req err = s.Handler.SetPassengerTrip(context.Background(), passenger) if err != nil { + if strings.Contains(err.Error(), utils.SQL_DUPLICATE) { + err = errors.New("ID is already used") + } return &proto.PassengerTripResponse{ Success: false, - }, nil + }, err } return &proto.PassengerTripResponse{ Success: true, diff --git a/storage/postgresql.go b/storage/postgresql.go index 49c131e..1e5c084 100644 --- a/storage/postgresql.go +++ b/storage/postgresql.go @@ -80,20 +80,20 @@ func (s PostgresqlStorage) CreatePassenger(passenger internal.Passenger) (err er if err != nil { errMsg := "Postgresql Storage CreatePassenger Error encoding Preferences to JSON" log.Error().Err(err).Msg(errMsg) - return errors.New(errMsg) + return errors.New(errMsg + err.Error()) } departureJSON, err := json.Marshal(passenger.Passenger_departure_address) if err != nil { errMsg := "Postgresql Storage CreatePassenger Error encoding departure Feature to JSON" log.Error().Err(err).Msg(errMsg) - return errors.New(errMsg) + return errors.New(errMsg + err.Error()) } destinationJSON, err := json.Marshal(passenger.Passenger_destination_address) if err != nil { errMsg := "Postgresql Storage CreatePassenger Error converting destination Feature to JSON" log.Error().Err(err).Msg(errMsg) - return errors.New(errMsg) + return errors.New(errMsg + err.Error()) } _, err = s.DbConnection.Exec(fmt.Sprintf("INSERT INTO %s (passenger_id, passenger_departure_route, passenger_destination_route, alias, last_name, first_name, grade, picture, verified_identity, operator, preferences, passenger_pickup_date) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)", s.Tables["passengers"]), passenger.Passenger.ID, @@ -111,7 +111,7 @@ func (s PostgresqlStorage) CreatePassenger(passenger internal.Passenger) (err er if err != nil { errMsg := "Postgresql Storage CreatePassenger Error inserting data into the database" log.Error().Err(err).Msg(errMsg) - return errors.New(errMsg) + return errors.New(errMsg + err.Error()) } return nil } @@ -139,26 +139,26 @@ func (s PostgresqlStorage) GetPassenger(passengerID string) (passenger internal. fmt.Println(err) errMsg := "Postgresql Storage GetPassenger Error querying data from the database" log.Error().Err(err).Msg(errMsg) - return passenger, errors.New(errMsg) + return passenger, errors.New(errMsg + err.Error()) } err = json.Unmarshal(preferencesJSON, &passenger.Preferences) if err != nil { errMsg := "Postgresql Storage GetPassenger Error decoding Preferences from JSON" log.Error().Err(err).Msg(errMsg) - return passenger, errors.New(errMsg) + return passenger, errors.New(errMsg + err.Error()) } passenger.Passenger_destination_address, err = geojson.UnmarshalFeature(destination_address) if err != nil { errMsg := "Postgresql Storage GetPassenger Error decoding Passenger destination route into GeoJSON" log.Error().Err(err).Msg(errMsg) - return passenger, errors.New(errMsg) + return passenger, errors.New(errMsg + err.Error()) } passenger.Passenger_departure_address, err = geojson.UnmarshalFeature(departure_address) if err != nil { errMsg := "Postgresql Storage GetPassenger Error decoding Passenger departure route into GeoJSON" log.Error().Err(err).Msg(errMsg) - return passenger, errors.New(errMsg) + return passenger, errors.New(errMsg + err.Error()) } return passenger, nil } @@ -174,19 +174,19 @@ func (s PostgresqlStorage) CreateDriver(driver internal.Driver) (err error) { if err != nil { errMsg := "Postgresql Storage CreateDriver Error encoding departure Feature to JSON" log.Error().Err(err).Msg(errMsg) - return errors.New(errMsg) + return errors.New(errMsg + err.Error()) } preferencesJSON, err := json.Marshal(driver.Preferences) if err != nil { errMsg := "Postgresql Storage CreateDriver Error encoding Preferences to JSON" - log.Error().Err(err).Msg(errMsg) + log.Error().Err(err).Msg(errMsg + err.Error()) return errors.New(errMsg) } carJSON, err := json.Marshal(driver.Car) if err != nil { errMsg := "Postgresql Storage CreateDriver Error encoding Car to JSON" log.Error().Err(err).Msg(errMsg) - return errors.New(errMsg) + return errors.New(errMsg + err.Error()) } if driver.Driver.Alias == "" || driver.Driver.Operator == "" { errMsg := "Postgresql Storage CreateDriver empty alias or operator FQDN." @@ -209,14 +209,14 @@ func (s PostgresqlStorage) CreateDriver(driver internal.Driver) (err error) { if err != nil { errMsg := "Postgresql Storage CreateDriver error converting Punctual availabilities" log.Error().Msg(errMsg) - return errors.New(errMsg) + return errors.New(errMsg + err.Error()) } case internal.Regular: availabilities, err = json.Marshal(driver.RegularAvailabilities) if err != nil { errMsg := "Postgresql Storage CreateDriver error converting Regular availabilities" log.Error().Msg(errMsg) - return errors.New(errMsg) + return errors.New(errMsg + err.Error()) } } _, err = s.DbConnection.Exec(fmt.Sprintf("INSERT INTO %s (driver_id,driver_departure_route,driver_radius,last_name,first_name,grade,alias,picture,verified_identity,preferences,availabilities_type,availabilities,operator , car) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)", s.Tables["drivers"]), @@ -239,7 +239,7 @@ func (s PostgresqlStorage) CreateDriver(driver internal.Driver) (err error) { fmt.Println(err) errMsg := "Postgresql Storage CreateDriver Error inserting data into the database" log.Error().Err(err).Msg(errMsg) - return errors.New(errMsg) + return errors.New(errMsg + err.Error()) } return nil } @@ -269,26 +269,26 @@ func (s PostgresqlStorage) GetDriver(driverID string) (driver internal.Driver, e if err != nil { errMsg := "Postgresql Storage GetDriver Error querying data from the database" log.Error().Err(err).Msg(errMsg) - return driver, errors.New(errMsg) + return driver, errors.New(errMsg + err.Error()) } err = json.Unmarshal(preferencesJSON, &driver.Preferences) if err != nil { errMsg := "Postgresql Storage GetDriver Error decoding Preferences from JSON" log.Error().Err(err).Msg(errMsg) - return driver, errors.New(errMsg) + return driver, errors.New(errMsg + err.Error()) } err = json.Unmarshal(carJSON, &driver.Car) if err != nil { errMsg := "Postgresql Storage GetDriver Error decoding Car from JSON" log.Error().Err(err).Msg(errMsg) - return driver, errors.New(errMsg) + return driver, errors.New(errMsg + err.Error()) } driver.Driver_departure_address, err = geojson.UnmarshalFeature(departureAddress) if err != nil { errMsg := "Postgresql Storage GetDriver Error decoding Driver departure route into GeoJSON" log.Error().Err(err).Msg(errMsg) - return driver, errors.New(errMsg) + return driver, errors.New(errMsg + err.Error()) } switch driver.AvailabilitiesType { @@ -297,19 +297,19 @@ func (s PostgresqlStorage) GetDriver(driverID string) (driver internal.Driver, e if err != nil { errMsg := "Postgresql Storage GetDriver Error decoding Regular Availabilities from JSON" log.Error().Err(err).Msg(errMsg) - return driver, errors.New(errMsg) + return driver, errors.New(errMsg + err.Error()) } case internal.Punctual: err = json.Unmarshal(availabilitiesJSON, &driver.PunctualAvailabilities) if err != nil { errMsg := "Postgresql Storage GetDriver Error decoding Punctual Availabilities from JSON" log.Error().Err(err).Msg(errMsg) - return driver, errors.New(errMsg) + return driver, errors.New(errMsg + err.Error()) } default: errMsg := "Postgresql Storage GetDriver Invalid Availabilities Type" log.Error().Msg(errMsg) - return driver, errors.New(errMsg) + return driver, errors.New(errMsg + err.Error()) } return driver, nil @@ -345,7 +345,7 @@ func (s PostgresqlStorage) CreateBooking(booking internal.BookingRequest) (err e if err != nil { errMsg := "Postgresql Storage CreateBooking Error inserting data into the database" log.Error().Err(err).Msg(errMsg) - return errors.New(errMsg) + return errors.New(errMsg + err.Error()) } return nil } @@ -358,7 +358,7 @@ func (s PostgresqlStorage) GetBooking(id string) (booking internal.Booking, err &booking.Driver.ID, &booking.Status, ) - fmt.Println(err) + if err != nil { errMsg := "Postgresql Storage GetBooking Error getting booking" log.Error().Err(err).Msg(errMsg) @@ -398,7 +398,7 @@ func (s PostgresqlStorage) UpdateBookingStatus(id string, status internal.Bookin if err != nil { errMsg := "Postgresql Storage UpdateBookingStatus Error updating booking status" log.Error().Err(err).Msg(errMsg) - return errors.New(errMsg) + return errors.New(errMsg + err.Error()) } return nil diff --git a/utils/sql_errors.go b/utils/sql_errors.go new file mode 100644 index 0000000..0bad98b --- /dev/null +++ b/utils/sql_errors.go @@ -0,0 +1,6 @@ +package utils + +const ( + SQL_NO_ROWS = "no rows in result set" + SQL_DUPLICATE = "duplicate key" +)