Move Network.CatalogPostType into Common

This commit is contained in:
towards-a-new-leftypol 2024-03-05 20:08:06 -05:00
parent 1874f3a043
commit 3f6566ab7b
8 changed files with 10 additions and 77 deletions

View File

@ -67,7 +67,7 @@ executable chandlr
Network.Http
Network.Client
Network.ClientTypes
Network.CatalogPostType
Common.Network.CatalogPostType
Network.BoardType
Network.SiteType
Network.PostType
@ -86,7 +86,7 @@ executable chandlr
Parsing.PostPartType
Component.TimeControl
Component.Search
Component.Search.SearchTypes
Common.Component.Search.SearchTypes
-- LANGUAGE extensions used by modules in this package.

@ -1 +1 @@
Subproject commit a77cfddc7a757bef9c1ef578c3a5eab54795cb37
Subproject commit 443f2e37adcef18a78c9c454594132c05495026d

View File

@ -23,8 +23,8 @@ import Miso
)
import Miso.String (toMisoString, MisoString)
import Network.CatalogPostType (CatalogPost)
import qualified Network.CatalogPostType as CatalogPost
import Common.Network.CatalogPostType (CatalogPost)
import qualified Common.Network.CatalogPostType as CatalogPost
import Parsing.EmbedParser (extractVideoId)
data Model = Model

View File

@ -31,7 +31,7 @@ import qualified Network.Client as Client
import Network.Http (HttpResult (..))
import Control.Concurrent.MVar (tryTakeMVar, takeMVar, putMVar, swapMVar)
import Component.Search.SearchTypes
import Common.Component.Search.SearchTypes
update :: Interface a -> Action -> Model -> Effect a Model
update iface (SearchChange q) model = model { searchTerm = q } <# do

View File

@ -1,29 +0,0 @@
module Component.Search.SearchTypes where
import Data.JSString (JSString)
import Network.Http (HttpResult (..))
import Control.Concurrent.MVar (MVar)
import qualified Network.ClientTypes as Client
import Network.CatalogPostType (CatalogPost)
data Action
= SearchChange JSString
| OnSubmit
| ChangeAndSubmit JSString
| SearchResult (HttpResult [ CatalogPost ])
| PassPostsToSelf [ CatalogPost ] -- I think I don't understand something about the update type but I had to add this...
| NoAction
data Model = Model
{ searchTerm :: JSString
, searchVar :: MVar JSString
, clientModel :: Client.Model
, displayResults :: [ CatalogPost ]
} deriving Eq
data Interface a = Interface
{ passAction :: Action -> a
, clientIface :: Client.Interface a [ CatalogPost ]
, searchResults :: JSString -> a
}

View File

@ -46,13 +46,13 @@ import Servant.API
import Common.FrontEnd.Action
import Common.FrontEnd.Routes
import qualified Network.Client as Client
import Network.CatalogPostType (CatalogPost)
import qualified Network.CatalogPostType as CatalogPost
import Common.Network.CatalogPostType (CatalogPost)
import qualified Common.Network.CatalogPostType as CatalogPost
import qualified Component.CatalogGrid as Grid
import qualified Component.ThreadView as Thread
import qualified Component.TimeControl as TC
import qualified Component.Search as Search
import qualified Component.Search.SearchTypes as Search
import qualified Common.Component.Search.SearchTypes as Search
data Model = Model

View File

@ -1,38 +0,0 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
module Network.CatalogPostType
( CatalogPost (..) )
where
import GHC.Generics
import Data.Aeson (FromJSON, ToJSON)
import Data.Time.Clock (UTCTime) -- Required for timestamp with time zone
import Data.Int (Int64)
import Data.Text (Text)
-- import Common.AttachmentType (Dimension)
data CatalogPost = CatalogPost
{ post_id :: Maybe Int64
, board_post_id :: Int64
, board_thread_id :: Int64
, creation_time :: UTCTime
, bump_time :: UTCTime
, body :: Maybe Text
, name :: Maybe Text
, subject :: Maybe Text
, email :: Maybe Text
, thread_id :: Int
-- , post_count :: Int
, embed :: Maybe Text
, estimated_post_count :: Int
, site_name :: Text
, pathpart :: Text
-- , site_id :: Int
, file_mimetype :: Maybe Text
, file_illegal :: Maybe Bool
-- , file_resolution :: Maybe Dimension
, file_name :: Maybe Text
, file_extension :: Maybe Text
, file_thumb_extension :: Maybe Text
} deriving (Show, Generic, FromJSON, ToJSON, Eq)

View File

@ -29,7 +29,7 @@ import Miso (effectSub, Effect)
import Miso.String (toMisoString)
import qualified Network.Http as Http
import Network.CatalogPostType (CatalogPost)
import Common.Network.CatalogPostType (CatalogPost)
import Network.SiteType (Site)
import qualified Common.FrontEnd.Action as A
import Network.ClientTypes