Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
191
Issues
191
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
f38fcc6a
Verified
Commit
f38fcc6a
authored
Jul 23, 2025
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[document] implement hh/mm/ss for ToNode HyperdataDocument instance
parent
c0b775e0
Pipeline
#7770
passed with stages
in 42 minutes and 40 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
+24
-7
Insert.hs
src/Gargantext/Database/Query/Table/Node/Document/Insert.hs
+18
-7
Defaults.hs
src/Gargantext/Defaults.hs
+6
-0
No files found.
src/Gargantext/Database/Query/Table/Node/Document/Insert.hs
View file @
f38fcc6a
...
...
@@ -57,8 +57,9 @@ the concatenation of the parameters defined by @shaParameters@.
module
Gargantext.Database.Query.Table.Node.Document.Insert
where
import
Data.Fixed
(
Fixed
(
MkFixed
))
import
Data.Text
qualified
as
DT
(
pack
,
concat
,
take
,
filter
,
toLower
)
import
Data.Time.Segment
(
jour
)
import
Data.Time.Segment
qualified
as
DTS
import
Database.PostgreSQL.Simple
(
FromRow
,
Query
,
Only
(
..
))
import
Database.PostgreSQL.Simple.FromRow
(
fromRow
,
field
)
import
Database.PostgreSQL.Simple.SqlQQ
(
sql
)
...
...
@@ -115,7 +116,7 @@ instance InsertDb HyperdataContact
,
toField
u
,
toField
p
,
toField
$
maybe
"Contact"
(
DT
.
take
255
)
(
Just
"Name"
)
-- (_hc_name h)
,
toField
$
jour
0
1
1
-- TODO put default date
,
toField
$
DTS
.
jour
(
fromIntegral
Defaults
.
year
)
(
fromIntegral
Defaults
.
month
)
(
fromIntegral
Defaults
.
day
)
-- , (toField . toJSON) (addUniqId h)
]
...
...
@@ -274,22 +275,32 @@ class ToNode a
toNode
::
HasDBid
NodeType
=>
UserId
->
Maybe
ParentId
->
a
->
Node
a
instance
ToNode
HyperdataDocument
where
toNode
u
p
h
=
Node
0
Nothing
(
toDBid
NodeDocument
)
u
p
n
date
h
toNode
u
p
h
=
Node
{
_node_id
=
0
,
_node_hash_id
=
Nothing
,
_node_typename
=
toDBid
NodeDocument
,
_node_user_id
=
u
,
_node_parent_id
=
p
,
_node_name
=
n
,
_node_date
=
date
,
_node_hyperdata
=
h
}
where
n
=
maybe
"No Title"
(
DT
.
take
255
)
(
_hd_title
h
)
date
=
jour
y
m
d
date
=
DTS
.
date
y
m
d
hh
mn
s
-- NOTE: There is no year '0' in postgres, there is year 1 AD and beofre that year 1 BC:
-- select '0001-01-01'::date, '0001-01-01'::date - '1 day'::interval;
-- 0001-01-01 0001-12-31 00:00:00 BC
y
=
fromIntegral
$
fromMaybe
Defaults
.
day
$
_hd_publication_year
h
y
=
fromIntegral
$
fromMaybe
(
fromIntegral
Defaults
.
year
)
$
_hd_publication_year
h
m
=
fromMaybe
Defaults
.
month
$
_hd_publication_month
h
d
=
fromMaybe
(
fromIntegral
Defaults
.
year
)
$
_hd_publication_day
h
d
=
fromMaybe
(
fromIntegral
Defaults
.
day
)
$
_hd_publication_day
h
hh
=
fromMaybe
(
fromIntegral
Defaults
.
hour
)
$
_hd_publication_hour
h
mn
=
fromMaybe
(
fromIntegral
Defaults
.
minute
)
$
_hd_publication_minute
h
s
=
MkFixed
$
fromIntegral
$
fromMaybe
Defaults
.
second
$
_hd_publication_second
h
-- TODO better Node
instance
ToNode
HyperdataContact
where
toNode
u
p
=
Node
0
Nothing
(
toDBid
NodeContact
)
u
p
"Contact"
date
where
date
=
jour
2020
01
01
date
=
DTS
.
jour
2020
01
01
src/Gargantext/Defaults.hs
View file @
f38fcc6a
...
...
@@ -21,3 +21,9 @@ month :: Int
month
=
1
day
::
Int
day
=
1
hour
::
Int
hour
=
0
minute
::
Int
minute
=
0
second
::
Int
second
=
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment