wip
This commit is contained in:
parent
f55a982f57
commit
ce338f067b
@ -102,16 +102,16 @@ instance VersionedCatalog AppM 1 where
|
|||||||
getChannels = getChannelsV1
|
getChannels = getChannelsV1
|
||||||
getBooks = getBooksV1
|
getBooks = getBooksV1
|
||||||
|
|
||||||
relUrl :: Text -> Rel
|
relUrl :: Link -> Rel
|
||||||
relUrl x = Rel ("/api/current/" <> x)
|
relUrl x = Rel ("/api/current/" <> (pack . uriPath . linkURI $ x))
|
||||||
|
|
||||||
getBooksV1 :: Channel.ChannelID -> SafeUser -> AppM (Catalog 1)
|
getBooksV1 :: Channel.ChannelID -> SafeUser -> AppM (Catalog 1)
|
||||||
getBooksV1 identifier SafeUser{} = do
|
getBooksV1 identifier SafeUser{} = do
|
||||||
updated <- liftIO getCurrentTime
|
updated <- liftIO getCurrentTime
|
||||||
let self = relUrl selfUrl
|
let self = relUrl selfUrl
|
||||||
start = relUrl startUrl
|
start = relUrl startUrl
|
||||||
selfUrl = pack . uriPath . linkURI $ safeLink (Proxy @(BaseAPI 1)) (Proxy @(ChannelCatalog 1)) identifier
|
selfUrl = safeLink (Proxy @(BaseAPI 1)) (Proxy @(ChannelCatalog 1)) identifier
|
||||||
startUrl = pack . uriPath . linkURI $ safeLink (Proxy @(BaseAPI 1)) (Proxy @(RootCatalog 1))
|
startUrl = safeLink (Proxy @(BaseAPI 1)) (Proxy @(RootCatalog 1))
|
||||||
entries = mempty
|
entries = mempty
|
||||||
pagination = Pagination Nothing Nothing
|
pagination = Pagination Nothing Nothing
|
||||||
pure CatalogV1{..}
|
pure CatalogV1{..}
|
||||||
@ -123,7 +123,7 @@ getChannelsV1 SafeUser{username} = do
|
|||||||
-- I'm not sure if this safe link approach is really useable with this
|
-- I'm not sure if this safe link approach is really useable with this
|
||||||
-- api hierarchy since I can't access the topmost api from here. Also
|
-- api hierarchy since I can't access the topmost api from here. Also
|
||||||
-- authentication would bring a little bit of extra effort as well
|
-- authentication would bring a little bit of extra effort as well
|
||||||
selfUrl = pack . uriPath . linkURI $ safeLink (Proxy @(BaseAPI 1)) (Proxy @(RootCatalog 1))
|
selfUrl = safeLink (Proxy @(BaseAPI 1)) (Proxy @(RootCatalog 1))
|
||||||
start = self
|
start = self
|
||||||
pagination = Pagination Nothing Nothing
|
pagination = Pagination Nothing Nothing
|
||||||
entries <- map (fromChannel updated) <$> runDB (Channel.userChannels username)
|
entries <- map (fromChannel updated) <$> runDB (Channel.userChannels username)
|
||||||
@ -131,7 +131,7 @@ getChannelsV1 SafeUser{username} = do
|
|||||||
where
|
where
|
||||||
fromChannel :: UTCTime -> Channel.Channel -> Entry 1
|
fromChannel :: UTCTime -> Channel.Channel -> Entry 1
|
||||||
fromChannel updated Channel.Channel{..} =
|
fromChannel updated Channel.Channel{..} =
|
||||||
let url = pack . uriPath . linkURI $ safeLink (Proxy @(BaseAPI 1)) (Proxy @(ChannelCatalog 1)) identifier
|
let url = safeLink (Proxy @(BaseAPI 1)) (Proxy @(ChannelCatalog 1)) identifier
|
||||||
self = relUrl url
|
self = relUrl url
|
||||||
in EntryV1 channel channel updated channel (Left $ SubSection self)
|
in EntryV1 channel channel updated channel (Left $ SubSection self)
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ module Database.Channel
|
|||||||
, clearChannels
|
, clearChannels
|
||||||
, booksChannels
|
, booksChannels
|
||||||
, Channel(..)
|
, Channel(..)
|
||||||
, ChannelID )
|
, ChannelID(..) )
|
||||||
where
|
where
|
||||||
|
|
||||||
import ClassyPrelude
|
import ClassyPrelude
|
||||||
|
Loading…
Reference in New Issue
Block a user