api: fix negative timestamps in notifications
This commit is contained in:
parent
e3a25e5368
commit
c2061dc69e
@ -208,12 +208,24 @@ func NotificationFromDatabaseModel(dbNotification database.VulnerabilityNotifica
|
|||||||
nextPageStr = DBPageNumberToString(nextPage)
|
nextPageStr = DBPageNumberToString(nextPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var created, notified, deleted string
|
||||||
|
if !dbNotification.Created.IsZero() {
|
||||||
|
created = fmt.Sprintf("%d", dbNotification.Created.Unix())
|
||||||
|
}
|
||||||
|
if !dbNotification.Notified.IsZero() {
|
||||||
|
notified = fmt.Sprintf("%d", dbNotification.Notified.Unix())
|
||||||
|
}
|
||||||
|
if !dbNotification.Deleted.IsZero() {
|
||||||
|
deleted = fmt.Sprintf("%d", dbNotification.Deleted.Unix())
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(jzelinskie): implement "changed" key
|
// TODO(jzelinskie): implement "changed" key
|
||||||
|
fmt.Println(dbNotification.Deleted.IsZero())
|
||||||
return Notification{
|
return Notification{
|
||||||
Name: dbNotification.Name,
|
Name: dbNotification.Name,
|
||||||
Created: fmt.Sprintf("%d", dbNotification.Created.Unix()),
|
Created: created,
|
||||||
Notified: fmt.Sprintf("%d", dbNotification.Notified.Unix()),
|
Notified: notified,
|
||||||
Deleted: fmt.Sprintf("%d", dbNotification.Deleted.Unix()),
|
Deleted: deleted,
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Page: DBPageNumberToString(page),
|
Page: DBPageNumberToString(page),
|
||||||
NextPage: nextPageStr,
|
NextPage: nextPageStr,
|
||||||
|
Loading…
Reference in New Issue
Block a user