Skip to content

Commit

Permalink
Merge pull request #20 from Financial-Times/feature/UPPSF-1994-delete…
Browse files Browse the repository at this point in the history
…-payload-changes

Delete payload id -> uuid
  • Loading branch information
georgi-denchew committed Jan 7, 2021
2 parents 30af223 + ede4785 commit 258ba5c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
13 changes: 11 additions & 2 deletions mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
)

const (
videoUUIDField = "id"
videoUUIDField = "uuid"
videoIDField = "id"
relatedField = "related"
deletedField = "deleted"
relatedItemIDField = "uuid"
Expand All @@ -28,7 +29,15 @@ type relatedContentMapper struct {
}

func (m *relatedContentMapper) mapRelatedContent() ([]byte, string, error) {
videoUUID, err := getRequiredStringField(videoUUIDField, m.unmarshalled)
var uuidField string

if m.isDeleteEvent() {
uuidField = videoUUIDField
} else {
uuidField = videoIDField
}

videoUUID, err := getRequiredStringField(uuidField, m.unmarshalled)
if err != nil {
return nil, "", err
}
Expand Down
8 changes: 7 additions & 1 deletion test-resources/next-video-delete-input.json
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
{"deleted": true,"lastModified": "2017-04-04T14:42:58.920Z","publishReference": "tid_bycjmmcj4r","type": "video","id": "e2290d14-7e80-4db8-a715-949da4de9a07"}
{
"deleted": true,
"lastModified": "2017-04-04T14:42:58.920Z",
"publishReference": "tid_bycjmmcj4r",
"type": "video",
"uuid": "e2290d14-7e80-4db8-a715-949da4de9a07"
}

0 comments on commit 258ba5c

Please sign in to comment.