change sheet use api key instead of use user credential

This commit is contained in:
Kenta420 2023-10-04 16:41:23 +07:00
parent 8ccbbc8647
commit 41812591b7
4 changed files with 22 additions and 17 deletions

View file

@ -105,7 +105,20 @@ func (rr *RecipeRouter) Route(r chi.Router) {
r.Get("/test/sheet", func(w http.ResponseWriter, r *http.Request) {
result := rr.sheetService.GetSheet(r.Context(), "1rSUKcc5POR1KeZFGoeAZIoVoI7LPGztBhPw5Z_ConDE")
json.NewEncoder(w).Encode(result)
mapResult := []map[string]string{}
for _, v := range result {
mapResult = append(mapResult, map[string]string{
"product_code": v[0].(string),
"name": v[1].(string),
"other_name": v[2].(string),
"description": v[3].(string),
"other_description": v[4].(string),
"image": v[5].(string),
})
}
json.NewEncoder(w).Encode(mapResult)
})
})
}