add the logic to store adresse

This commit is contained in:
soukainna 2022-11-10 17:24:36 +01:00
parent 941a7ccc5e
commit 814a20c7e2
1 changed files with 13 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package application
import (
"context"
"encoding/json"
"fmt"
"net/http"
"sort"
@ -16,6 +17,8 @@ import (
"google.golang.org/protobuf/types/known/structpb"
)
var Addres any
type BeneficiariesGroupForm struct {
FirstName string `json:"first_name" validate:"required"`
LastName string `json:"last_name" validate:"required"`
@ -61,6 +64,12 @@ func (h *ApplicationHandler) Groups(w http.ResponseWriter, r *http.Request) {
func (h *ApplicationHandler) CreateGroupModule(w http.ResponseWriter, r *http.Request) {
if r.Method == "POST" {
if r.PostFormValue("address") != "" {
var a any
json.Unmarshal([]byte(r.PostFormValue("address")), &a)
Addres = a
}
r.ParseForm()
if r.FormValue("name") == "" {
@ -79,8 +88,10 @@ func (h *ApplicationHandler) CreateGroupModule(w http.ResponseWriter, r *http.Re
groupid := uuid.NewString()
dataMap := map[string]any{
"name": r.FormValue("name"),
"type": r.FormValue("type"),
"name": r.FormValue("name"),
"type": r.FormValue("type"),
"description": r.FormValue("description"),
"address": Addres,
}
data, err := structpb.NewValue(dataMap)
@ -149,7 +160,6 @@ func (h *ApplicationHandler) DisplayGroupModule(w http.ResponseWriter, r *http.R
// if err != nil {
// return err
// }
for _, account := range ressp.Accounts {
if filterAcccount(r, account) {
a := account.ToStorageType()