@@ -8,7 +8,8 @@ import Data.Time.Clock (UTCTime(utctDay), diffUTCTime)
8
8
import Data.Time.Format.ISO8601 (iso8601Show )
9
9
10
10
import Data.Aeson (Value , (.=) , object )
11
- import qualified Data.Text as T
11
+ import qualified Data.Aeson.Key as Key
12
+
12
13
import qualified Data.Set as S
13
14
14
15
import Distribution.Server.Features.Browse.Options (BrowseOptions (.. ), Direction (.. ), Column (.. ), Sort (.. ), NormalColumn (.. ), IsSearch (.. ))
@@ -33,30 +34,30 @@ applyFilter now isSearch coreResource userResource tagsResource DistroFeature{qu
33
34
packageIndexInfoToValue :: PackageItem -> Value
34
35
packageIndexInfoToValue PackageItem {.. } =
35
36
object
36
- [ T. pack " name" .= renderPackage itemName
37
- , T. pack " downloads" .= itemDownloads
38
- , T. pack " votes" .= itemVotes
39
- , T. pack " description" .= itemDesc
40
- , T. pack " tags" .= map renderTag (S. toAscList itemTags)
41
- , T. pack " lastUpload" .= iso8601Show itemLastUpload
42
- , T. pack " maintainers" .= map renderUser itemMaintainer
37
+ [ Key. fromString " name" .= renderPackage itemName
38
+ , Key. fromString " downloads" .= itemDownloads
39
+ , Key. fromString " votes" .= itemVotes
40
+ , Key. fromString " description" .= itemDesc
41
+ , Key. fromString " tags" .= map renderTag (S. toAscList itemTags)
42
+ , Key. fromString " lastUpload" .= iso8601Show itemLastUpload
43
+ , Key. fromString " maintainers" .= map renderUser itemMaintainer
43
44
]
44
45
renderTag :: Tag -> Value
45
46
renderTag tag =
46
47
object
47
- [ T. pack " uri" .= tagUri tagsResource " " tag
48
- , T. pack " display" .= display tag
48
+ [ Key. fromString " uri" .= tagUri tagsResource " " tag
49
+ , Key. fromString " display" .= display tag
49
50
]
50
51
renderUser :: UserName -> Value
51
52
renderUser user =
52
53
object
53
- [ T. pack " uri" .= userPageUri userResource " " user
54
- , T. pack " display" .= display user
54
+ [ Key. fromString " uri" .= userPageUri userResource " " user
55
+ , Key. fromString " display" .= display user
55
56
]
56
57
renderPackage pkg =
57
58
object
58
- [ T. pack " uri" .= corePackageNameUri coreResource " " pkg
59
- , T. pack " display" .= display pkg
59
+ [ Key. fromString " uri" .= corePackageNameUri coreResource " " pkg
60
+ , Key. fromString " display" .= display pkg
60
61
]
61
62
62
63
includeItem :: PackageItem -> Filter -> IO Bool
0 commit comments