The backend for the project formerly known as signet, now known as beignet.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

41 行
846 B

  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. }