Instantly share code, notes, and snippets.

Embed
What would you like to do?
-- File auto generated by purescript-bridge! --
module App.Crud where
import Data.Lens (Lens', Prism', lens, prism')
import Data.Lens.Iso.Newtype (_Newtype)
import Data.Lens.Record (prop)
import Data.Maybe (Maybe, Maybe(..))
import Data.Newtype (class Newtype)
import Data.Symbol (SProxy(..))
import Prim (Array, Int, String)
import Prelude
import Data.Generic (class Generic)
data CreateResponse =
CreateSuccess Int
| CreateFailure String
| FailedUniquenessConstraint
derive instance genericCreateResponse :: Generic CreateResponse
--------------------------------------------------------------------------------
_CreateSuccess :: Prism' CreateResponse Int
_CreateSuccess = prism' CreateSuccess f
where
f (CreateSuccess a) = Just $ a
f _ = Nothing
_CreateFailure :: Prism' CreateResponse String
_CreateFailure = prism' CreateFailure f
where
f (CreateFailure a) = Just $ a
f _ = Nothing
_FailedUniquenessConstraint :: Prism' CreateResponse Unit
_FailedUniquenessConstraint = prism' (\_ -> FailedUniquenessConstraint) f
where
f FailedUniquenessConstraint = Just unit
f _ = Nothing
--------------------------------------------------------------------------------
newtype PaginationParams =
PaginationParams {
pp_perPage :: Int
, pp_page :: Int
, pp_orderBy :: Maybe String
, pp_order :: Maybe String
}
derive instance genericPaginationParams :: Generic PaginationParams
derive instance newtypePaginationParams :: Newtype PaginationParams _
--------------------------------------------------------------------------------
_PaginationParams :: Prism' PaginationParams { pp_perPage :: Int, pp_page :: Int, pp_orderBy :: Maybe String, pp_order :: Maybe String}
_PaginationParams = prism' PaginationParams f
where
f (PaginationParams r) = Just r
_pp_perPage = _Newtype <<< prop (SProxy :: SProxy "pp_perPage")
_pp_page = _Newtype <<< prop (SProxy :: SProxy "pp_page")
_pp_orderBy = _Newtype <<< prop (SProxy :: SProxy "pp_orderBy")
_pp_order = _Newtype <<< prop (SProxy :: SProxy "pp_order")
-----------------------------------------------------
------------------------- File auto generated by purescript-bridge! --
module App.Form where
import Data.Lens (Lens', Prism', lens, prism')
import Data.Lens.Iso.Newtype (_Newtype)
import Data.Lens.Record (prop)
import Data.Maybe (Maybe, Maybe(..))
import Data.Newtype (class Newtype)
import Data.Symbol (SProxy(..))
import Prim (String)
import Prelude
import Data.Generic (class Generic)
newtype CuratorForm =
CuratorForm {
cf_invitee :: String
, cf_message :: Maybe String
}
derive instance genericCuratorForm :: Generic CuratorForm
derive instance newtypeCuratorForm :: Newtype CuratorForm _
--------------------------------------------------------------------------------
_CuratorForm :: Prism' CuratorForm { cf_invitee :: String, cf_message :: Maybe String}
_CuratorForm = prism' CuratorForm f
where
f (CuratorForm r) = Just r
_cf_invitee = _Newtype <<< prop (SProxy :: SProxy "cf_invitee")
_cf_message = _Newtype <<< prop (SProxy :: SProxy "cf_message")
--------------------------------------------------------------------------------
newtype EventForm =
EventForm {
ef_name :: String
, ef_description :: Maybe String
, ef_startDatetime :: Maybe String
, ef_endDatetime :: Maybe String
, ef_logo :: Maybe String
}
derive instance genericEventForm :: Generic EventForm
derive instance newtypeEventForm :: Newtype EventForm _
--------------------------------------------------------------------------------
_EventForm :: Prism' EventForm { ef_name :: String, ef_description :: Maybe String, ef_startDatetime :: Maybe String, ef_endDatetime :: Maybe String, ef_logo :: Maybe String}
_EventForm = prism' EventForm f
where
f (EventForm r) = Just r
_ef_name = _Newtype <<< prop (SProxy :: SProxy "ef_name")
_ef_description = _Newtype <<< prop (SProxy :: SProxy "ef_description")
_ef_startDatetime = _Newtype <<< prop (SProxy :: SProxy "ef_startDatetime")
_ef_endDatetime = _Newtype <<< prop (SProxy :: SProxy "ef_endDatetime")
_ef_logo = _Newtype <<< prop (SProxy :: SProxy "ef_logo")
--------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment