Compare commits

...

3 Commits

Author SHA1 Message Date
Saku Laesvuori d2f1b07922
Improve CSS 2023-10-04 22:42:58 +03:00
Saku Laesvuori 3666f29756
Make GC emails also delete orphaned verifications 2023-09-29 13:59:11 +03:00
Saku Laesvuori 04d0efb545
Remove redundant imports 2023-09-29 13:37:19 +03:00
4 changed files with 15 additions and 12 deletions

View File

@ -137,6 +137,13 @@ deleteExpiredEmails time = runQuery $ delete $ do
verification <- from $ table @DBEmailVerification
where_ $ verification ^. DBEmailVerificationExpires <=. val time
deleteOrphanedVerifications :: MonadDB m => m ()
deleteOrphanedVerifications = runQuery $ delete $ do
verification <- from $ table @DBEmailVerification
where_ $ (==. val (0 :: Int)) $ subSelectCount $ do
email <- from $ table @DBEmail
where_ $ email ^. DBEmailVid ==. just (verification ^. DBEmailVerificationId)
deleteUsersWithoutEmail :: MonadDB m => m ()
deleteUsersWithoutEmail = runQuery $ delete $ do
user <- from $ table @DBUser

View File

@ -19,20 +19,11 @@ import Datarekisteri.Core.Types
import Data.Aeson (ToJSON(..), FromJSON(..))
import Data.ByteArray (ByteArray, ByteArrayAccess)
import Data.Morpheus.App.Internal.Resolving (Resolver, LiftOperation)
import Data.Morpheus.Server.Types (SCALAR)
import Data.Morpheus.Types (GQLType, DecodeScalar(..), KIND, EncodeScalar(..),
ScalarValue(..), MonadError, GQLError)
import Data.Morpheus.Types.GQLScalar (scalarToJSON, scalarFromJSON)
import Data.Time (UTCTime, getCurrentTime, NominalDiffTime, addUTCTime, Day)
import Data.Time.Format.ISO8601 (iso8601Show, iso8601ParseM)
import qualified Data.Text as T
import Data.Char (isSpace)
import Data.Morpheus.Types (MonadError, GQLError)
import Data.Time (getCurrentTime)
import Database.Persist.Class (PersistField(..))
import Database.Persist.PersistValue (PersistValue(..))
import Database.Persist.Sql (PersistFieldSql(..), SqlBackend)
import Network.Mail.Mime (Mail, Address(..))
import Text.Email.Validate (EmailAddress, toByteString, validate, emailAddress)
import qualified "base64" Data.ByteString.Base64 as B64 (encodeBase64, decodeBase64)
import "cryptonite" Crypto.Random (MonadRandom(..))
forward :: Monad m => [a] -> m [Maybe a]

View File

@ -58,6 +58,7 @@ gcEmailsMain :: CLIM ()
gcEmailsMain = do
time <- currentTime
deleteExpiredEmails time
deleteOrphanedVerifications
gcApplicationsMain :: CLIM ()
gcApplicationsMain = do

View File

@ -204,6 +204,9 @@ instance Yesod DataIdClient where
--bg-colour: #ffffff;
--fg-colour: #181c22;
}
* {
box-sizing: border-box;
}
html {
font-family: "Fira Sans", sans-serif;
height: 100%;
@ -239,7 +242,7 @@ instance Yesod DataIdClient where
margin-bottom: 0.3em;
}
form {
max-width: 20em;
max-width: min(30em,100%);
}
summary > h2 {
display: inline-block;
@ -330,6 +333,7 @@ instance Yesod DataIdClient where
$doctype 5
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<title>#{pageTitle p}
^{pageHead p}
<body>