feat: notify on new room (wip)
This commit is contained in:
parent
6e285076d4
commit
92a97e8f8a
12 changed files with 119 additions and 14 deletions
|
@ -1,6 +1,6 @@
|
|||
{-# LANGUAGE DeriveGeneric #-}
|
||||
|
||||
module Types.Participant (Participant) where
|
||||
module Types.Participant (Participant (Participant, displayName)) where
|
||||
|
||||
import ClassyPrelude
|
||||
import Data.Aeson (FromJSON, ToJSON)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{-# LANGUAGE DeriveGeneric #-}
|
||||
|
||||
module Types.RoomData (RoomData, RoomsData) where
|
||||
module Types.RoomData (RoomData, RoomsData, sameName, roomNotEmpty, prettyPrintOpenedRoom) where
|
||||
|
||||
import ClassyPrelude
|
||||
import Data.Aeson (FromJSON, ToJSON)
|
||||
import Types.Participant (Participant)
|
||||
import Types.Participant (Participant (Participant, displayName))
|
||||
|
||||
data RoomData = RoomData
|
||||
{ roomName :: RoomName,
|
||||
|
@ -12,6 +12,16 @@ data RoomData = RoomData
|
|||
}
|
||||
deriving (Generic, Show, Eq)
|
||||
|
||||
sameName :: RoomData -> RoomData -> Bool
|
||||
sameName RoomData {roomName = name1} RoomData {roomName = name2} = name1 == name2
|
||||
|
||||
roomNotEmpty :: RoomData -> Bool
|
||||
roomNotEmpty RoomData {participants = participants} = not $ null participants
|
||||
|
||||
prettyPrintOpenedRoom :: RoomData -> (Text, Text)
|
||||
prettyPrintOpenedRoom RoomData {roomName = roomName, participants = participants} =
|
||||
(roomName, fromMaybe "" (headMay (map (\Participant {displayName = displayName} -> displayName) participants)))
|
||||
|
||||
type RoomName = Text
|
||||
|
||||
type RoomsData = [RoomData]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue