Advertisement
armlesshobo

Schema issues

May 7th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;; form data defined as an Entry
  2. (defschema Entry
  3.   { :callsign-used String
  4.     :location      String
  5.     :op-type       String
  6.     :pwr-type      String
  7.     :stn-type      String
  8.     :mode-type     String
  9.     :digi-qsos     Num
  10.     :cw-qsos       Num
  11.     :ssb-qsos      Num
  12.     :mplier        Num
  13.     :cnty-worked   Num
  14.     :bonus-worked  Num
  15.     :op-name       String
  16.     :op-callsign   String
  17.     :soap-box      String })
  18.  
  19. ;; modified the default generated code created by 'lein new luminus <name>'
  20. (defroutes home-routes
  21.   (GET  "/" request (entry-page request))
  22.  
  23.   (POST "/" request
  24.         :query-params [entry :- Entry]
  25.         :returns Entry
  26.         (process-entry! entry))
  27.  
  28.   (GET  "/about" [] (about-page)))
  29.  
  30. ;; The result is that the map that gets passed into 'process-entry! has un-coerced values
  31. ;;process-entry! params -> {:soap-box "hey",
  32. ;;                          :digi-qsos "9",
  33. ;;                          :pwr-type "High",
  34. ;;                          :mplier "7",
  35. ;;                          :cnty-worked "8",
  36. ;;                          :stn-type "Single Transmitter",
  37. ;;                          :mode-type "CW Only",
  38. ;;                          :ssb-qsos "8",
  39. ;;                          :cw-qsos "7",
  40. ;;                          :callsign-used "ar8a",
  41. ;;                          :bonus-worked "67",
  42. ;;                          :op-name "bob ",
  43. ;;                          :location "Here",
  44. ;;                          :__anti-forgery-token "XG38nz/y7k8foobar",
  45. ;;                          :op-type "Single Operator",
  46. ;;                          :op-callsign "r8ra"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement