@@ -23,8 +23,8 @@ const toEpoch = date => (new Date(date)).getTime()
23
23
function convertPayload ( user ) {
24
24
const memberProfile = {
25
25
userId : Number ( user . id ) ,
26
- firstName : user . firstName ,
27
- lastName : user . lastName ,
26
+ firstName : user . firstName ? user . firstName : 'N/A' ,
27
+ lastName : user . lastName ? user . lastName : 'N/A' ,
28
28
handle : user . handle ,
29
29
handleLower : user . handle . toLowerCase ( ) ,
30
30
email : user . email ,
@@ -105,6 +105,7 @@ async function processCreateUser (message, producer) {
105
105
if ( ! message . payload . createdAt ) {
106
106
message . payload . createdAt = new Date ( )
107
107
}
108
+
108
109
const memberProfile = convertPayload ( message . payload )
109
110
const record = formatRecord ( memberProfile )
110
111
@@ -134,8 +135,8 @@ processCreateUser.schema = {
134
135
id : joi . string ( ) . trim ( ) . required ( ) ,
135
136
handle : joi . string ( ) . trim ( ) . required ( ) ,
136
137
email : joi . string ( ) . trim ( ) . email ( ) . required ( ) ,
137
- firstName : joi . string ( ) . trim ( ) . required ( ) ,
138
- lastName : joi . string ( ) . trim ( ) . required ( ) ,
138
+ firstName : joi . string ( ) . trim ( ) . allow ( '' ) . allow ( null ) ,
139
+ lastName : joi . string ( ) . trim ( ) . allow ( '' ) . allow ( null ) ,
139
140
profiles : joi . array ( ) . allow ( null ) ,
140
141
status : joi . string ( ) . trim ( ) ,
141
142
active : joi . boolean ( ) . allow ( null ) ,
0 commit comments