mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Include id attribute in slim points response
This commit is contained in:
parent
ec793fe4aa
commit
d2aa1e9381
4 changed files with 13 additions and 8 deletions
|
|
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
- Points imported from Google Location History (mobile devise) now have correct timestamps
|
- Points imported from Google Location History (mobile devise) now have correct timestamps
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- `GET /api/v1/points?slim=true` now returns `id` attribute for each point
|
||||||
|
|
||||||
# [0.14.5] - 2024-09-28
|
# [0.14.5] - 2024-09-28
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,6 @@ class Api::V1::PointsController < ApiController
|
||||||
private
|
private
|
||||||
|
|
||||||
def point_serializer
|
def point_serializer
|
||||||
params[:slim] ? SlimPointSerializer : PointSerializer
|
params[:slim] == 'true' ? SlimPointSerializer : PointSerializer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ class SlimPointSerializer
|
||||||
|
|
||||||
def call
|
def call
|
||||||
{
|
{
|
||||||
|
id: point.id,
|
||||||
latitude: point.latitude,
|
latitude: point.latitude,
|
||||||
longitude: point.longitude,
|
longitude: point.longitude,
|
||||||
timestamp: point.timestamp
|
timestamp: point.timestamp
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,13 @@ RSpec.describe 'Api::V1::Points', type: :request do
|
||||||
|
|
||||||
context 'when slim version of points is requested' do
|
context 'when slim version of points is requested' do
|
||||||
it 'renders a successful response' do
|
it 'renders a successful response' do
|
||||||
get api_v1_points_url(api_key: user.api_key, slim: true)
|
get api_v1_points_url(api_key: user.api_key, slim: 'true')
|
||||||
|
|
||||||
expect(response).to be_successful
|
expect(response).to be_successful
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a list of points' do
|
it 'returns a list of points' do
|
||||||
get api_v1_points_url(api_key: user.api_key, slim: true)
|
get api_v1_points_url(api_key: user.api_key, slim: 'true')
|
||||||
|
|
||||||
expect(response).to have_http_status(:ok)
|
expect(response).to have_http_status(:ok)
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ RSpec.describe 'Api::V1::Points', type: :request do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a list of points with pagination' do
|
it 'returns a list of points with pagination' do
|
||||||
get api_v1_points_url(api_key: user.api_key, slim: true, page: 2, per_page: 10)
|
get api_v1_points_url(api_key: user.api_key, slim: 'true', page: 2, per_page: 10)
|
||||||
|
|
||||||
expect(response).to have_http_status(:ok)
|
expect(response).to have_http_status(:ok)
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ RSpec.describe 'Api::V1::Points', type: :request do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a list of points with pagination headers' do
|
it 'returns a list of points with pagination headers' do
|
||||||
get api_v1_points_url(api_key: user.api_key, slim: true, page: 2, per_page: 10)
|
get api_v1_points_url(api_key: user.api_key, slim: 'true', page: 2, per_page: 10)
|
||||||
|
|
||||||
expect(response).to have_http_status(:ok)
|
expect(response).to have_http_status(:ok)
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ RSpec.describe 'Api::V1::Points', type: :request do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a list of points with slim attributes' do
|
it 'returns a list of points with slim attributes' do
|
||||||
get api_v1_points_url(api_key: user.api_key, slim: true)
|
get api_v1_points_url(api_key: user.api_key, slim: 'true')
|
||||||
|
|
||||||
expect(response).to have_http_status(:ok)
|
expect(response).to have_http_status(:ok)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue