models

package
v0.0.0-...-76fc54f Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertHospitalModelToAttributes

func ConvertHospitalModelToAttributes(hospital *HospitalModel) map[string]string

func ConvertReservationModelToAttributes

func ConvertReservationModelToAttributes(reservation *ReservationModel) map[string]string

func ConvertUserModelToAttributes

func ConvertUserModelToAttributes(nationID string, user *UserModel) map[string]string

ConvertUserModelToRow converts *UserModel to attributes of bigtable.Row.

Types

type HospitalModel

type HospitalModel struct {
	// The hospital id
	// required: true
	// example: 0001
	ID string `json:"id" binding:"required"`
	// The hospital name
	// example: Taipei City Hospital Heping Fuyou Branch
	// required: true
	Name string `json:"name"`
	// The hospital County
	// example: New Taipei City
	// required: true
	County string `json:"county"`
	// The hospital Township
	// example: Banqiao
	// required: true
	Township string `json:"township"`
	// The hospital address
	// example: No.1, Sec. 4, Roosevelt Road, Taipei, 10617 Taiwan
	// required: true
	Address string `json:"address"`
	// The hospital vaccines
	// example: { "AZ": 100, "BNT": 200 }
	// required: true
	VaccineCnt map[string]int `json:"vaccineCnt"`
}

Hospital model is the body format of HospitalResponse

swagger:model HospitalModel

func ConvertRowToHospitalModel

func ConvertRowToHospitalModel(rowKey string, row bigtable.Row) (*HospitalModel, error)

type ReservationModel

type ReservationModel struct {
	// The reservation id
	// required: true
	// example: 0001
	ID string `json:"id" binding:"required"`
	// The reservation of the user
	// example: Bob
	// required: true
	User *UserModel `json:"user"`
	// The reservation hospital
	// example: Taipei City Hospital Heping Fuyou Branch
	// required: true
	Hospital *HospitalModel `json:"hospital"`
	// The reservation vaccineType
	// example: BNT
	// required: true
	VaccineType string `json:"vaccineType"`
	// The reservation date
	// example: 1653974953
	// required: true
	Date int64 `json:"date"`
	// The vaccination is completed
	// example: false
	// required: true
	Completed bool `json:"completed"`
}

ReservationModel is the body format of ReservationResponse

swagger:model ReservationModel

func ConvertRowToReservationModel

func ConvertRowToReservationModel(rowKey string, row bigtable.Row) (*ReservationModel, error)

type UserModel

type UserModel struct {
	// The user name
	// example: bob
	// in: body
	// required: false
	Name string `json:"name"`
	// The user gender
	// example: male
	// in: body
	// required: false
	Gender string `json:"gender"`
	// The user nation ID
	// example: A123456789
	// in: body
	// required: true
	NationID string `json:"nationID" binding:"required"`
	// The user healthCardID
	// example: 000011112222
	// in: body
	// required: true
	HealthCardID string `json:"healthCardID"`
	// The user birthday
	// example: 2022/05/23
	// in: body
	// required: false
	BirthDay string `json:"birthDay"`
	// The user address
	// example: No.1, Sec. 4, Roosevelt Road, Taipei, 10617 Taiwan
	// in: body
	// required: false
	Address string `json:"address"`
	// The user phone number
	// example: 0912345678
	// in: body
	// required: false
	Phone string `json:"phone"`
	// The user inoculated vaccines
	// example: ["AZ", "BNT"]
	// in: body
	// required: false
	Vaccines []string `json:"vaccines"`
}

UserModel is the body format of UserResponse

swagger:model UserModel

func ConvertRowToUserModel

func ConvertRowToUserModel(nationID string, row bigtable.Row) (*UserModel, error)

ConvertRowToUserModel converts bigtable.Row to *UserModel with given nationID.

Jump to

Keyboard shortcuts

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