fix: Convert integer timestamps to strings for database insertion
The APRS parser is sending timestamp as integer (Unix timestamp) but our schema expects a string. This was causing Ecto.ChangeError in production preventing packet insertion. Convert integer timestamps to strings in the field conversion pipeline. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b56a988e52
commit
01bfb11ab4
1 changed files with 12 additions and 1 deletions
|
|
@ -450,7 +450,8 @@ defmodule Aprsme.PacketConsumer do
|
|||
|
||||
# Convert field names that don't match our schema
|
||||
defp convert_field_names(attrs) do
|
||||
then(attrs, fn a ->
|
||||
attrs
|
||||
|> then(fn a ->
|
||||
# Convert aprs_messaging? to aprs_messaging
|
||||
case Map.get(a, :aprs_messaging?) || Map.get(a, "aprs_messaging?") do
|
||||
nil ->
|
||||
|
|
@ -463,6 +464,16 @@ defmodule Aprsme.PacketConsumer do
|
|||
|> Map.delete("aprs_messaging?")
|
||||
end
|
||||
end)
|
||||
|> then(fn a ->
|
||||
# Convert timestamp from integer to string if needed
|
||||
case Map.get(a, :timestamp) do
|
||||
timestamp when is_integer(timestamp) ->
|
||||
Map.put(a, :timestamp, Integer.to_string(timestamp))
|
||||
|
||||
_ ->
|
||||
a
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
# Convert latitude/longitude to lat/lon if present at top level
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue