refactored code to breakdown init function, moved schema_util outside producer module, renamed files

This commit is contained in:
aishwarya-raimule
2023-01-09 18:15:35 +05:30
parent 8adc55bd40
commit 1ad5c94ee2
4 changed files with 60 additions and 60 deletions

View File

@@ -1,8 +1,8 @@
package server
import (
lib "com.navi.medici.janus/lib"
producer "com.navi.medici.janus/producer"
"com.navi.medici.janus/lib"
"com.navi.medici.janus/schema"
"fmt"
"io"
@@ -113,13 +113,13 @@ func healthToggleHandler(w http.ResponseWriter, r *http.Request) {
}
func getSchemaHandler(w http.ResponseWriter, r *http.Request) {
schemaMapJson, _ := json.Marshal(producer.SchemaVersionMap)
schemaMapJson, _ := json.Marshal(schema.SchemaVersionMap)
w.Header().Set("Content-Type", "application/json")
w.Write(schemaMapJson)
}
func refreshSchemaHandler(w http.ResponseWriter, r *http.Request) {
producer.GetSchemaVersions()
schema.GetSchemaVersions()
io.WriteString(w, "Updated Schema Map")
}
@@ -130,7 +130,7 @@ func addSchemaHandler(w http.ResponseWriter, r *http.Request) {
error := json.Unmarshal(body, &bodyJson)
fmt.Println(error)
errorSchema := producer.AddSchema(bodyJson.Topic, bodyJson.SchemaType, bodyJson.Schema)
errorSchema := schema.AddSchema(bodyJson.Topic, bodyJson.SchemaType, bodyJson.Schema)
fmt.Println("errorSchema: ")
fmt.Println(error)
if errorSchema != nil {