finish
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
//fakerGetRequest Get data from faker
|
||||
func fakerGetRequest(uri string) string {
|
||||
resStr := utils.GetWhioutHeader(global.FACKER_HOST + uri)
|
||||
var res utils.GinResponse
|
||||
@@ -18,6 +19,7 @@ func fakerGetRequest(uri string) string {
|
||||
return string(dataStr)
|
||||
}
|
||||
|
||||
//queryHotelContacts Hotel contacts
|
||||
func queryHotelContacts(identification string) []models.HotelContactRequest {
|
||||
dataStr := fakerGetRequest("query/contacts/hotel/" + identification)
|
||||
var data []models.HotelContactRequest
|
||||
@@ -28,6 +30,7 @@ func queryHotelContacts(identification string) []models.HotelContactRequest {
|
||||
return data
|
||||
}
|
||||
|
||||
//queryRailwayContacts Railway contacts
|
||||
func queryRailwayContacts(identification string) []models.RailwayContactRequest {
|
||||
dataStr := fakerGetRequest("query/contacts/railway/" + identification)
|
||||
var data []models.RailwayContactRequest
|
||||
@@ -38,7 +41,8 @@ func queryRailwayContacts(identification string) []models.RailwayContactRequest
|
||||
return data
|
||||
}
|
||||
|
||||
func queryPatients(identification string) []models.PatientRequest {
|
||||
//queryPatients Patients
|
||||
func QueryPatients(identification string) []models.PatientRequest {
|
||||
dataStr := fakerGetRequest("query/contacts/railway/" + identification)
|
||||
var data []models.PatientRequest
|
||||
err := json.Unmarshal([]byte(dataStr), &data)
|
||||
@@ -48,6 +52,7 @@ func queryPatients(identification string) []models.PatientRequest {
|
||||
return data
|
||||
}
|
||||
|
||||
//queryContacts Resolve the diffrent of hotel and railway request
|
||||
func queryContacts(identification string) []models.BackObservation {
|
||||
hotelContacts := queryHotelContacts(identification)
|
||||
railwayContacts := queryRailwayContacts(identification)
|
||||
@@ -55,11 +60,13 @@ func queryContacts(identification string) []models.BackObservation {
|
||||
return observations
|
||||
}
|
||||
|
||||
//splitFakerAddress Extract the region
|
||||
func splitFakerAddress(fakerAddress string) string {
|
||||
addresses := strings.Split(fakerAddress, " ")
|
||||
return addresses[1] + " " + addresses[2]
|
||||
}
|
||||
|
||||
//fakerContacts2Observations Convvert structs
|
||||
func fakerContacts2Observations(contacts any) []models.BackObservation {
|
||||
var observations []models.BackObservation
|
||||
switch contacts.(type) {
|
||||
|
||||
Reference in New Issue
Block a user