diff --git a/.gitignore b/.gitignore index 99d4a3d3c..5c3dfb89e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ dist* static/tmp/ static/combined/ -config/client_session_key.aes +client_session_key.aes *.hi *.o *.sqlite3 diff --git a/config/models b/app/models similarity index 100% rename from config/models rename to app/models diff --git a/config/routes b/app/routes similarity index 86% rename from config/routes rename to app/routes index d6836884c..6df7b740c 100644 --- a/config/routes +++ b/app/routes @@ -6,6 +6,4 @@ / HomeR GET POST -/comments CommentR POST - /profile ProfileR GET diff --git a/config/favicon.ico b/embedded/favicon.ico similarity index 100% rename from config/favicon.ico rename to embedded/favicon.ico diff --git a/config/robots.txt b/embedded/robots.txt similarity index 100% rename from config/robots.txt rename to embedded/robots.txt diff --git a/app/DevelMain.hs b/exe/DevelMain.hs similarity index 100% rename from app/DevelMain.hs rename to exe/DevelMain.hs diff --git a/app/devel.hs b/exe/devel.hs similarity index 100% rename from app/devel.hs rename to exe/devel.hs diff --git a/app/main.hs b/exe/main.hs similarity index 100% rename from app/main.hs rename to exe/main.hs diff --git a/package.yaml b/package.yaml index 3830186c9..d9a41d8e0 100644 --- a/package.yaml +++ b/package.yaml @@ -68,7 +68,7 @@ library: executables: uniworx: main: main.hs - source-dirs: app + source-dirs: exe ghc-options: - -threaded - -rtsopts diff --git a/src/Foundation.hs b/src/Foundation.hs index 9979e7bb6..664a5e1b0 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -56,7 +56,7 @@ data MenuTypes -- This function also generates the following type synonyms: -- type Handler = HandlerT App IO -- type Widget = WidgetT App IO () -mkYesodData "App" $(parseRoutesFile "config/routes") +mkYesodData "App" $(parseRoutesFile "app/routes") -- | A convenient synonym for creating forms. type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget) @@ -75,7 +75,7 @@ instance Yesod App where -- default session idle timeout is 120 minutes makeSessionBackend _ = Just <$> defaultClientSessionBackend 120 -- timeout in minutes - "config/client_session_key.aes" + "client_session_key.aes" -- Yesod Middleware allows you to run code before and after each handler function. -- The defaultYesodMiddleware adds the response header "Vary: Accept, Accept-Language" and performs authorization checks. diff --git a/src/Handler/Comment.hs b/src/Handler/Comment.hs deleted file mode 100644 index edb20a8ab..000000000 --- a/src/Handler/Comment.hs +++ /dev/null @@ -1,16 +0,0 @@ -module Handler.Comment where - -import Import - -postCommentR :: Handler Value -postCommentR = do - -- requireJsonBody will parse the request body into the appropriate type, or return a 400 status code if the request JSON is invalid. - -- (The ToJSON and FromJSON instances are derived in the config/models file). - comment <- (requireJsonBody :: Handler Comment) - - -- The YesodAuth instance in Foundation.hs defines the UserId to be the type used for authentication. - maybeCurrentUserId <- maybeAuthId - let comment' = comment { commentUserId = maybeCurrentUserId } - - insertedComment <- runDB $ insertEntity comment' - returnJson insertedComment diff --git a/src/Handler/Common.hs b/src/Handler/Common.hs index 6783f8afb..2119bfb06 100644 --- a/src/Handler/Common.hs +++ b/src/Handler/Common.hs @@ -15,8 +15,8 @@ import Import getFaviconR :: Handler TypedContent getFaviconR = do cacheSeconds $ 60 * 60 * 24 * 30 -- cache for a month return $ TypedContent "image/x-icon" - $ toContent $(embedFile "config/favicon.ico") + $ toContent $(embedFile "embedded/favicon.ico") getRobotsR :: Handler TypedContent getRobotsR = return $ TypedContent typePlain - $ toContent $(embedFile "config/robots.txt") + $ toContent $(embedFile "embedded/robots.txt") diff --git a/src/Import.hs b/src/Import.hs index 25ed1f7be..a10200156 100644 --- a/src/Import.hs +++ b/src/Import.hs @@ -4,4 +4,3 @@ module Import import Foundation as Import import Import.NoFoundation as Import -import ModelData as Import diff --git a/src/Model.hs b/src/Model.hs index c84945443..b3cd1712b 100644 --- a/src/Model.hs +++ b/src/Model.hs @@ -7,20 +7,23 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} -module Model where +module Model + ( module Model + , module Model.Types + ) where import ClassyPrelude.Yesod import Database.Persist.Quasi -- import Data.Time -- import Data.ByteString -import ModelData +import Model.Types -- You can define all of your database entities in the entities file. -- You can find more information on persistent and how to declare entities -- at: -- http://www.yesodweb.com/book/persistent/ share [mkPersist sqlSettings, mkMigrate "migrateAll"] - $(persistFileWith lowerCaseSettings "config/models") + $(persistFileWith lowerCaseSettings "app/models") instance Show Term where show = ClassyPrelude.Yesod.unpack . termName diff --git a/src/ModelData.hs b/src/Model/Types.hs similarity index 96% rename from src/ModelData.hs rename to src/Model/Types.hs index 620feff5c..be40723b9 100644 --- a/src/ModelData.hs +++ b/src/Model/Types.hs @@ -1,6 +1,6 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE TemplateHaskell #-} -module ModelData where +module Model.Types where import Database.Persist.TH @@ -28,4 +28,4 @@ instance PersistField Term where fromPersistValue (Term {season, year}) = undefined sqlType _ = SqlInteger isNullable _ = False --} \ No newline at end of file +-}