Skip to content

Commit 96747c7

Browse files
Add url heartbeat type (#59)
1 parent 2ea8a33 commit 96747c7

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Dockerfile.arm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN yarn run prod && rm -rf .git
1616
#
1717
# Build the server.
1818
#
19-
FROM ubuntu:20.10 as server-builder
19+
FROM ubuntu:21.04 as server-builder
2020

2121
WORKDIR /build
2222

@@ -41,7 +41,7 @@ RUN cabal configure --disable-optimization && \
4141
cabal build -j2 exe:hakatime && mkdir -p /app/bin && \
4242
cp /build/dist-newstyle/build/*-linux/ghc-*/hakatime-*/x/hakatime/opt/build/hakatime/hakatime /app/bin/hakatime
4343

44-
FROM ubuntu:20.10
44+
FROM ubuntu:21.04
4545

4646
ENV DEBIAN_FRONTEND=noninteractive
4747

src/Haka/Db/Statements.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ insertHeartBeat = Statement query params result True
379379
entityText FileType = "file"
380380
entityText AppType = "app"
381381
entityText DomainType = "domain"
382+
entityText UrlType = "url"
382383

383384
getProjectStats :: Statement (Text, Text, UTCTime, UTCTime, Int64) [ProjectStatRow]
384385
getProjectStats = Statement query params result True

src/Haka/Types.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ data HeartbeatPayload = HeartbeatPayload
241241
file_lines :: Maybe Int64,
242242
-- | Name of the project.
243243
project :: Maybe Text,
244-
-- | Type of the entity that triggered the heartbeat (file, app, domain)
244+
-- | Type of the entity that triggered the heartbeat (file, app, domain, url)
245245
ty :: EntityType,
246246
-- | Unix timestamp for when the heartbeat was generated.
247247
time_sent :: Double
@@ -254,21 +254,23 @@ instance FromJSON HeartbeatPayload where
254254
instance ToJSON HeartbeatPayload where
255255
toJSON = genericToJSON convertReservedWords
256256

257-
data EntityType = FileType | AppType | DomainType
257+
data EntityType = FileType | AppType | DomainType | UrlType
258258
deriving (Eq, Show, Generic)
259259

260260
instance FromJSON EntityType where
261261
parseJSON (A.String p) = case p of
262262
"file" -> return FileType
263263
"app" -> return AppType
264264
"domain" -> return DomainType
265-
_ -> fail "Value can only be one of ['file', 'app', 'domain']"
265+
"url" -> return UrlType
266+
_ -> fail "Value can only be one of ['file', 'app', 'domain', 'url']"
266267
parseJSON _ = fail "Expected a string value"
267268

268269
instance ToJSON EntityType where
269270
toJSON FileType = A.String "file"
270271
toJSON AppType = A.String "app"
271272
toJSON DomainType = A.String "domain"
273+
toJSON UrlType = A.String "url"
272274

273275
data LeaderboardRow = LeaderboardRow
274276
{ leadProject :: Text,

0 commit comments

Comments
 (0)