Skip to content

Commit 14faf26

Browse files
authored
Merge pull request #1261 from hargata/Hargata/fix.notes.api.endpoint
more clean up
2 parents 2f7ea74 + d230e8f commit 14faf26

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Controllers/API/NoteController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public IActionResult AddNote(int vehicleId, NoteRecordExportModel input)
140140
Tags = string.IsNullOrWhiteSpace(input.Tags) ? new List<string>() : input.Tags.Split(' ').Distinct().ToList()
141141
};
142142
_noteDataAccess.SaveNoteToVehicle(note);
143-
StaticHelper.NotifyAsync(_config.GetWebHookUrl(),WebHookPayload.FromNoteRecord(note, "note.add.api", User.Identity.Name));
143+
StaticHelper.NotifyAsync(_config.GetWebHookUrl(),WebHookPayload.FromNoteRecord(note, "note.add.api", User.Identity?.Name ?? string.Empty));
144144
return Json(OperationResponse.Succeed("Note Added", new { recordId = note.Id }));
145145
}
146146
catch (Exception ex)
@@ -169,7 +169,7 @@ public IActionResult DeleteNote(int id)
169169
var result = _noteDataAccess.DeleteNoteById(existingRecord.Id);
170170
if (result)
171171
{
172-
StaticHelper.NotifyAsync(_config.GetWebHookUrl(), WebHookPayload.FromNoteRecord(existingRecord, "note.delete.api", User.Identity.Name));
172+
StaticHelper.NotifyAsync(_config.GetWebHookUrl(), WebHookPayload.FromNoteRecord(existingRecord, "note.delete.api", User.Identity?.Name ?? string.Empty));
173173
}
174174
return Json(OperationResponse.Conditional(result, "Note Deleted"));
175175
}
@@ -217,7 +217,7 @@ public IActionResult UpdateNote(NoteRecordExportModel input)
217217
existingRecord.ExtraFields = input.ExtraFields;
218218
existingRecord.Tags = string.IsNullOrWhiteSpace(input.Tags) ? new List<string>() : input.Tags.Split(' ').Distinct().ToList();
219219
_noteDataAccess.SaveNoteToVehicle(existingRecord);
220-
StaticHelper.NotifyAsync(_config.GetWebHookUrl(), WebHookPayload.FromNoteRecord(existingRecord, "note.update.api", User.Identity.Name));
220+
StaticHelper.NotifyAsync(_config.GetWebHookUrl(), WebHookPayload.FromNoteRecord(existingRecord, "note.update.api", User.Identity?.Name ?? string.Empty));
221221
}
222222
else
223223
{

0 commit comments

Comments
 (0)