api: use commentoExportV1 struct
This commit is contained in:
parent
0d929595cc
commit
885b4c6689
@ -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
|
||||
|
@ -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
|
||||
|
@ -14,7 +14,7 @@ func TestImportCommento(t *testing.T) {
|
||||
failTestOnError(t, setupTestEnv())
|
||||
|
||||
// Create JSON data
|
||||
data := dataImport{
|
||||
data := commentoExportV1{
|
||||
Version: 1,
|
||||
Comments: []comment{
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user