feat: expose tag color in web API

This commit is contained in:
2026-05-19 21:27:54 +02:00
parent ef7bf8c6e4
commit 6b79c4ca29
2 changed files with 9 additions and 3 deletions
@@ -136,6 +136,7 @@ defmodule Localiser.Web.Controllers.TagController do
id: tag.id,
tag_id: tag.tag_id,
name: tag.name,
color: tag.color,
room_id: live && live.room_id,
last_seen: live && live.last_seen
}
+8 -3
View File
@@ -70,10 +70,11 @@ defmodule Localiser.Web.Schemas do
id: %Schema{type: :integer},
tag_id: %Schema{type: :string},
name: %Schema{type: :string},
color: %Schema{type: :string, nullable: true},
room_id: %Schema{type: :integer, nullable: true},
last_seen: %Schema{type: :string, format: :"date-time", nullable: true}
},
required: [:id, :tag_id, :name, :room_id, :last_seen]
required: [:id, :tag_id, :name, :color, :room_id, :last_seen]
})
end
@@ -325,7 +326,8 @@ defmodule Localiser.Web.Schemas do
title: "TagParams", type: :object,
properties: %{
tag_id: %Schema{type: :string, description: "BLE MAC address or device ID"},
name: %Schema{type: :string}
name: %Schema{type: :string},
color: %Schema{type: :string}
},
required: [:tag_id, :name]
})
@@ -335,7 +337,10 @@ defmodule Localiser.Web.Schemas do
require OpenApiSpex
OpenApiSpex.schema(%{
title: "TagUpdateParams", type: :object,
properties: %{name: %Schema{type: :string}}
properties: %{
name: %Schema{type: :string},
color: %Schema{type: :string}
}
})
end
end