mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Update swagger docs and changelog
This commit is contained in:
parent
d6b88ae9cb
commit
dbb737a0c4
7 changed files with 54 additions and 18 deletions
21
CHANGELOG.md
21
CHANGELOG.md
|
|
@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
# 0.19.4 - 2024-12-10
|
# 0.19.4 - 2024-12-10
|
||||||
|
|
||||||
|
⚠️ This release introduces a breaking change. ⚠️
|
||||||
|
|
||||||
|
The `GET /api/v1/trips/:id/photos` endpoint now returns a different structure of the response:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
latitude: 10,
|
||||||
|
longitude: 10,
|
||||||
|
localDateTime: "2024-01-01T00:00:00Z",
|
||||||
|
originalFileName: "photo.jpg",
|
||||||
|
city: "Berlin",
|
||||||
|
state: "Berlin",
|
||||||
|
country: "Germany",
|
||||||
|
type: "image",
|
||||||
|
+ orientation: "portrait",
|
||||||
|
source: "photoprism"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed a bug where the Photoprism photos were not being shown on the trip page.
|
- Fixed a bug where the Photoprism photos were not being shown on the trip page.
|
||||||
|
|
@ -16,6 +36,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
- A link to the Photoprism photos on the trip page if there are any.
|
- A link to the Photoprism photos on the trip page if there are any.
|
||||||
- A `orientation` field in the Api::PhotoSerializer, hence the `GET /api/v1/photos` endpoint now includes the orientation of the photo. Valid values are `portrait` and `landscape`.
|
- A `orientation` field in the Api::PhotoSerializer, hence the `GET /api/v1/photos` endpoint now includes the orientation of the photo. Valid values are `portrait` and `landscape`.
|
||||||
|
- Examples for the `type`, `orientation` and `source` fields in the `GET /api/v1/photos` endpoint in the Swagger UI.
|
||||||
|
|
||||||
# 0.19.3 - 2024-12-06
|
# 0.19.3 - 2024-12-06
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,7 @@ class MapController < ApplicationController
|
||||||
@distance ||= 0
|
@distance ||= 0
|
||||||
|
|
||||||
@coordinates.each_cons(2) do
|
@coordinates.each_cons(2) do
|
||||||
@distance += Geocoder::Calculations.distance_between(
|
@distance += DistanceCalculator.new([_1[0], _1[1]], [_2[0], _2[1]]).call
|
||||||
[_1[0], _1[1]], [_2[0], _2[1]], units: DISTANCE_UNIT
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@distance.round(1)
|
@distance.round(1)
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ class Trip < ApplicationRecord
|
||||||
vertical_photos = photos.select { |photo| photo[:orientation] == 'portrait' }
|
vertical_photos = photos.select { |photo| photo[:orientation] == 'portrait' }
|
||||||
horizontal_photos = photos.select { |photo| photo[:orientation] == 'landscape' }
|
horizontal_photos = photos.select { |photo| photo[:orientation] == 'landscape' }
|
||||||
|
|
||||||
|
# this is ridiculous, but I couldn't find my way around frontend
|
||||||
|
# to show all photos in the same height
|
||||||
vertical_photos.count > horizontal_photos.count ? vertical_photos : horizontal_photos
|
vertical_photos.count > horizontal_photos.count ? vertical_photos : horizontal_photos
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -42,11 +44,7 @@ class Trip < ApplicationRecord
|
||||||
distance = 0
|
distance = 0
|
||||||
|
|
||||||
points.each_cons(2) do |point1, point2|
|
points.each_cons(2) do |point1, point2|
|
||||||
distance_between = Geocoder::Calculations.distance_between(
|
distance += DistanceCalculator.new(point1, point2).call
|
||||||
point1.to_coordinates, point2.to_coordinates, units: ::DISTANCE_UNIT
|
|
||||||
)
|
|
||||||
|
|
||||||
distance += distance_between
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self.distance = distance.round
|
self.distance = distance.round
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,9 @@ class Visit < ApplicationRecord
|
||||||
def default_radius
|
def default_radius
|
||||||
return area&.radius if area.present?
|
return area&.radius if area.present?
|
||||||
|
|
||||||
radius = points.map { Geocoder::Calculations.distance_between(center, [_1.latitude, _1.longitude]) }.max
|
radius = points.map do |point|
|
||||||
|
DistanceCalculator.new(center, [point.latitude, point.longitude]).call
|
||||||
|
end.max
|
||||||
|
|
||||||
radius && radius >= 15 ? radius : 15
|
radius && radius >= 15 ? radius : 15
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,9 @@ RSpec.describe Trip, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns the photos' do
|
it 'returns the photos' do
|
||||||
expect(trip.photo_previews).to eq(expected_photos)
|
expect(trip.photo_previews).to include(expected_photos[0])
|
||||||
|
expect(trip.photo_previews).to include(expected_photos[1])
|
||||||
|
expect(trip.photo_previews.size).to eq(2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -110,9 +110,9 @@ RSpec.describe 'Api::V1::PhotosController', type: :request do
|
||||||
city: { type: :string },
|
city: { type: :string },
|
||||||
state: { type: :string },
|
state: { type: :string },
|
||||||
country: { type: :string },
|
country: { type: :string },
|
||||||
type: { type: :string },
|
type: { type: :string, enum: %w[image video] },
|
||||||
orientation: { type: :string },
|
orientation: { type: :string, enum: %w[portrait landscape] },
|
||||||
source: { type: :string }
|
source: { type: :string, enum: %w[immich photoprism] }
|
||||||
},
|
},
|
||||||
required: %w[id latitude longitude localDateTime originalFileName city state country type source]
|
required: %w[id latitude longitude localDateTime originalFileName city state country type source]
|
||||||
}
|
}
|
||||||
|
|
@ -143,9 +143,9 @@ RSpec.describe 'Api::V1::PhotosController', type: :request do
|
||||||
city: { type: :string },
|
city: { type: :string },
|
||||||
state: { type: :string },
|
state: { type: :string },
|
||||||
country: { type: :string },
|
country: { type: :string },
|
||||||
type: { type: :string },
|
type: { type: :string, enum: %w[image video] },
|
||||||
source: { type: :string },
|
orientation: { type: :string, enum: %w[portrait landscape] },
|
||||||
orientation: { type: :string, enum: %w[portrait landscape] }
|
source: { type: :string, enum: %w[immich photoprism] }
|
||||||
}
|
}
|
||||||
|
|
||||||
let(:id) { '7fe486e3-c3ba-4b54-bbf9-1281b39ed15c' }
|
let(:id) { '7fe486e3-c3ba-4b54-bbf9-1281b39ed15c' }
|
||||||
|
|
|
||||||
|
|
@ -366,10 +366,19 @@ paths:
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
type: string
|
type: string
|
||||||
|
enum:
|
||||||
|
- image
|
||||||
|
- video
|
||||||
orientation:
|
orientation:
|
||||||
type: string
|
type: string
|
||||||
|
enum:
|
||||||
|
- portrait
|
||||||
|
- landscape
|
||||||
source:
|
source:
|
||||||
type: string
|
type: string
|
||||||
|
enum:
|
||||||
|
- immich
|
||||||
|
- photoprism
|
||||||
required:
|
required:
|
||||||
- id
|
- id
|
||||||
- latitude
|
- latitude
|
||||||
|
|
@ -431,13 +440,19 @@ paths:
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
type: string
|
type: string
|
||||||
source:
|
enum:
|
||||||
type: string
|
- image
|
||||||
|
- video
|
||||||
orientation:
|
orientation:
|
||||||
type: string
|
type: string
|
||||||
enum:
|
enum:
|
||||||
- portrait
|
- portrait
|
||||||
- landscape
|
- landscape
|
||||||
|
source:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- immich
|
||||||
|
- photoprism
|
||||||
'404':
|
'404':
|
||||||
description: photo not found
|
description: photo not found
|
||||||
"/api/v1/points":
|
"/api/v1/points":
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue