Skip to content

Commit

Permalink
fixed unit test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MahtabBukhari committed May 13, 2024
1 parent 3f11957 commit 9a764fe
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 8 deletions.
16 changes: 8 additions & 8 deletions handlers/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,18 @@ func (oh *featureHandler) CreateOrEditFeaturePhase(w http.ResponseWriter, r *htt
}

func (oh *featureHandler) GetFeaturePhases(w http.ResponseWriter, r *http.Request) {
uuid := chi.URLParam(r, "feature_uuid")
phases := oh.db.GetPhasesByFeatureUuid(uuid)
featureUuid := chi.URLParam(r, "feature_uuid")
phases := oh.db.GetPhasesByFeatureUuid(featureUuid)

w.WriteHeader(http.StatusOK)
json.NewEncoder(w).Encode(phases)
}

func (oh *featureHandler) GetFeaturePhaseByUUID(w http.ResponseWriter, r *http.Request) {
featureUUID := chi.URLParam(r, "feature_uuid")
phaseUUID := chi.URLParam(r, "phase_uuid")
featureUuid := chi.URLParam(r, "feature_uuid")
phaseUuid := chi.URLParam(r, "phase_uuid")

phase, err := oh.db.GetFeaturePhaseByUuid(featureUUID, phaseUUID)
phase, err := oh.db.GetFeaturePhaseByUuid(featureUuid, phaseUuid)
if err != nil {
w.WriteHeader(http.StatusNotFound)
return
Expand All @@ -147,10 +147,10 @@ func (oh *featureHandler) GetFeaturePhaseByUUID(w http.ResponseWriter, r *http.R
}

func (oh *featureHandler) DeleteFeaturePhase(w http.ResponseWriter, r *http.Request) {
featureUUID := chi.URLParam(r, "feature_uuid")
phaseUUID := chi.URLParam(r, "phase_uuid")
featureUuid := chi.URLParam(r, "feature_uuid")
phaseUuid := chi.URLParam(r, "phase_uuid")

err := oh.db.DeleteFeaturePhase(featureUUID, phaseUUID)
err := oh.db.DeleteFeaturePhase(featureUuid, phaseUuid)
if err != nil {
w.WriteHeader(http.StatusNotFound)
json.NewEncoder(w).Encode(map[string]string{"error": err.Error()})
Expand Down
72 changes: 72 additions & 0 deletions mocks/Database.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9a764fe

Please sign in to comment.