Skip to content

Commit

Permalink
chore: remove remove practitioner enums and graphql schema (#142)
Browse files Browse the repository at this point in the history
Signed-off-by: Otieno Calvine <nyarangaotieno@gmail.com>
  • Loading branch information
NYARAS committed Sep 8, 2021
1 parent 11b0cf7 commit 6f11a82
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 1,752 deletions.
112 changes: 0 additions & 112 deletions .github/workflows/deployment.yaml

This file was deleted.

46 changes: 0 additions & 46 deletions cloudbuild.yaml

This file was deleted.

107 changes: 0 additions & 107 deletions pkg/onboarding/domain/enum.go
Expand Up @@ -7,58 +7,6 @@ import (
"strconv"
)

// PractitionerCadre is a list of health worker cadres.
type PractitionerCadre string

// practitioner cadre constants
const (
PractitionerCadreDoctor PractitionerCadre = "DOCTOR"
PractitionerCadreClinicalOfficer PractitionerCadre = "CLINICAL_OFFICER"
PractitionerCadreNurse PractitionerCadre = "NURSE"
)

// AllPractitionerCadre is the set of known valid practitioner cadres
var AllPractitionerCadre = []PractitionerCadre{
PractitionerCadreDoctor,
PractitionerCadreClinicalOfficer,
PractitionerCadreNurse,
}

// IsValid returns true if a practitioner cadre is valid
func (e PractitionerCadre) IsValid() bool {
switch e {
case PractitionerCadreDoctor, PractitionerCadreClinicalOfficer, PractitionerCadreNurse:
return true
}
return false
}

func (e PractitionerCadre) String() string {
return string(e)
}

// UnmarshalGQL converts the supplied value to a practitioner cadre
func (e *PractitionerCadre) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}

*e = PractitionerCadre(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid PractitionerCadre", str)
}
return nil
}

// MarshalGQL writes the practitioner cadre to the supplied writer
func (e PractitionerCadre) MarshalGQL(w io.Writer) {
_, err := fmt.Fprint(w, strconv.Quote(e.String()))
if err != nil {
log.Printf("%v\n", err)
}
}

// FivePointRating is used to implement
type FivePointRating string

Expand Down Expand Up @@ -115,61 +63,6 @@ func (e FivePointRating) MarshalGQL(w io.Writer) {
}
}

// PractitionerService defines the various services practitioners offer
type PractitionerService string

// PractitionerServiceOutpatientServices is a constant of all known practitioner service
const (
PractitionerServiceOutpatientServices PractitionerService = "OUTPATIENT_SERVICES"
PractitionerServiceInpatientServices PractitionerService = "INPATIENT_SERVICES"
PractitionerServicePharmacy PractitionerService = "PHARMACY"
PractitionerServiceMaternity PractitionerService = "MATERNITY"
PractitionerServiceLabServices PractitionerService = "LAB_SERVICES"
PractitionerServiceOther PractitionerService = "OTHER"
)

//AllPractitionerService is a list of all known practitioner service
var AllPractitionerService = []PractitionerService{
PractitionerServiceOutpatientServices,
PractitionerServiceInpatientServices,
PractitionerServicePharmacy,
PractitionerServiceMaternity,
PractitionerServiceLabServices,
PractitionerServiceOther,
}

// IsValid returns true for valid practitioner service
func (e PractitionerService) IsValid() bool {
switch e {
case PractitionerServiceOutpatientServices, PractitionerServiceInpatientServices, PractitionerServicePharmacy, PractitionerServiceMaternity, PractitionerServiceLabServices, PractitionerServiceOther:
return true
}
return false
}

func (e PractitionerService) String() string {
return string(e)
}

// UnmarshalGQL converts the input, if valid, into a practitioner service value
func (e *PractitionerService) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}

*e = PractitionerService(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid PractitionerService", str)
}
return nil
}

// MarshalGQL converts the practitioner service into a valid JSON string
func (e PractitionerService) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}

// EmploymentType ...
type EmploymentType string

Expand Down

0 comments on commit 6f11a82

Please sign in to comment.