unee-t / lambda2sqs

Relays SQL triggered payloads to MEFE via a queue
https://ap-southeast-1.console.aws.amazon.com/lambda/home?region=ap-southeast-1#/applications/lambda2sqs
GNU Affero General Public License v3.0
0 stars 4 forks source link

more details on the event payload from the BZ DB schema v3.14+ #2

Closed franck-boullier closed 6 years ago

franck-boullier commented 6 years ago

@kaihendry merge if this is OK for you

kaihendry commented 6 years ago

I have no idea how to tell what's changed for my events I am testing with or how to review this.

kaihendry commented 6 years ago

Oh I see the files now. They don't appear to be valid JSON.

franck-boullier commented 6 years ago

They don't appear to be valid JSON.

Any suggestion/pointer on what might be wrong?

kaihendry commented 6 years ago

https://s.natalian.org/2018-06-14/json.mp4

kaihendry commented 6 years ago

tl;dr remove the comments otherwise i can't merge. I could do this for you.

Comments like these are not permitted in JSON:

# The formats are
#   notification_type -> varchar(255)
#   bz_source_table -> varchar(240)
#   notification_id -> varchar(255)
#   created_datetime -> datetime
#   unit_id -> smallint(6)
#   case_id -> mediumint(9)
#   case_title -> varchar(255)
#   reporter_user_id -> mediumint(9)

Furthermore since your procedure SQL doesn't seem to treat integer types correctly, i.e. you quote them, currently at the /api/db-change-message/process API that ingests these payloads, I am assuming every field is a string at first. Then I am looking at the example to work out if I need to parseInt.

franck-boullier commented 6 years ago

remove the comments otherwise i can't merge

@kaihendry: done

kaihendry commented 6 years ago

"current_list_of_invitees": "13, 15, 23" should be "current_list_of_invitees": [13, 15, 23] but I understand it can be hard to stringify JSON correctly from SQL. So my code will be making some assumptions of the string payloads.

kaihendry commented 6 years ago

I only just noticed assignee_user_id has been renamed? This is breaking the code. WHY???


case_assignee_updated.json:     "assignee_user_id": "19",
case_assignee_updated.json:     "old_case_assignee_user_id": "12",
case_assignee_updated.json:     "new_case_assignee_user_id": "19",
case_new.json:  "old_case_assignee_user_id": "12",
case_new.json:  "new_case_assignee_user_id": "12",
case_new_message.json:  "old_case_assignee_user_id": "12",
case_new_message.json:  "new_case_assignee_user_id": "21",
case_updated.json:      "old_case_assignee_user_id": "12",
case_updated.json:      "new_case_assignee_user_id": "12",
case_user_invited.json: "old_case_assignee_user_id": "12",
case_user_invited.json: "new_case_assignee_user_id": "20",
franck-boullier commented 6 years ago

I only just noticed assignee_user_id has been renamed (...) WHY???

@kaihendry this is to avoid confusion when the assignee is changed (who is the assigned person?). Having both values:

allows us to knowingly choose who we want to send the notification to