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.