fix messaging name

This commit is contained in:
Graham McIntire 2025-06-24 14:29:47 -05:00
parent 010d411be9
commit 229c8f8305
No known key found for this signature in database
6 changed files with 42 additions and 42 deletions

View file

@ -7,7 +7,7 @@ defmodule Aprsme.DataExtended do
alias Aprsme.DataExtended alias Aprsme.DataExtended
embedded_schema do embedded_schema do
field :aprsme_messaging, :boolean, default: false field :aprs_messaging, :boolean, default: false
field :comment, :string field :comment, :string
field :data_type, :string field :data_type, :string
field :latitude, :decimal field :latitude, :decimal
@ -23,7 +23,7 @@ defmodule Aprsme.DataExtended do
def changeset(%DataExtended{} = data_extended, attrs) do def changeset(%DataExtended{} = data_extended, attrs) do
data_extended data_extended
|> cast(attrs, [ |> cast(attrs, [
:aprsme_messaging, :aprs_messaging,
:comment, :comment,
:data_type, :data_type,
:latitude, :latitude,
@ -32,7 +32,7 @@ defmodule Aprsme.DataExtended do
:symbol_table_id :symbol_table_id
]) ])
|> validate_required([ |> validate_required([
:aprsme_messaging, :aprs_messaging,
:comment, :comment,
:data_type, :data_type,
:symbol_code, :symbol_code,

View file

@ -30,7 +30,7 @@ defmodule Aprsme.Packet do
# Additional packet data # Additional packet data
field(:comment, :string) field(:comment, :string)
field(:timestamp, :string) field(:timestamp, :string)
field(:aprsme_messaging, :boolean, default: false) field(:aprs_messaging, :boolean, default: false)
# Weather data # Weather data
field(:temperature, :float) field(:temperature, :float)
@ -90,7 +90,7 @@ defmodule Aprsme.Packet do
:symbol_table_id, :symbol_table_id,
:comment, :comment,
:timestamp, :timestamp,
:aprsme_messaging, :aprs_messaging,
:temperature, :temperature,
:humidity, :humidity,
:wind_speed, :wind_speed,
@ -277,8 +277,8 @@ defmodule Aprsme.Packet do
|> maybe_put(:comment, data_extended[:comment] || data_extended["comment"]) |> maybe_put(:comment, data_extended[:comment] || data_extended["comment"])
|> maybe_put(:timestamp, data_extended[:timestamp] || data_extended["timestamp"]) |> maybe_put(:timestamp, data_extended[:timestamp] || data_extended["timestamp"])
|> maybe_put( |> maybe_put(
:aprsme_messaging, :aprs_messaging,
data_extended[:aprsme_messaging?] || data_extended["aprs_messaging?"] data_extended[:aprs_messaging?] || data_extended["aprs_messaging?"]
) )
end end

View file

@ -38,7 +38,7 @@ defmodule AprsmeWeb.Api.V1.CallsignJSON do
symbol: symbol_json(packet), symbol: symbol_json(packet),
comment: packet.comment, comment: packet.comment,
timestamp: packet.timestamp, timestamp: packet.timestamp,
aprs_messaging: packet.aprsme_messaging, aprs_messaging: packet.aprs_messaging,
weather: weather_json(packet), weather: weather_json(packet),
equipment: equipment_json(packet), equipment: equipment_json(packet),
message: message_json(packet), message: message_json(packet),

View file

@ -112,7 +112,7 @@ defmodule AprsmeWeb.ApiDocsLive do
"symbol" => format_symbol(packet), "symbol" => format_symbol(packet),
"comment" => packet.comment, "comment" => packet.comment,
"timestamp" => packet.timestamp, "timestamp" => packet.timestamp,
"aprsme_messaging" => packet.aprsme_messaging, "aprs_messaging" => packet.aprs_messaging,
"weather" => format_weather(packet), "weather" => format_weather(packet),
"equipment" => format_equipment(packet), "equipment" => format_equipment(packet),
"message" => format_message(packet), "message" => format_message(packet),
@ -224,7 +224,7 @@ defmodule AprsmeWeb.ApiDocsLive do
RESTful JSON API for accessing APRS packet data and station information. RESTful JSON API for accessing APRS packet data and station information.
</p> </p>
</div> </div>
<!-- API Overview --> <!-- API Overview -->
<div class="bg-white rounded-lg shadow-sm border border-gray-200 mb-8"> <div class="bg-white rounded-lg shadow-sm border border-gray-200 mb-8">
<div class="px-6 py-4 border-b border-gray-200"> <div class="px-6 py-4 border-b border-gray-200">
@ -263,7 +263,7 @@ defmodule AprsmeWeb.ApiDocsLive do
</div> </div>
</div> </div>
</div> </div>
<!-- API Endpoints --> <!-- API Endpoints -->
<div class="space-y-8"> <div class="space-y-8">
<!-- Callsign Endpoint --> <!-- Callsign Endpoint -->
@ -373,7 +373,7 @@ defmodule AprsmeWeb.ApiDocsLive do
}, },
"comment": "Mobile Station", "comment": "Mobile Station",
"timestamp": null, "timestamp": null,
"aprsme_messaging": false, "aprs_messaging": false,
"weather": null, "weather": null,
"equipment": { "equipment": {
"manufacturer": "Kenwood", "manufacturer": "Kenwood",
@ -407,7 +407,7 @@ defmodule AprsmeWeb.ApiDocsLive do
</div> </div>
</div> </div>
</div> </div>
<!-- Response Fields Documentation --> <!-- Response Fields Documentation -->
<div class="bg-white rounded-lg shadow-sm border border-gray-200"> <div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="px-6 py-4 border-b border-gray-200"> <div class="px-6 py-4 border-b border-gray-200">
@ -527,7 +527,7 @@ defmodule AprsmeWeb.ApiDocsLive do
</div> </div>
</div> </div>
</div> </div>
<!-- HTTP Status Codes --> <!-- HTTP Status Codes -->
<div class="bg-white rounded-lg shadow-sm border border-gray-200"> <div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="px-6 py-4 border-b border-gray-200"> <div class="px-6 py-4 border-b border-gray-200">
@ -591,7 +591,7 @@ defmodule AprsmeWeb.ApiDocsLive do
</div> </div>
</div> </div>
</div> </div>
<!-- Future Endpoints --> <!-- Future Endpoints -->
<div class="bg-white rounded-lg shadow-sm border border-gray-200"> <div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="px-6 py-4 border-b border-gray-200"> <div class="px-6 py-4 border-b border-gray-200">
@ -638,7 +638,7 @@ defmodule AprsmeWeb.ApiDocsLive do
</div> </div>
</div> </div>
</div> </div>
<!-- Interactive API Testing --> <!-- Interactive API Testing -->
<div class="bg-white rounded-lg shadow-sm border border-gray-200"> <div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="px-6 py-4 border-b border-gray-200"> <div class="px-6 py-4 border-b border-gray-200">
@ -703,7 +703,7 @@ defmodule AprsmeWeb.ApiDocsLive do
</div> </div>
</div> </div>
</form> </form>
<!-- Error Display --> <!-- Error Display -->
<%= if @error do %> <%= if @error do %>
<div class="mt-4 p-3 bg-red-50 border border-red-200 rounded-md"> <div class="mt-4 p-3 bg-red-50 border border-red-200 rounded-md">
@ -723,7 +723,7 @@ defmodule AprsmeWeb.ApiDocsLive do
</div> </div>
</div> </div>
<% end %> <% end %>
<!-- Results Display --> <!-- Results Display -->
<%= if @api_result do %> <%= if @api_result do %>
<div class="mt-4"> <div class="mt-4">
@ -750,7 +750,7 @@ defmodule AprsmeWeb.ApiDocsLive do
</div> </div>
</div> </div>
</div> </div>
<!-- Contact and Support --> <!-- Contact and Support -->
<div class="bg-white rounded-lg shadow-sm border border-gray-200"> <div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="px-6 py-4 border-b border-gray-200"> <div class="px-6 py-4 border-b border-gray-200">

View file

@ -13,7 +13,7 @@ defmodule Aprsme.Repo.Migrations.AddAdditionalPacketFields do
# Additional useful fields that may be in the parsed data # Additional useful fields that may be in the parsed data
add :comment, :text add :comment, :text
add :timestamp, :string add :timestamp, :string
add :aprsme_messaging, :boolean, default: false add :aprs_messaging, :boolean, default: false
# Weather data fields (for weather packets) # Weather data fields (for weather packets)
add :temperature, :float add :temperature, :float

View file

@ -6,7 +6,7 @@ defmodule Aprsme.DataExtendedTest do
describe "changeset/2" do describe "changeset/2" do
test "valid changeset with all required fields" do test "valid changeset with all required fields" do
attrs = %{ attrs = %{
aprsme_messaging: true, aprs_messaging: true,
comment: "Test comment", comment: "Test comment",
data_type: "position", data_type: "position",
symbol_code: "/", symbol_code: "/",
@ -16,7 +16,7 @@ defmodule Aprsme.DataExtendedTest do
changeset = DataExtended.changeset(%DataExtended{}, attrs) changeset = DataExtended.changeset(%DataExtended{}, attrs)
assert changeset.valid? assert changeset.valid?
assert get_change(changeset, :aprsme_messaging) == true assert get_change(changeset, :aprs_messaging) == true
assert get_change(changeset, :comment) == "Test comment" assert get_change(changeset, :comment) == "Test comment"
assert get_change(changeset, :data_type) == "position" assert get_change(changeset, :data_type) == "position"
assert get_change(changeset, :symbol_code) == "/" assert get_change(changeset, :symbol_code) == "/"
@ -25,7 +25,7 @@ defmodule Aprsme.DataExtendedTest do
test "valid changeset with coordinates" do test "valid changeset with coordinates" do
attrs = %{ attrs = %{
aprsme_messaging: false, aprs_messaging: false,
comment: "Position report", comment: "Position report",
data_type: "position", data_type: "position",
latitude: Decimal.new("40.123456"), latitude: Decimal.new("40.123456"),
@ -43,7 +43,7 @@ defmodule Aprsme.DataExtendedTest do
test "valid changeset with string coordinates gets converted to decimal" do test "valid changeset with string coordinates gets converted to decimal" do
attrs = %{ attrs = %{
aprsme_messaging: false, aprs_messaging: false,
comment: "Position report", comment: "Position report",
data_type: "position", data_type: "position",
latitude: "40.123456", latitude: "40.123456",
@ -61,7 +61,7 @@ defmodule Aprsme.DataExtendedTest do
test "valid changeset with only required fields (no coordinates)" do test "valid changeset with only required fields (no coordinates)" do
attrs = %{ attrs = %{
aprsme_messaging: false, aprs_messaging: false,
comment: "Status update", comment: "Status update",
data_type: "status", data_type: "status",
symbol_code: ">", symbol_code: ">",
@ -90,7 +90,7 @@ defmodule Aprsme.DataExtendedTest do
test "invalid changeset with empty required fields" do test "invalid changeset with empty required fields" do
attrs = %{ attrs = %{
aprsme_messaging: nil, aprs_messaging: nil,
comment: "", comment: "",
data_type: "", data_type: "",
symbol_code: "", symbol_code: "",
@ -109,7 +109,7 @@ defmodule Aprsme.DataExtendedTest do
test "changeset with only latitude provided (should be invalid)" do test "changeset with only latitude provided (should be invalid)" do
attrs = %{ attrs = %{
aprsme_messaging: false, aprs_messaging: false,
comment: "Partial position", comment: "Partial position",
data_type: "position", data_type: "position",
latitude: "40.123456", latitude: "40.123456",
@ -128,7 +128,7 @@ defmodule Aprsme.DataExtendedTest do
test "changeset with only longitude provided (should be invalid)" do test "changeset with only longitude provided (should be invalid)" do
attrs = %{ attrs = %{
aprsme_messaging: false, aprs_messaging: false,
comment: "Partial position", comment: "Partial position",
data_type: "position", data_type: "position",
longitude: "-74.654321", longitude: "-74.654321",
@ -144,10 +144,10 @@ defmodule Aprsme.DataExtendedTest do
refute get_change(changeset, :latitude) refute get_change(changeset, :latitude)
end end
test "changeset handles boolean aprsme_messaging properly" do test "changeset handles boolean aprs_messaging properly" do
# Test true # Test true
attrs_true = %{ attrs_true = %{
aprsme_messaging: true, aprs_messaging: true,
comment: "Message enabled", comment: "Message enabled",
data_type: "message", data_type: "message",
symbol_code: ">", symbol_code: ">",
@ -156,11 +156,11 @@ defmodule Aprsme.DataExtendedTest do
changeset_true = DataExtended.changeset(%DataExtended{}, attrs_true) changeset_true = DataExtended.changeset(%DataExtended{}, attrs_true)
assert changeset_true.valid? assert changeset_true.valid?
assert get_change(changeset_true, :aprsme_messaging) == true assert get_change(changeset_true, :aprs_messaging) == true
# Test false # Test false
attrs_false = %{ attrs_false = %{
aprsme_messaging: false, aprs_messaging: false,
comment: "Message disabled", comment: "Message disabled",
data_type: "status", data_type: "status",
symbol_code: ">", symbol_code: ">",
@ -169,7 +169,7 @@ defmodule Aprsme.DataExtendedTest do
changeset_false = DataExtended.changeset(%DataExtended{}, attrs_false) changeset_false = DataExtended.changeset(%DataExtended{}, attrs_false)
assert changeset_false.valid? assert changeset_false.valid?
assert get_change(changeset_false, :aprsme_messaging) == false || changeset_false.data.aprsme_messaging == false assert get_change(changeset_false, :aprs_messaging) == false || changeset_false.data.aprs_messaging == false
end end
test "changeset with various symbol codes and table IDs" do test "changeset with various symbol codes and table IDs" do
@ -182,7 +182,7 @@ defmodule Aprsme.DataExtendedTest do
for {symbol_code, symbol_table_id, description} <- test_cases do for {symbol_code, symbol_table_id, description} <- test_cases do
attrs = %{ attrs = %{
aprsme_messaging: false, aprs_messaging: false,
comment: description, comment: description,
data_type: "position", data_type: "position",
symbol_code: symbol_code, symbol_code: symbol_code,
@ -202,7 +202,7 @@ defmodule Aprsme.DataExtendedTest do
for data_type <- data_types do for data_type <- data_types do
attrs = %{ attrs = %{
aprsme_messaging: false, aprs_messaging: false,
comment: "Testing #{data_type}", comment: "Testing #{data_type}",
data_type: data_type, data_type: data_type,
symbol_code: ">", symbol_code: ">",
@ -220,7 +220,7 @@ defmodule Aprsme.DataExtendedTest do
long_comment = String.duplicate("A", 1000) long_comment = String.duplicate("A", 1000)
attrs = %{ attrs = %{
aprsme_messaging: false, aprs_messaging: false,
comment: long_comment, comment: long_comment,
data_type: "status", data_type: "status",
symbol_code: ">", symbol_code: ">",
@ -235,7 +235,7 @@ defmodule Aprsme.DataExtendedTest do
test "changeset preserves existing data when updating" do test "changeset preserves existing data when updating" do
existing_data = %DataExtended{ existing_data = %DataExtended{
aprsme_messaging: true, aprs_messaging: true,
comment: "Original comment", comment: "Original comment",
data_type: "position", data_type: "position",
latitude: Decimal.new("30.0"), latitude: Decimal.new("30.0"),
@ -255,7 +255,7 @@ defmodule Aprsme.DataExtendedTest do
assert get_change(changeset, :comment) == "Updated comment" assert get_change(changeset, :comment) == "Updated comment"
assert get_change(changeset, :latitude) == Decimal.new("31.0") assert get_change(changeset, :latitude) == Decimal.new("31.0")
# Other fields should remain unchanged # Other fields should remain unchanged
assert changeset.data.aprsme_messaging == true assert changeset.data.aprs_messaging == true
assert changeset.data.data_type == "position" assert changeset.data.data_type == "position"
end end
end end
@ -263,7 +263,7 @@ defmodule Aprsme.DataExtendedTest do
describe "validate_required_if_present/2" do describe "validate_required_if_present/2" do
test "validates field when it's present in changes" do test "validates field when it's present in changes" do
attrs = %{ attrs = %{
aprsme_messaging: false, aprs_messaging: false,
comment: "Test", comment: "Test",
data_type: "position", data_type: "position",
# Explicitly setting to nil should trigger validation # Explicitly setting to nil should trigger validation
@ -285,7 +285,7 @@ defmodule Aprsme.DataExtendedTest do
test "creates struct with default values" do test "creates struct with default values" do
data_extended = %DataExtended{} data_extended = %DataExtended{}
assert data_extended.aprsme_messaging == false assert data_extended.aprs_messaging == false
assert is_nil(data_extended.comment) assert is_nil(data_extended.comment)
assert is_nil(data_extended.data_type) assert is_nil(data_extended.data_type)
assert is_nil(data_extended.latitude) assert is_nil(data_extended.latitude)
@ -296,7 +296,7 @@ defmodule Aprsme.DataExtendedTest do
test "creates struct with explicit values" do test "creates struct with explicit values" do
data_extended = %DataExtended{ data_extended = %DataExtended{
aprsme_messaging: true, aprs_messaging: true,
comment: "Test comment", comment: "Test comment",
data_type: "position", data_type: "position",
latitude: Decimal.new("40.0"), latitude: Decimal.new("40.0"),
@ -305,7 +305,7 @@ defmodule Aprsme.DataExtendedTest do
symbol_table_id: "/" symbol_table_id: "/"
} }
assert data_extended.aprsme_messaging == true assert data_extended.aprs_messaging == true
assert data_extended.comment == "Test comment" assert data_extended.comment == "Test comment"
assert data_extended.data_type == "position" assert data_extended.data_type == "position"
assert data_extended.latitude == Decimal.new("40.0") assert data_extended.latitude == Decimal.new("40.0")