handler

package
v0.0.0-...-c56863d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package handler provides the functionality of REST HTTP. It receives HTTP request and returns HTTP response.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateMedicalRecordRequest

type CreateMedicalRecordRequest struct {
	Symptom   string `json:"symptom"`
	Diagnosis string `json:"diagnosis"`
	Therapy   string `json:"therapy"`
}

CreateMedicalRecordRequest represents medical record request.

type MedicalRecordCreator

type MedicalRecordCreator struct {
	// contains filtered or unexported fields
}

MedicalRecordCreator handles HTTP request and response for create medical record.

func NewMedicalRecordCreator

func NewMedicalRecordCreator(creator usecase.CreateMedicalRecord) *MedicalRecordCreator

NewMedicalRecordCreator creates an instance of MedicalCreator.

func (*MedicalRecordCreator) Create

func (mrc *MedicalRecordCreator) Create(ctx echo.Context) error

Create handles `POST /medical-records` endpoint.

type MedicalRecordFinder

type MedicalRecordFinder struct {
	// contains filtered or unexported fields
}

MedicalRecordFinder handles HTTP request and response for find medical record.

func NewMedicalRecordFinder

func NewMedicalRecordFinder(finder usecase.FindMedicalRecord) *MedicalRecordFinder

NewMedicalRecordFinder creates an instance of MedicalFinder.

func (*MedicalRecordFinder) FindByEmail

func (mf *MedicalRecordFinder) FindByEmail(ctx echo.Context) error

FindByEmail handles `GET /medical-records` endpoint. It extracts the user's email from bearer token then finds all medical records bounded to the user.

func (*MedicalRecordFinder) FindByID

func (mf *MedicalRecordFinder) FindByID(ctx echo.Context) error

FindByID handles `GET /medical-records/:id` endpoint. It extracts the user's email from bearer token then finds all medical records bounded to the user.

type MedicalRecordResponse

type MedicalRecordResponse struct {
	ID        hashids.ID `json:"id"`
	Symptom   string     `json:"symptom"`
	Diagnosis string     `json:"diagnosis"`
	Therapy   string     `json:"therapy"`
	Result    string     `json:"result"`
	CreatedBy string     `json:"created_by"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedBy string     `json:"updated_by"`
	UpdatedAt time.Time  `json:"updated_at"`
}

MedicalRecordResponse defines the JSON response of medical record.

type MedicalRecordUpdater

type MedicalRecordUpdater struct {
	// contains filtered or unexported fields
}

MedicalRecordUpdater handles HTTP request and response for update medical record.

func NewMedicalRecordUpdater

func NewMedicalRecordUpdater(updater usecase.UpdateMedicalRecord) *MedicalRecordUpdater

NewMedicalRecordUpdater updates an instance of MedicalUpdater.

func (*MedicalRecordUpdater) Update

func (mru *MedicalRecordUpdater) Update(ctx echo.Context) error

Update handles `PUT /medical-records/:id` endpoint.

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

Signer handles HTTP request and response for sign in.

func NewSigner

func NewSigner(signin usecase.SignIn) *Signer

NewSigner creates an instance of Medical.

func (*Signer) SignIn

func (s *Signer) SignIn(ctx echo.Context) error

SignIn handles `POST /sign-in` endpoint.

type UpdateMedicalRecordRequest

type UpdateMedicalRecordRequest struct {
	Symptom   string `json:"symptom"`
	Diagnosis string `json:"diagnosis"`
	Therapy   string `json:"therapy"`
	Result    string `json:"result"`
}

UpdateMedicalRecordRequest represents medical record request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL