@@ -17,7 +17,17 @@ defmodule PlexusWeb.API.V1.AppController do
17
17
page: [ in: :query , description: "Page number" , type: :integer , example: 1 ] ,
18
18
limit: [ in: :query , description: "Max results per page" , type: :integer , example: 25 ] ,
19
19
scores: [ in: :query , description: "Include scores" , type: :boolean , example: true ] ,
20
- q: [ in: :query , description: "Search query" , type: :string , example: "Signal" ]
20
+ q: [ in: :query , description: "Search query" , type: :string , example: "Signal" ] ,
21
+ last_updated: [
22
+ in: :query ,
23
+ description: "Apps that have updates after or on your datetime. Using RFC 3339" ,
24
+ type: % OpenApiSpex.Schema { type: :string , format: "date-time" } ,
25
+ example:
26
+ DateTime . utc_now ( )
27
+ |> DateTime . add ( - 7 , :day )
28
+ |> DateTime . truncate ( :second )
29
+ |> DateTime . to_iso8601 ( :extended )
30
+ ]
21
31
] ,
22
32
responses: [
23
33
ok: { "Applications" , "application/json" , AppsResponse }
@@ -77,6 +87,15 @@ defmodule PlexusWeb.API.V1.AppController do
77
87
{ "scores" , "true" } , acc ->
78
88
Keyword . put ( acc , :scores , true )
79
89
90
+ { "last_updated" , last_updated } , acc ->
91
+ case DateTime . from_iso8601 ( last_updated ) do
92
+ { :ok , last_updated_dt , _utc_offset } ->
93
+ Keyword . put ( acc , :updated_at_greater_than_or_equal_to , last_updated_dt )
94
+
95
+ _ ->
96
+ acc
97
+ end
98
+
80
99
{ "page" , page } , acc ->
81
100
case Integer . parse ( page ) do
82
101
{ value , _remainder } ->
0 commit comments