Skip to content

Commit 8f2851d

Browse files
committed
moved fields
1 parent a0d8cdb commit 8f2851d

File tree

9 files changed

+232
-218
lines changed

9 files changed

+232
-218
lines changed

internal/common/common.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,20 @@ func (c *Common) Secret() string {
7676

7777
// RouteRequestData contains request metadata and configuration used across routes
7878
type RouteRequestData struct {
79-
RequestConfig config.Config // Configuration for the current request
8079
DeviceID string // Unique identifier for the device making the request
8180
RequestID string // Unique identifier for this specific request
8281
ClientName string // Name of the client making the request
82+
RequestConfig config.Config // Configuration for the current request
8383
}
8484

8585
// ViewImageData contains the image data and metadata for displaying an image in the view
8686
type ViewImageData struct {
87-
ImmichAsset immich.Asset // ImmichAsset contains immich asset data
8887
ImageData string // ImageData contains the image as base64 data
8988
ImageBlurData string // ImageBlurData contains the blurred image as base64 data
90-
ImageDominantColor color.RGBA // ImageDominantColor contains the dominant color of the image
9189
ImageDate string // ImageDate contains the date of the image
9290
User string // User the user api key used
91+
ImmichAsset immich.Asset // ImmichAsset contains immich asset data
92+
ImageDominantColor color.RGBA // ImageDominantColor contains the dominant color of the image
9393
}
9494

9595
// ViewData contains all the data needed to render a view in the application
@@ -104,17 +104,17 @@ type ViewData struct {
104104
}
105105

106106
type ViewImageDataOptions struct {
107-
RelativeAssetWanted bool
108107
RelativeAssetBucket kiosk.Source
109108
RelativeAssetBucketID string
110109
ImageOrientation immich.ImageOrientation
110+
RelativeAssetWanted bool
111111
}
112112

113113
// ContextCopy stores a copy of key HTTP context information including URL and headers
114114
type ContextCopy struct {
115-
URL url.URL // The request URL
116115
RequestHeader http.Header // Headers from the incoming request
117116
ResponseHeader http.Header // Headers for the outgoing response
117+
URL url.URL // The request URL
118118
}
119119

120120
// CopyContext creates a copy of essential context data from an echo.Context

internal/config/config.go

Lines changed: 133 additions & 121 deletions
Large diffs are not rendered by default.

internal/demo/demo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ type LoginResponse struct {
1919
UserID string `json:"userId"`
2020
UserEmail string `json:"userEmail"`
2121
Name string `json:"name"`
22-
IsAdmin bool `json:"isAdmin"`
2322
ProfileImagePath string `json:"profileImagePath"`
23+
IsAdmin bool `json:"isAdmin"`
2424
ShouldChangePassword bool `json:"shouldChangePassword"`
2525
}
2626

internal/immich/immich.go

Lines changed: 73 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ type PersonStatistics struct {
8383
}
8484

8585
type Error struct {
86-
Message []string `json:"message"`
8786
Error string `json:"error"`
87+
Message []string `json:"message"`
8888
StatusCode int `json:"statusCode"`
8989
}
9090

@@ -95,28 +95,28 @@ type Owner struct {
9595
}
9696

9797
type ExifInfo struct {
98+
DateTimeOriginal time.Time `json:"dateTimeOriginal"`
99+
ModifyDate time.Time `json:"modifyDate"`
100+
ProjectionType any `json:"-"` // `json:"projectionType"`
98101
Make string `json:"make"`
99102
Model string `json:"model"`
100-
ExifImageWidth int `json:"exifImageWidth"`
101-
ExifImageHeight int `json:"exifImageHeight"`
102-
FileSizeInByte int `json:"fileSizeInByte"`
103103
Orientation string `json:"orientation"`
104-
DateTimeOriginal time.Time `json:"dateTimeOriginal"`
105-
ModifyDate time.Time `json:"modifyDate"`
106104
TimeZone string `json:"timeZone"`
107105
LensModel string `json:"lensModel"`
108-
FNumber float64 `json:"fNumber"`
109-
FocalLength float64 `json:"focalLength"`
110-
Iso int `json:"iso"`
111106
ExposureTime string `json:"exposureTime"`
112-
Latitude float64 `json:"latitude"`
113-
Longitude float64 `json:"longitude"`
114107
City string `json:"city"`
115108
State string `json:"state"`
116109
Country string `json:"country"`
117110
Description string `json:"description"`
118-
ProjectionType any `json:"-"` // `json:"projectionType"`
119111
ImageOrientation ImageOrientation
112+
ExifImageWidth int `json:"exifImageWidth"`
113+
ExifImageHeight int `json:"exifImageHeight"`
114+
FileSizeInByte int `json:"fileSizeInByte"`
115+
FNumber float64 `json:"fNumber"`
116+
FocalLength float64 `json:"focalLength"`
117+
Iso int `json:"iso"`
118+
Latitude float64 `json:"latitude"`
119+
Longitude float64 `json:"longitude"`
120120
}
121121

122122
type BirthDate string
@@ -129,13 +129,13 @@ func (bd BirthDate) Time() (time.Time, error) {
129129
}
130130

131131
type Person struct {
132+
UpdatedAt time.Time `json:"-"` // `json:"updatedAt"`
132133
ID string `json:"id"`
133134
Name string `json:"name"`
134135
BirthDate BirthDate `json:"birthDate"`
135136
ThumbnailPath string `json:"-"` // `json:"thumbnailPath"`
136-
IsHidden bool `json:"-"` // `json:"isHidden"`
137-
UpdatedAt time.Time `json:"-"` // `json:"updatedAt"`
138137
Faces []Face `json:"faces"`
138+
IsHidden bool `json:"-"` // `json:"isHidden"`
139139
}
140140

141141
type Tag struct {
@@ -149,59 +149,62 @@ type Tag struct {
149149

150150
type Face struct {
151151
ID string `json:"id"`
152+
SourceType string `json:"sourceType"`
152153
ImageHeight int `json:"imageHeight"`
153154
ImageWidth int `json:"imageWidth"`
154155
BoundingBoxX1 int `json:"boundingBoxX1"`
155156
BoundingBoxX2 int `json:"boundingBoxX2"`
156157
BoundingBoxY1 int `json:"boundingBoxY1"`
157158
BoundingBoxY2 int `json:"boundingBoxY2"`
158-
SourceType string `json:"sourceType"`
159159
}
160160

161161
type Asset struct {
162+
FileCreatedAt time.Time `json:"-"` // `json:"fileCreatedAt"`
163+
FileModifiedAt time.Time `json:"-"` // `json:"fileModifiedAt"`
164+
LocalDateTime time.Time `json:"localDateTime"`
165+
UpdatedAt time.Time `json:"-"` // `json:"updatedAt"`
166+
StackCount any `json:"-"` // `json:"stackCount"`
167+
DuplicateID any `json:"-"` // `json:"duplicateId"`
168+
169+
ctx context.Context `json:"-"`
170+
171+
// Data added and used by Kiosk
172+
mu *sync.Mutex
173+
Owner Owner `json:"owner"`
162174
ID string `json:"id"`
163175
DeviceAssetID string `json:"-"` // `json:"deviceAssetId"`
164176
OwnerID string `json:"ownerId"`
165-
Owner Owner `json:"owner"`
166177
DeviceID string `json:"-"` // `json:"deviceId"`
167178
LibraryID string `json:"-"` // `json:"libraryId"`
168179
Type AssetType `json:"type"`
169180
OriginalPath string `json:"-"` // `json:"originalPath"`
170181
OriginalFileName string `json:"originalFileName"`
171182
OriginalMimeType string `json:"originalMimeType"`
172183
Thumbhash string `json:"-"` // `json:"thumbhash"`
173-
FileCreatedAt time.Time `json:"-"` // `json:"fileCreatedAt"`
174-
FileModifiedAt time.Time `json:"-"` // `json:"fileModifiedAt"`
175-
LocalDateTime time.Time `json:"localDateTime"`
176-
UpdatedAt time.Time `json:"-"` // `json:"updatedAt"`
177-
IsFavorite bool `json:"isFavorite"`
178-
IsArchived bool `json:"isArchived"`
179-
IsTrashed bool `json:"isTrashed"`
180184
Duration string `json:"-"` // `json:"duration"`
181-
ExifInfo ExifInfo `json:"exifInfo"`
182185
LivePhotoVideoID string `json:"livePhotoVideoId"`
183-
People []Person `json:"people"`
184-
Tags Tags `json:"tags"`
185-
UnassignedFaces []Face `json:"unassignedFaces"`
186186
Checksum string `json:"checksum"`
187-
StackCount any `json:"-"` // `json:"stackCount"`
188-
IsOffline bool `json:"-"` // `json:"isOffline"`
189-
HasMetadata bool `json:"-"` // `json:"hasMetadata"`
190-
DuplicateID any `json:"-"` // `json:"duplicateId"`
191187
Visibility string `json:"-"` // `json:"visibility"`
192188

193-
// Data added and used by Kiosk
194-
mu *sync.Mutex
195189
RatioWanted ImageOrientation `json:"-"`
196-
IsPortrait bool `json:"isPortrait"`
197-
IsLandscape bool `json:"isLandscape"`
198190
MemoryTitle string `json:"-"`
199-
AppearsIn Albums `json:"kioskAppearsIn"`
200191
Bucket kiosk.Source `json:"kioskBucket"`
201192
BucketID string `json:"kioskBucketId"`
202193

203-
ctx context.Context `json:"-"`
204-
requestConfig config.Config `json:"-"`
194+
People []Person `json:"people"`
195+
Tags Tags `json:"tags"`
196+
UnassignedFaces []Face `json:"unassignedFaces"`
197+
AppearsIn Albums `json:"kioskAppearsIn"`
198+
ExifInfo ExifInfo `json:"exifInfo"`
199+
200+
requestConfig config.Config `json:"-"`
201+
IsFavorite bool `json:"isFavorite"`
202+
IsArchived bool `json:"isArchived"`
203+
IsTrashed bool `json:"isTrashed"`
204+
IsOffline bool `json:"-"` // `json:"isOffline"`
205+
HasMetadata bool `json:"-"` // `json:"hasMetadata"`
206+
IsPortrait bool `json:"isPortrait"`
207+
IsLandscape bool `json:"isLandscape"`
205208
}
206209

207210
type Album struct {
@@ -220,34 +223,34 @@ type SearchRandomBody struct {
220223
CreatedAfter string `url:"createdAfter,omitempty" json:"createdAfter,omitempty"`
221224
CreatedBefore string `url:"createdBefore,omitempty" json:"createdBefore,omitempty"`
222225
DeviceID string `url:"deviceId,omitempty" json:"deviceId,omitempty"`
223-
IsArchived bool `url:"isArchived,omitempty" json:"isArchived,omitempty"`
224-
IsEncoded bool `url:"isEncoded,omitempty" json:"isEncoded,omitempty"`
225-
IsFavorite bool `url:"isFavorite,omitempty" json:"isFavorite,omitempty"`
226-
IsMotion bool `url:"isMotion,omitempty" json:"isMotion,omitempty"`
227-
IsNotInAlbum bool `url:"isNotInAlbum,omitempty" json:"isNotInAlbum,omitempty"`
228-
IsOffline bool `url:"isOffline,omitempty" json:"isOffline,omitempty"`
229-
IsVisible bool `url:"isVisible,omitempty" json:"isVisible,omitempty"`
230226
LensModel string `url:"lensModel,omitempty" json:"lensModel,omitempty"`
231227
LibraryID string `url:"libraryId,omitempty" json:"libraryId,omitempty"`
232228
Make string `url:"make,omitempty" json:"make,omitempty"`
233229
Model string `url:"model,omitempty" json:"model,omitempty"`
234-
PersonIDs []string `url:"personIds,omitempty" json:"personIds,omitempty"`
235-
Size int `url:"size,omitempty" json:"size,omitempty"`
236230
State string `url:"state,omitempty" json:"state,omitempty"`
237-
TagIDs []string `url:"tagIds,omitempty" json:"tagIds,omitempty"`
238231
TakenAfter string `url:"takenAfter,omitempty" json:"takenAfter,omitempty"`
239232
TakenBefore string `url:"takenBefore,omitempty" json:"takenBefore,omitempty"`
240233
TrashedAfter string `url:"trashedAfter,omitempty" json:"trashedAfter,omitempty"`
241234
TrashedBefore string `url:"trashedBefore,omitempty" json:"trashedBefore,omitempty"`
242235
Type string `url:"type,omitempty" json:"type,omitempty"`
243236
UpdatedAfter string `url:"updatedAfter,omitempty" json:"updatedAfter,omitempty"`
244237
UpdatedBefore string `url:"updatedBefore,omitempty" json:"updatedBefore,omitempty"`
238+
PersonIDs []string `url:"personIds,omitempty" json:"personIds,omitempty"`
239+
TagIDs []string `url:"tagIds,omitempty" json:"tagIds,omitempty"`
240+
Size int `url:"size,omitempty" json:"size,omitempty"`
241+
Page int `url:"page,omitempty" json:"page,omitempty"`
242+
IsArchived bool `url:"isArchived,omitempty" json:"isArchived,omitempty"`
243+
IsEncoded bool `url:"isEncoded,omitempty" json:"isEncoded,omitempty"`
244+
IsFavorite bool `url:"isFavorite,omitempty" json:"isFavorite,omitempty"`
245+
IsMotion bool `url:"isMotion,omitempty" json:"isMotion,omitempty"`
246+
IsNotInAlbum bool `url:"isNotInAlbum,omitempty" json:"isNotInAlbum,omitempty"`
247+
IsOffline bool `url:"isOffline,omitempty" json:"isOffline,omitempty"`
248+
IsVisible bool `url:"isVisible,omitempty" json:"isVisible,omitempty"`
245249
WithArchived bool `url:"withArchived,omitempty" json:"withArchived,omitempty"`
246250
WithDeleted bool `url:"withDeleted,omitempty" json:"withDeleted,omitempty"`
247251
WithExif bool `url:"withExif,omitempty" json:"withExif,omitempty"`
248252
WithPeople bool `url:"withPeople,omitempty" json:"withPeople,omitempty"`
249253
WithStacked bool `url:"withStacked,omitempty" json:"withStacked,omitempty"`
250-
Page int `url:"page,omitempty" json:"page,omitempty"`
251254
}
252255

253256
type TagAssetsBody struct {
@@ -272,38 +275,38 @@ type UpsertTagResponse []struct {
272275

273276
type SearchMetadataResponse struct {
274277
Assets struct {
275-
Total int `json:"total"`
276278
NextPage string `json:"nextPage"`
279+
Total int `json:"total"`
277280
} `json:"assets"`
278281
}
279282

280283
type Memory struct {
281-
ID string `json:"id"`
282284
CreatedAt time.Time `json:"createdAt"`
283285
UpdatedAt time.Time `json:"updatedAt"`
284286
MemoryAt time.Time `json:"memoryAt"`
285287
ShowAt time.Time `json:"showAt"`
286288
HideAt time.Time `json:"hideAt"`
289+
ID string `json:"id"`
287290
OwnerID string `json:"ownerId"`
288291
Type immich_open_api.MemoryType `json:"type"`
292+
Assets []Asset `json:"assets"`
289293
Data struct {
290294
Year int `json:"year"`
291295
} `json:"data"`
292-
IsSaved bool `json:"isSaved"`
293-
Assets []Asset `json:"assets"`
296+
IsSaved bool `json:"isSaved"`
294297
}
295298

296299
type MemoriesResponse []Memory
297300

298301
type AssetFaceResponse struct {
302+
ID string `json:"id"`
303+
Person Person `json:"person"`
299304
BoundingBoxX1 int `json:"boundingBoxX1"`
300305
BoundingBoxX2 int `json:"boundingBoxX2"`
301306
BoundingBoxY1 int `json:"boundingBoxY1"`
302307
BoundingBoxY2 int `json:"boundingBoxY2"`
303-
ID string `json:"id"`
304308
ImageHeight int `json:"imageHeight"`
305309
ImageWidth int `json:"imageWidth"`
306-
Person Person `json:"person"`
307310
}
308311

309312
type TagAssetsResponse []struct {
@@ -322,13 +325,13 @@ type AlbumCreateBody struct {
322325
type UpdateAssetBody struct {
323326
DateTimeOriginal string `json:"dateTimeOriginal,omitempty"`
324327
Description string `json:"description,omitempty"`
325-
IsArchived bool `json:"isArchived"`
326-
IsFavorite bool `json:"isFavorite"`
327-
Latitude float64 `json:"latitude,omitempty"`
328328
LivePhotoVideoID string `json:"livePhotoVideoId,omitempty"`
329+
Visibility string `json:"visibility,omitempty"`
330+
Latitude float64 `json:"latitude,omitempty"`
329331
Longitude float64 `json:"longitude,omitempty"`
330332
Rating int `json:"rating,omitempty"`
331-
Visibility string `json:"visibility,omitempty"`
333+
IsArchived bool `json:"isArchived"`
334+
IsFavorite bool `json:"isFavorite"`
332335
}
333336

334337
// UserAvatarColor defines model for UserAvatarColor.
@@ -345,30 +348,30 @@ type UserLicense struct {
345348
type UserStatus string
346349

347350
type UserResponse struct {
348-
AvatarColor UserAvatarColor `json:"avatarColor"`
349351
CreatedAt time.Time `json:"createdAt"`
352+
ProfileChangedAt time.Time `json:"profileChangedAt"`
353+
UpdatedAt time.Time `json:"updatedAt"`
350354
DeletedAt *time.Time `json:"deletedAt"`
355+
License *UserLicense `json:"license"`
356+
QuotaSizeInBytes *int64 `json:"quotaSizeInBytes"`
357+
QuotaUsageInBytes *int64 `json:"quotaUsageInBytes"`
358+
StorageLabel *string `json:"storageLabel"`
359+
AvatarColor UserAvatarColor `json:"avatarColor"`
351360
Email string `json:"email"`
352361
ID string `json:"id"`
353-
IsAdmin bool `json:"isAdmin"`
354-
License *UserLicense `json:"license"`
355362
Name string `json:"name"`
356363
OauthID string `json:"oauthId"`
357-
ProfileChangedAt time.Time `json:"profileChangedAt"`
358364
ProfileImagePath string `json:"profileImagePath"`
359-
QuotaSizeInBytes *int64 `json:"quotaSizeInBytes"`
360-
QuotaUsageInBytes *int64 `json:"quotaUsageInBytes"`
361-
ShouldChangePassword bool `json:"shouldChangePassword"`
362365
Status UserStatus `json:"status"`
363-
StorageLabel *string `json:"storageLabel"`
364-
UpdatedAt time.Time `json:"updatedAt"`
366+
IsAdmin bool `json:"isAdmin"`
367+
ShouldChangePassword bool `json:"shouldChangePassword"`
365368
}
366369

367370
type AllPeopleResponse struct {
368-
HasNextPage bool `json:"hasNextPage"`
369-
Hidden int `json:"hidden"`
370371
People []Person `json:"people"`
372+
Hidden int `json:"hidden"`
371373
Total int `json:"total"`
374+
HasNextPage bool `json:"hasNextPage"`
372375
}
373376

374377
type apiCall func(context.Context, string, string, []byte, ...map[string]string) ([]byte, string, error)

internal/immich/immich_server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ type ServerAboutResponse struct {
1919
Ffmpeg *string `json:"ffmpeg,omitempty"`
2020
Imagemagick *string `json:"imagemagick,omitempty"`
2121
Libvips *string `json:"libvips,omitempty"`
22-
Licensed bool `json:"licensed"`
2322
Nodejs *string `json:"nodejs,omitempty"`
2423
Repository *string `json:"repository,omitempty"`
2524
RepositoryURL *string `json:"repositoryUrl,omitempty"`
@@ -32,6 +31,7 @@ type ServerAboutResponse struct {
3231
ThirdPartySupportURL *string `json:"thirdPartySupportUrl,omitempty"`
3332
Version string `json:"version"`
3433
VersionURL string `json:"versionUrl"`
34+
Licensed bool `json:"licensed"`
3535
}
3636

3737
func (a *Asset) AboutInfo() (ServerAboutResponse, error) {

internal/utils/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,11 @@ func WeightedRandomItem(assets []AssetWithWeighting) WeightedAsset {
382382

383383
// Color represents an RGB color with string representations
384384
type Color struct {
385+
RGB string
386+
Hex string
385387
R int
386388
G int
387389
B int
388-
RGB string
389-
Hex string
390390
}
391391

392392
// StringToColor takes any string and returns a Color struct with deterministic RGB values.

0 commit comments

Comments
 (0)