package endpoints import ( "encoding/json" "net/http" "github.com/imosed/signet/utils" "github.com/rs/zerolog/log" ) type SubmitFundRequest struct { FundID uint `json:"fundID"` Submit bool `json:"submit"` } func SubmitFund(w http.ResponseWriter, r *http.Request) { var req SubmitFundRequest err := json.NewDecoder(r.Body).Decode(&req) if err != nil { log.Error().Err(err).Msg("Could not decode body in SubmitFund call") } var resp SuccessResponse resp.Success = false if req.Submit { var success bool success, err = utils.SubmitGroupFund(req.FundID) if err != nil { log.Error().Err(err).Msg("Could not submit group fund from SubmitFundRequest") } resp.Success = success } err = json.NewEncoder(w).Encode(resp) if err != nil { log.Error().Err(err).Msg("Could not deliver response in SubmitFund call") } }