mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Fix swagger docs for /api/v1/photos/{id}/thumbnail
This commit is contained in:
parent
ba2a95233c
commit
93e91e7944
4 changed files with 75 additions and 308 deletions
|
|
@ -38,7 +38,7 @@ class Api::V1::PhotosController < ApiController
|
||||||
end
|
end
|
||||||
|
|
||||||
def unauthorized_integration
|
def unauthorized_integration
|
||||||
render json: { error: "#{params[:source].capitalize} integration not configured" },
|
render json: { error: "#{params[:source]&.capitalize} integration not configured" },
|
||||||
status: :unauthorized
|
status: :unauthorized
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@ RSpec.describe Import, type: :model do
|
||||||
google_phone_takeout: 3,
|
google_phone_takeout: 3,
|
||||||
gpx: 4,
|
gpx: 4,
|
||||||
immich_api: 5,
|
immich_api: 5,
|
||||||
geojson: 6
|
geojson: 6,
|
||||||
|
photoprism_api: 7
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -102,60 +102,29 @@ RSpec.describe 'Api::V1::PhotosController', type: :request do
|
||||||
items: {
|
items: {
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: {
|
properties: {
|
||||||
|
# {
|
||||||
|
# id: id,
|
||||||
|
# latitude: latitude,
|
||||||
|
# longitude: longitude,
|
||||||
|
# localDateTime: local_date_time,
|
||||||
|
# originalFileName: original_file_name,
|
||||||
|
# city: city,
|
||||||
|
# state: state,
|
||||||
|
# country: country,
|
||||||
|
# type: type,
|
||||||
|
# source: source
|
||||||
id: { type: :string },
|
id: { type: :string },
|
||||||
deviceAssetId: { type: :string },
|
|
||||||
ownerId: { type: :string },
|
|
||||||
type: { type: :string },
|
|
||||||
originalPath: { type: :string },
|
|
||||||
originalFileName: { type: :string },
|
|
||||||
originalMimeType: { type: :string },
|
|
||||||
thumbhash: { type: :string },
|
|
||||||
fileCreatedAt: { type: :string, format: 'date-time' },
|
|
||||||
fileModifiedAt: { type: :string, format: 'date-time' },
|
|
||||||
localDateTime: { type: :string, format: 'date-time' },
|
|
||||||
updatedAt: { type: :string, format: 'date-time' },
|
|
||||||
isFavorite: { type: :boolean },
|
|
||||||
isArchived: { type: :boolean },
|
|
||||||
isTrashed: { type: :boolean },
|
|
||||||
duration: { type: :string },
|
|
||||||
exifInfo: {
|
|
||||||
type: :object,
|
|
||||||
properties: {
|
|
||||||
make: { type: :string },
|
|
||||||
model: { type: :string },
|
|
||||||
exifImageWidth: { type: :integer },
|
|
||||||
exifImageHeight: { type: :integer },
|
|
||||||
fileSizeInByte: { type: :integer },
|
|
||||||
orientation: { type: :string },
|
|
||||||
dateTimeOriginal: { type: :string, format: 'date-time' },
|
|
||||||
modifyDate: { type: :string, format: 'date-time' },
|
|
||||||
timeZone: { type: :string },
|
|
||||||
lensModel: { type: :string },
|
|
||||||
fNumber: { type: :number, format: :float },
|
|
||||||
focalLength: { type: :number, format: :float },
|
|
||||||
iso: { type: :integer },
|
|
||||||
exposureTime: { type: :string },
|
|
||||||
latitude: { type: :number, format: :float },
|
latitude: { type: :number, format: :float },
|
||||||
longitude: { type: :number, format: :float },
|
longitude: { type: :number, format: :float },
|
||||||
|
localDateTime: { type: :string, format: 'date-time' },
|
||||||
|
originalFileName: { type: :string },
|
||||||
city: { type: :string },
|
city: { type: :string },
|
||||||
state: { type: :string },
|
state: { type: :string },
|
||||||
country: { type: :string },
|
country: { type: :string },
|
||||||
description: { type: :string },
|
type: { type: :string },
|
||||||
projectionType: { type: %i[string null] },
|
source: { type: :string }
|
||||||
rating: { type: %i[integer null] }
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
checksum: { type: :string },
|
required: %w[id latitude longitude localDateTime originalFileName city state country type source]
|
||||||
isOffline: { type: :boolean },
|
|
||||||
hasMetadata: { type: :boolean },
|
|
||||||
duplicateId: { type: :string },
|
|
||||||
resized: { type: :boolean }
|
|
||||||
},
|
|
||||||
required: %w[id deviceAssetId ownerId type originalPath
|
|
||||||
originalFileName originalMimeType thumbhash
|
|
||||||
fileCreatedAt fileModifiedAt localDateTime
|
|
||||||
updatedAt isFavorite isArchived isTrashed duration
|
|
||||||
exifInfo checksum isOffline hasMetadata duplicateId resized]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
run_test! do |response|
|
run_test! do |response|
|
||||||
|
|
@ -172,61 +141,24 @@ RSpec.describe 'Api::V1::PhotosController', type: :request do
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
parameter name: :id, in: :path, type: :string, required: true
|
parameter name: :id, in: :path, type: :string, required: true
|
||||||
parameter name: :api_key, in: :query, type: :string, required: true
|
parameter name: :api_key, in: :query, type: :string, required: true
|
||||||
|
parameter name: :source, in: :query, type: :string, required: true
|
||||||
response '200', 'photo found' do
|
response '200', 'photo found' do
|
||||||
schema type: :object,
|
schema type: :object,
|
||||||
properties: {
|
properties: {
|
||||||
id: { type: :string },
|
id: { type: :string },
|
||||||
deviceAssetId: { type: :string },
|
|
||||||
ownerId: { type: :string },
|
|
||||||
type: { type: :string },
|
|
||||||
originalPath: { type: :string },
|
|
||||||
originalFileName: { type: :string },
|
|
||||||
originalMimeType: { type: :string },
|
|
||||||
thumbhash: { type: :string },
|
|
||||||
fileCreatedAt: { type: :string, format: 'date-time' },
|
|
||||||
fileModifiedAt: { type: :string, format: 'date-time' },
|
|
||||||
localDateTime: { type: :string, format: 'date-time' },
|
|
||||||
updatedAt: { type: :string, format: 'date-time' },
|
|
||||||
isFavorite: { type: :boolean },
|
|
||||||
isArchived: { type: :boolean },
|
|
||||||
isTrashed: { type: :boolean },
|
|
||||||
duration: { type: :string },
|
|
||||||
exifInfo: {
|
|
||||||
type: :object,
|
|
||||||
properties: {
|
|
||||||
make: { type: :string },
|
|
||||||
model: { type: :string },
|
|
||||||
exifImageWidth: { type: :integer },
|
|
||||||
exifImageHeight: { type: :integer },
|
|
||||||
fileSizeInByte: { type: :integer },
|
|
||||||
orientation: { type: :string },
|
|
||||||
dateTimeOriginal: { type: :string, format: 'date-time' },
|
|
||||||
modifyDate: { type: :string, format: 'date-time' },
|
|
||||||
timeZone: { type: :string },
|
|
||||||
lensModel: { type: :string },
|
|
||||||
fNumber: { type: :number, format: :float },
|
|
||||||
focalLength: { type: :number, format: :float },
|
|
||||||
iso: { type: :integer },
|
|
||||||
exposureTime: { type: :string },
|
|
||||||
latitude: { type: :number, format: :float },
|
latitude: { type: :number, format: :float },
|
||||||
longitude: { type: :number, format: :float },
|
longitude: { type: :number, format: :float },
|
||||||
|
localDateTime: { type: :string, format: 'date-time' },
|
||||||
|
originalFileName: { type: :string },
|
||||||
city: { type: :string },
|
city: { type: :string },
|
||||||
state: { type: :string },
|
state: { type: :string },
|
||||||
country: { type: :string },
|
country: { type: :string },
|
||||||
description: { type: :string },
|
type: { type: :string },
|
||||||
projectionType: { type: %i[string null] },
|
source: { type: :string }
|
||||||
rating: { type: %i[integer null] }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
checksum: { type: :string },
|
|
||||||
isOffline: { type: :boolean },
|
|
||||||
hasMetadata: { type: :boolean },
|
|
||||||
duplicateId: { type: :string },
|
|
||||||
resized: { type: :boolean }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let(:id) { '7fe486e3-c3ba-4b54-bbf9-1281b39ed15c' }
|
let(:id) { '7fe486e3-c3ba-4b54-bbf9-1281b39ed15c' }
|
||||||
|
let(:source) { 'immich' }
|
||||||
|
|
||||||
run_test! do |response|
|
run_test! do |response|
|
||||||
data = JSON.parse(response.body)
|
data = JSON.parse(response.body)
|
||||||
|
|
@ -238,6 +170,7 @@ RSpec.describe 'Api::V1::PhotosController', type: :request do
|
||||||
response '404', 'photo not found' do
|
response '404', 'photo not found' do
|
||||||
let(:id) { 'nonexistent' }
|
let(:id) { 'nonexistent' }
|
||||||
let(:api_key) { user.api_key }
|
let(:api_key) { user.api_key }
|
||||||
|
let(:source) { 'immich' }
|
||||||
|
|
||||||
run_test! do |response|
|
run_test! do |response|
|
||||||
data = JSON.parse(response.body)
|
data = JSON.parse(response.body)
|
||||||
|
|
|
||||||
|
|
@ -347,130 +347,38 @@ paths:
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
deviceAssetId:
|
|
||||||
type: string
|
|
||||||
ownerId:
|
|
||||||
type: string
|
|
||||||
type:
|
|
||||||
type: string
|
|
||||||
originalPath:
|
|
||||||
type: string
|
|
||||||
originalFileName:
|
|
||||||
type: string
|
|
||||||
originalMimeType:
|
|
||||||
type: string
|
|
||||||
thumbhash:
|
|
||||||
type: string
|
|
||||||
fileCreatedAt:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
fileModifiedAt:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
localDateTime:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
updatedAt:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
isFavorite:
|
|
||||||
type: boolean
|
|
||||||
isArchived:
|
|
||||||
type: boolean
|
|
||||||
isTrashed:
|
|
||||||
type: boolean
|
|
||||||
duration:
|
|
||||||
type: string
|
|
||||||
exifInfo:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
make:
|
|
||||||
type: string
|
|
||||||
model:
|
|
||||||
type: string
|
|
||||||
exifImageWidth:
|
|
||||||
type: integer
|
|
||||||
exifImageHeight:
|
|
||||||
type: integer
|
|
||||||
fileSizeInByte:
|
|
||||||
type: integer
|
|
||||||
orientation:
|
|
||||||
type: string
|
|
||||||
dateTimeOriginal:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
modifyDate:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
timeZone:
|
|
||||||
type: string
|
|
||||||
lensModel:
|
|
||||||
type: string
|
|
||||||
fNumber:
|
|
||||||
type: number
|
|
||||||
format: float
|
|
||||||
focalLength:
|
|
||||||
type: number
|
|
||||||
format: float
|
|
||||||
iso:
|
|
||||||
type: integer
|
|
||||||
exposureTime:
|
|
||||||
type: string
|
|
||||||
latitude:
|
latitude:
|
||||||
type: number
|
type: number
|
||||||
format: float
|
format: float
|
||||||
longitude:
|
longitude:
|
||||||
type: number
|
type: number
|
||||||
format: float
|
format: float
|
||||||
|
localDateTime:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
originalFileName:
|
||||||
|
type: string
|
||||||
city:
|
city:
|
||||||
type: string
|
type: string
|
||||||
state:
|
state:
|
||||||
type: string
|
type: string
|
||||||
country:
|
country:
|
||||||
type: string
|
type: string
|
||||||
description:
|
|
||||||
type: string
|
|
||||||
projectionType:
|
|
||||||
type:
|
type:
|
||||||
- string
|
|
||||||
- 'null'
|
|
||||||
rating:
|
|
||||||
type:
|
|
||||||
- integer
|
|
||||||
- 'null'
|
|
||||||
checksum:
|
|
||||||
type: string
|
type: string
|
||||||
isOffline:
|
source:
|
||||||
type: boolean
|
|
||||||
hasMetadata:
|
|
||||||
type: boolean
|
|
||||||
duplicateId:
|
|
||||||
type: string
|
type: string
|
||||||
resized:
|
|
||||||
type: boolean
|
|
||||||
required:
|
required:
|
||||||
- id
|
- id
|
||||||
- deviceAssetId
|
- latitude
|
||||||
- ownerId
|
- longitude
|
||||||
- type
|
|
||||||
- originalPath
|
|
||||||
- originalFileName
|
|
||||||
- originalMimeType
|
|
||||||
- thumbhash
|
|
||||||
- fileCreatedAt
|
|
||||||
- fileModifiedAt
|
|
||||||
- localDateTime
|
- localDateTime
|
||||||
- updatedAt
|
- originalFileName
|
||||||
- isFavorite
|
- city
|
||||||
- isArchived
|
- state
|
||||||
- isTrashed
|
- country
|
||||||
- duration
|
- type
|
||||||
- exifInfo
|
- source
|
||||||
- checksum
|
|
||||||
- isOffline
|
|
||||||
- hasMetadata
|
|
||||||
- duplicateId
|
|
||||||
- resized
|
|
||||||
"/api/v1/photos/{id}/thumbnail":
|
"/api/v1/photos/{id}/thumbnail":
|
||||||
get:
|
get:
|
||||||
summary: Retrieves a photo
|
summary: Retrieves a photo
|
||||||
|
|
@ -487,6 +395,11 @@ paths:
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
|
- name: source
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: photo found
|
description: photo found
|
||||||
|
|
@ -497,107 +410,27 @@ paths:
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
deviceAssetId:
|
|
||||||
type: string
|
|
||||||
ownerId:
|
|
||||||
type: string
|
|
||||||
type:
|
|
||||||
type: string
|
|
||||||
originalPath:
|
|
||||||
type: string
|
|
||||||
originalFileName:
|
|
||||||
type: string
|
|
||||||
originalMimeType:
|
|
||||||
type: string
|
|
||||||
thumbhash:
|
|
||||||
type: string
|
|
||||||
fileCreatedAt:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
fileModifiedAt:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
localDateTime:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
updatedAt:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
isFavorite:
|
|
||||||
type: boolean
|
|
||||||
isArchived:
|
|
||||||
type: boolean
|
|
||||||
isTrashed:
|
|
||||||
type: boolean
|
|
||||||
duration:
|
|
||||||
type: string
|
|
||||||
exifInfo:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
make:
|
|
||||||
type: string
|
|
||||||
model:
|
|
||||||
type: string
|
|
||||||
exifImageWidth:
|
|
||||||
type: integer
|
|
||||||
exifImageHeight:
|
|
||||||
type: integer
|
|
||||||
fileSizeInByte:
|
|
||||||
type: integer
|
|
||||||
orientation:
|
|
||||||
type: string
|
|
||||||
dateTimeOriginal:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
modifyDate:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
timeZone:
|
|
||||||
type: string
|
|
||||||
lensModel:
|
|
||||||
type: string
|
|
||||||
fNumber:
|
|
||||||
type: number
|
|
||||||
format: float
|
|
||||||
focalLength:
|
|
||||||
type: number
|
|
||||||
format: float
|
|
||||||
iso:
|
|
||||||
type: integer
|
|
||||||
exposureTime:
|
|
||||||
type: string
|
|
||||||
latitude:
|
latitude:
|
||||||
type: number
|
type: number
|
||||||
format: float
|
format: float
|
||||||
longitude:
|
longitude:
|
||||||
type: number
|
type: number
|
||||||
format: float
|
format: float
|
||||||
|
localDateTime:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
originalFileName:
|
||||||
|
type: string
|
||||||
city:
|
city:
|
||||||
type: string
|
type: string
|
||||||
state:
|
state:
|
||||||
type: string
|
type: string
|
||||||
country:
|
country:
|
||||||
type: string
|
type: string
|
||||||
description:
|
|
||||||
type: string
|
|
||||||
projectionType:
|
|
||||||
type:
|
type:
|
||||||
- string
|
|
||||||
- 'null'
|
|
||||||
rating:
|
|
||||||
type:
|
|
||||||
- integer
|
|
||||||
- 'null'
|
|
||||||
checksum:
|
|
||||||
type: string
|
type: string
|
||||||
isOffline:
|
source:
|
||||||
type: boolean
|
|
||||||
hasMetadata:
|
|
||||||
type: boolean
|
|
||||||
duplicateId:
|
|
||||||
type: string
|
type: string
|
||||||
resized:
|
|
||||||
type: boolean
|
|
||||||
'404':
|
'404':
|
||||||
description: photo not found
|
description: photo not found
|
||||||
"/api/v1/points":
|
"/api/v1/points":
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue