Skip to content

Commit

Permalink
Extend Create Appointment request (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliehastings authored Jun 20, 2024
1 parent 8d0a0e9 commit a715a28
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
13 changes: 8 additions & 5 deletions appointment.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ type AppointmentService struct {
}

type AppointmentCreate struct {
ScheduledDate time.Time `json:"scheduled_date"`
Reason string `json:"reason"`
Patient int64 `json:"patient"`
Physician int64 `json:"physician"`
Practice int64 `json:"practice"`
Description *string `json:"description"`
Duration int64 `json:"duration"`
Patient int64 `json:"patient"`
Physician int64 `json:"physician"`
Practice int64 `json:"practice"`
Reason string `json:"reason"`
ScheduledDate time.Time `json:"scheduled_date"`
ServiceLocation *int64 `json:"service_location"`
}

func (s *AppointmentService) Create(ctx context.Context, create *AppointmentCreate) (*Appointment, *http.Response, error) {
Expand Down
15 changes: 10 additions & 5 deletions appointment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ import (
func TestAppointmentService_Create(t *testing.T) {
assert := assert.New(t)

var serviceLocation int64 = 4

expected := &AppointmentCreate{
ScheduledDate: time.Date(2023, 5, 15, 0, 0, 0, 0, time.UTC),
Reason: "reason",
Patient: 1,
Physician: 2,
Practice: 3,
Description: Ptr("description"),
Duration: 60,
Patient: 1,
Physician: 2,
Practice: 3,
Reason: "reason",
ScheduledDate: time.Date(2023, 5, 15, 0, 0, 0, 0, time.UTC),
ServiceLocation: Ptr(serviceLocation),
}

srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit a715a28

Please sign in to comment.