From 5db12b8d87ff3d41b11e2a1801d8a46fe3e92b90 Mon Sep 17 00:00:00 2001 From: Tom Konidas Date: Sat, 2 Aug 2025 12:27:05 -0400 Subject: [PATCH 1/2] Expose `rated_at` timestamp in API --- lib/plexus_web/controllers/api/v1/rating_json.ex | 3 ++- lib/plexus_web/controllers/api/v1/schemas/rating.ex | 6 ++++-- .../controllers/api/v1/rating_controller_test.exs | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/plexus_web/controllers/api/v1/rating_json.ex b/lib/plexus_web/controllers/api/v1/rating_json.ex index 951f07c..8b4d5db 100644 --- a/lib/plexus_web/controllers/api/v1/rating_json.ex +++ b/lib/plexus_web/controllers/api/v1/rating_json.ex @@ -26,7 +26,8 @@ defmodule PlexusWeb.API.V1.RatingJSON do installation_source: rating.installation_source, score: %{numerator: rating.score, denominator: 4}, notes: rating.notes, - rating_type: rating.rating_type + rating_type: rating.rating_type, + rated_at: rating.inserted_at } end end diff --git a/lib/plexus_web/controllers/api/v1/schemas/rating.ex b/lib/plexus_web/controllers/api/v1/schemas/rating.ex index 6fcb2e4..3809ac3 100644 --- a/lib/plexus_web/controllers/api/v1/schemas/rating.ex +++ b/lib/plexus_web/controllers/api/v1/schemas/rating.ex @@ -18,7 +18,8 @@ defmodule PlexusWeb.API.V1.Schemas.Rating do installation_source: %Schema{type: :string, description: "Installation Source"}, score: Score, notes: %Schema{type: :string, description: "Notes", nullable: true}, - rating_type: %Schema{type: :string, description: "Rating Type", enum: ["micro_g", "native"]} + rating_type: %Schema{type: :string, description: "Rating Type", enum: ["micro_g", "native"]}, + rated_at: %Schema{type: :string, description: "Rated at timestamp", format: :"date-time"} }, example: %{ "id" => "72f5d88e-a467-4729-998f-db1edcfad6bc", @@ -31,7 +32,8 @@ defmodule PlexusWeb.API.V1.Schemas.Rating do "installation_source" => "google_play_alternative", "notes" => nil, "rom_build" => "2024083100", - "rom_name" => "GrapheneOS" + "rom_name" => "GrapheneOS", + "rated_at" => "2025-05-19T23:02:29.837724Z" } }) end diff --git a/test/plexus_web/controllers/api/v1/rating_controller_test.exs b/test/plexus_web/controllers/api/v1/rating_controller_test.exs index 62b9833..c43c44e 100644 --- a/test/plexus_web/controllers/api/v1/rating_controller_test.exs +++ b/test/plexus_web/controllers/api/v1/rating_controller_test.exs @@ -57,7 +57,7 @@ defmodule PlexusWeb.API.V1.RatingControllerTest do attrs = Map.put(@create_attrs, :app_package, app_package) conn = post(conn, ~p"/api/v1/apps/#{app_package}/ratings", rating: attrs) - assert %{"id" => id} = json_response(conn, 201)["data"] + assert %{"id" => id, "rated_at" => rated_at} = json_response(conn, 201)["data"] conn = get(conn, ~p"/api/v1/apps/#{app_package}/ratings/#{id}") @@ -72,7 +72,8 @@ defmodule PlexusWeb.API.V1.RatingControllerTest do "installation_source" => "fdroid", "rating_type" => "native", "notes" => "some notes", - "score" => %{"numerator" => 2, "denominator" => 4} + "score" => %{"numerator" => 2, "denominator" => 4}, + "rated_at" => ^rated_at } = json_response(conn, 200)["data"] end From 44866f5953685f8463247a4a3757a19d0112f508 Mon Sep 17 00:00:00 2001 From: Tom Konidas Date: Sat, 2 Aug 2025 12:30:32 -0400 Subject: [PATCH 2/2] Remove strict versions --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9eba9b6..e48b8d5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -40,7 +40,6 @@ jobs: with: elixir-version: ${{ matrix.elixir }} otp-version: ${{ matrix.otp }} - version-type: strict - name: Restore Mix Dependencies Cache uses: actions/cache@v3