2020-01-09 12:58:07 +03:00
|
|
|
module Fixtures where
|
|
|
|
|
|
|
|
import Wasp
|
2020-01-21 16:03:14 +03:00
|
|
|
import qualified Wasp.EntityForm as EF
|
2020-07-31 15:26:10 +03:00
|
|
|
import qualified Wasp.Route as RouteAST
|
2020-07-21 21:42:29 +03:00
|
|
|
import qualified Generator.WebAppGenerator.EntityGenerator.EntityFormGenerator as GEF
|
2020-01-09 12:58:07 +03:00
|
|
|
|
2020-01-14 14:59:56 +03:00
|
|
|
app :: App
|
|
|
|
app = App
|
|
|
|
{ appName = "test_app"
|
|
|
|
, appTitle = "Hello World!"
|
|
|
|
}
|
|
|
|
|
2020-07-31 15:26:10 +03:00
|
|
|
routeHome :: RouteAST.Route
|
|
|
|
routeHome = RouteAST.Route
|
|
|
|
{ RouteAST._urlPath = "/home"
|
|
|
|
, RouteAST._targetPage = "Home"
|
|
|
|
}
|
|
|
|
|
2020-01-09 12:58:07 +03:00
|
|
|
taskEntity :: Entity
|
|
|
|
taskEntity = Entity
|
|
|
|
{ entityName = "Task"
|
|
|
|
, entityFields =
|
|
|
|
[ Wasp.EntityField "description" Wasp.EftString
|
|
|
|
, Wasp.EntityField "isDone" Wasp.EftBoolean
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2020-01-21 16:03:14 +03:00
|
|
|
taskCreateForm :: EF.EntityForm
|
|
|
|
taskCreateForm = EF.EntityForm
|
|
|
|
{ EF._name = "CreateTaskForm"
|
|
|
|
, EF._entityName = "Task"
|
|
|
|
, EF._submit = Just EF.Submit
|
|
|
|
{ EF._onEnter = Just False
|
|
|
|
, EF._submitButton = Nothing
|
2020-01-09 12:58:07 +03:00
|
|
|
}
|
2020-01-26 19:59:23 +03:00
|
|
|
, EF._fields = []
|
2020-01-09 12:58:07 +03:00
|
|
|
}
|
|
|
|
|
2020-01-14 14:59:56 +03:00
|
|
|
userEntity :: Entity
|
|
|
|
userEntity = Entity
|
|
|
|
{ entityName = "User"
|
|
|
|
, entityFields =
|
|
|
|
[ Wasp.EntityField "name" Wasp.EftString
|
|
|
|
, Wasp.EntityField "surname" Wasp.EftString
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2020-01-21 16:03:14 +03:00
|
|
|
userCreateForm :: EF.EntityForm
|
|
|
|
userCreateForm = EF.EntityForm
|
|
|
|
{ EF._name = "CreateUserForm"
|
|
|
|
, EF._entityName = "User"
|
|
|
|
, EF._submit = Nothing
|
2020-01-26 19:59:23 +03:00
|
|
|
, EF._fields = []
|
2020-01-14 14:59:56 +03:00
|
|
|
}
|
|
|
|
|
2020-01-09 12:58:07 +03:00
|
|
|
wasp :: Wasp
|
|
|
|
wasp = fromWaspElems
|
2020-01-14 14:59:56 +03:00
|
|
|
[ WaspElementApp app
|
|
|
|
, WaspElementEntity taskEntity
|
2020-01-09 12:58:07 +03:00
|
|
|
, WaspElementEntityForm taskCreateForm
|
|
|
|
]
|
2020-01-28 13:37:36 +03:00
|
|
|
|
|
|
|
formFieldIsDone :: GEF.FormFieldTemplateData
|
|
|
|
formFieldIsDone = GEF.FormFieldTemplateData
|
|
|
|
{ GEF._fieldName = "isDone"
|
|
|
|
, GEF._fieldType = Wasp.EftBoolean
|
|
|
|
, GEF._fieldShow = True
|
|
|
|
, GEF._fieldDefaultValue = EF.DefaultValueBool True
|
2020-02-05 15:46:48 +03:00
|
|
|
, GEF._fieldPlaceholder = Nothing
|
2020-02-05 21:04:09 +03:00
|
|
|
, GEF._fieldLabel = Nothing
|
2020-01-28 13:37:36 +03:00
|
|
|
}
|