public Response schedulePatientAppointment()

in serverless-workflow-examples/serverless-workflow-functions-events-quarkus/src/main/java/org/acme/sw/onboarding/resources/AppointmentResource.java [55:71]


    public Response schedulePatientAppointment(@NotNull final Patient patient) {
        LOGGER.debug("Receive patient to schedule appointments: {}", patient);
        if (patient.getId() == null || patient.getId().isEmpty()) {
            return Response.status(Response.Status.BAD_REQUEST)
                    .entity(new Error("Patient has not been processed! Patients need to have an ID."))
                    .build();
        }
        if (patient.getAssignedDoctor() == null) {
            return Response.status(Response.Status.BAD_REQUEST)
                    .entity(new Error("Doctor has not been assigned! Impossible to schedule an appointment. Please assign a doctor first."))
                    .build();
        }
        // now we can go
        this.appointments.add(scheduleService.createAppointment(patient));
        LOGGER.debug("Processed patient: {}", patient);
        return Response.ok(patient).build();
    }