Skip to content

Commit

Permalink
fix(CPL-312): fixt profile syncing input and output
Browse files Browse the repository at this point in the history
  • Loading branch information
BiKodes committed Apr 17, 2024
1 parent e46c655 commit 7f5790d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 50 deletions.
24 changes: 5 additions & 19 deletions healthcrm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,7 @@ func TestHealthCRMLib_CreateProfile(t *testing.T) {
args: args{
ctx: context.Background(),
profile: &ProfileInput{
ProfileID: gofakeit.UUID(),
FirstName: "TestProfile",
LastName: "BikoTest",
OtherName: "SteveTest",
Expand Down Expand Up @@ -1268,26 +1269,10 @@ func TestHealthCRMLib_CreateProfile(t *testing.T) {
path := fmt.Sprintf("%s/v1/identities/profiles/", BaseURL)
httpmock.RegisterResponder(http.MethodPost, path, func(r *http.Request) (*http.Response, error) {
resp := &ProfileOutput{
FirstName: gofakeit.FirstName(),
LastName: gofakeit.LastName(),
OtherName: gofakeit.BeerName(),
DateOfBirth: gofakeit.Date().String(),
Gender: gofakeit.Gender(),
EnrolmentDate: gofakeit.Date().String(),
ID: gofakeit.UUID(),
ProfileID: "232422",
HealthID: "50932",
SladeCode: "50202",
ServiceCode: "50",
Contacts: []*ProfileContactOutput{
{
ContactType: "PHONE_NUMBER",
ContactValue: "+254788223223",
},
},
Identifiers: []*ProfileIdentifierOutput{
{
IdentifierType: "SLADE_CODE",
IdentifierValue: "3243",
},
},
}
return httpmock.NewJsonResponse(http.StatusCreated, resp)
})
Expand All @@ -1296,6 +1281,7 @@ func TestHealthCRMLib_CreateProfile(t *testing.T) {
path := fmt.Sprintf("%s/v1/identities/profiles/", BaseURL)
httpmock.RegisterResponder(http.MethodPost, path, func(r *http.Request) (*http.Response, error) {
resp := &ProfileInput{
ProfileID: gofakeit.UUID(),
FirstName: gofakeit.FirstName(),
LastName: gofakeit.LastName(),
OtherName: gofakeit.BeerName(),
Expand Down
1 change: 1 addition & 0 deletions input.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ type ServiceIdentifierInput struct {

// ProfileInput is the host of users data or a brief description of a person
type ProfileInput struct {
ProfileID string `json:"profile_id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
OtherName string `json:"other_name"`
Expand Down
35 changes: 4 additions & 31 deletions output.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,35 +100,8 @@ type ServiceIdentifier struct {

// ProfileOutput is used to display profile(s)
type ProfileOutput struct {
ID string `json:"id,omitempty"`
Created string `json:"created,omitempty"`
Active bool `json:"active"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
OtherName string `json:"other_name"`
DateOfBirth string `json:"date_of_birth"`
Gender string `json:"gender"`
EnrolmentDate string `json:"enrolment_date"`
SladeCode string `json:"slade_code"`
ServiceCode string `json:"service_code"`
Contacts []*ProfileContactOutput `json:"contacts,omitempty"`
Identifiers []*ProfileIdentifierOutput `json:"identifiers,omitempty"`
}

// ProfileContactOutput is used to show profile contacts
type ProfileContactOutput struct {
ID string `json:"id"`
ContactType string `json:"contact_type"`
ContactValue string `json:"contact_value"`
DateVerified string `json:"date_verified"`
Verified bool `json:"verifed,omitempty"`
}

// ProfileIndentifierOutput is used to display profile identifiers
type ProfileIdentifierOutput struct {
ID string `json:"id"`
IdentifierType string `json:"identifier_type"`
IdentifierValue string `json:"identifier_value"`
ValidFrom string `json:"valid_from"`
ValidTo string `json:"valid_to"`
ID string `json:"id,omitempty"`
ProfileID string `json:"profile_id"`
HealthID string `json:"health_id"`
SladeCode string `json:"slade_code"`
}

0 comments on commit 7f5790d

Please sign in to comment.