The backend for the project formerly known as signet, now known as beignet.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
12345678910111213141516171819202122232425262728293031323334353637383940
  1. package endpoints
  2. import (
  3. "encoding/json"
  4. "net/http"
  5. "github.com/imosed/signet/utils"
  6. "github.com/rs/zerolog/log"
  7. )
  8. type SubmitFundRequest struct {
  9. FundID uint `json:"fundID"`
  10. Submit bool `json:"submit"`
  11. }
  12. func SubmitFund(w http.ResponseWriter, r *http.Request) {
  13. var req SubmitFundRequest
  14. err := json.NewDecoder(r.Body).Decode(&req)
  15. if err != nil {
  16. log.Error().Err(err).Msg("Could not decode body in SubmitFund call")
  17. }
  18. var resp SuccessResponse
  19. resp.Success = false
  20. if req.Submit {
  21. var success bool
  22. success, err = utils.SubmitGroupFund(req.FundID)
  23. if err != nil {
  24. log.Error().Err(err).Msg("Could not submit group fund from SubmitFundRequest")
  25. }
  26. resp.Success = success
  27. }
  28. err = json.NewEncoder(w).Encode(resp)
  29. if err != nil {
  30. log.Error().Err(err).Msg("Could not deliver response in SubmitFund call")
  31. }
  32. }