Skip to content

Commit

Permalink
Remove glot-run stuff from db and remove stale modules and deps
Browse files Browse the repository at this point in the history
  • Loading branch information
prasmussen committed Mar 6, 2021
1 parent 2467545 commit 32cb8ac
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 190 deletions.
5 changes: 1 addition & 4 deletions Foundation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import Mail.Hailgun (
MessageRecipients(..))


import qualified Model.Run.Api as RunApi

-- | The foundation datatype for your application. This can be a good place to
-- keep settings and values requiring initialization before your application
-- starts running, such as database connections. Every handler will have
Expand Down Expand Up @@ -171,14 +169,13 @@ instance YesodAuthSimple App where
token <- liftIO newToken
-- TODO: SnippetUserId can be removed after the snippets has been imported
snippetUserId <- liftIO newToken
runId <- liftIO $ RunApi.addUser token
now <- liftIO getCurrentTime
liftHandler $ runDB $ do
mUserId <- insertUnique $ User email password now now
case mUserId of
Just userId -> do
_ <- insertUnique $ Profile userId snippetUserId username name now now
_ <- insertUnique $ ApiUser userId runId token now now
_ <- insertUnique $ ApiUser userId token now now
return mUserId
Nothing -> do
return mUserId
Expand Down
4 changes: 1 addition & 3 deletions Handler/Account.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Util.Slug (mkSlug)
import Util.User (newToken)
import Util.Handler (title)
import Util.Alert (successHtml)
import qualified Model.Run.Api as RunApi

data ProfileData = ProfileData {
name :: Text,
Expand Down Expand Up @@ -48,9 +47,8 @@ getAccountTokenR = do
putAccountTokenR :: Handler Value
putAccountTokenR = do
userId <- requireAuthId
Entity apiUserId apiUser <- runDB $ getBy404 $ UniqueApiUser userId
Entity apiUserId _ <- runDB $ getBy404 $ UniqueApiUser userId
token <- liftIO newToken
liftIO $ RunApi.setUserToken (apiUserRunId apiUser) token
now <- liftIO getCurrentTime
runDB $ update apiUserId [ApiUserToken =. token, ApiUserModified =. now]
setMessage $ successHtml "New token generated"
Expand Down
84 changes: 0 additions & 84 deletions Model/Run/Api.hs

This file was deleted.

35 changes: 0 additions & 35 deletions Util/Api.hs

This file was deleted.

51 changes: 0 additions & 51 deletions Util/Http.hs

This file was deleted.

2 changes: 0 additions & 2 deletions config/models
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ Profile

ApiUser
userId UserId
runId Text
token Text
created UTCTime
modified UTCTime
UniqueApiUser userId
UniqueRunId runId
UniqueApiToken token
deriving Typeable Show

Expand Down
11 changes: 0 additions & 11 deletions glot.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@ library
Model.Language
Model.Pagination
Model.Snippet
Model.Run.Api
Util.Shakespare
Util.Handler
Util.Api
Util.Http
Util.Multiline
Util.Slug
Util.User
Expand Down Expand Up @@ -88,7 +85,6 @@ library
, yesod-static
, yesod-form
, classy-prelude
, classy-prelude-conduit
, classy-prelude-yesod
, bytestring
, text
Expand All @@ -101,20 +97,17 @@ library
, monad-control
, wai-extra
, yaml
, http-conduit
, directory
, warp
, data-default
, aeson
, conduit
, monad-logger
, fast-logger
, wai-logger
, file-embed
, safe
, unordered-containers
, containers
, vector
, time
, base64-bytestring
, base16-bytestring
Expand All @@ -124,12 +117,8 @@ library
, cryptohash
, http-types
, uuid
, conduit-extra
, wai
, regex-compat
, wreq
, lens
, network-uri
, iso8601-time
, blaze-html
, blaze-markup
Expand Down

0 comments on commit 32cb8ac

Please sign in to comment.