api: use commentoExportV1 struct

This commit is contained in:
Adhityaa Chandrasekar 2020-03-31 06:03:26 -04:00
parent 0d929595cc
commit 885b4c6689
3 changed files with 4 additions and 10 deletions

View File

@ -15,13 +15,7 @@ func domainExportBeginError(email string, toName string, domain string, err erro
}
func domainExportBegin(email string, toName string, domain string) {
type dataExport struct {
Version int `json:"version"`
Comments []comment `json:"comments"`
Commenters []commenter `json:"commenters"`
}
e := dataExport{Version: 1, Comments: []comment{}, Commenters: []commenter{}}
e := commentoExportV1{Version: 1, Comments: []comment{}, Commenters: []commenter{}}
statement := `
SELECT commentHex, domain, path, commenterHex, markdown, parentHex, score, state, creationDate

View File

@ -8,7 +8,7 @@ import (
"net/http"
)
type dataImport struct {
type commentoExportV1 struct {
Version int `json:"version"`
Comments []comment `json:"comments"`
Commenters []commenter `json:"commenters"`
@ -44,7 +44,7 @@ func domainImportCommento(domain string, url string) (int, error) {
return 0, errorInternal
}
var data dataImport
var data commentoExportV1
if err := json.Unmarshal(contents, &data); err != nil {
logger.Errorf("cannot unmarshal JSON at %s: %v", url, err)
return 0, errorInternal

View File

@ -14,7 +14,7 @@ func TestImportCommento(t *testing.T) {
failTestOnError(t, setupTestEnv())
// Create JSON data
data := dataImport{
data := commentoExportV1{
Version: 1,
Comments: []comment{
{