High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
refactor(server, web): standardize theme api response (#4664)
Wingya08a687951d6
diff --git a/cli/src/api/open-api/api.ts b/cli/src/api/open-api/api.tsindex 688fc7a488..809f3f0079 100644--- a/cli/src/api/open-api/api.ts+++ b/cli/src/api/open-api/api.ts@@ -2966,10 +2966,10 @@ export interface ServerStatsResponseDto {export interface ServerThemeDto {/***- * @type {SystemConfigThemeDto}+ * @type {string}* @memberof ServerThemeDto*/- 'theme': SystemConfigThemeDto;+ 'customCss': string;}/***diff --git a/mobile/openapi/doc/ServerThemeDto.md b/mobile/openapi/doc/ServerThemeDto.mdindex d79f55cf3a..506f60b793 100644--- a/mobile/openapi/doc/ServerThemeDto.md+++ b/mobile/openapi/doc/ServerThemeDto.md@@ -8,7 +8,7 @@ import 'package:openapi/api.dart';## PropertiesName | Type | Description | Notes------------ | ------------- | ------------- | --------------**theme** | [**SystemConfigThemeDto**](SystemConfigThemeDto.md) | |+**customCss** | **String** | |[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)diff --git a/mobile/openapi/lib/model/server_theme_dto.dart b/mobile/openapi/lib/model/server_theme_dto.dartindex e803c58809..f31596033e 100644--- a/mobile/openapi/lib/model/server_theme_dto.dart+++ b/mobile/openapi/lib/model/server_theme_dto.dart@@ -13,26 +13,26 @@ part of openapi.api;class ServerThemeDto {/// Returns a new [ServerThemeDto] instance.ServerThemeDto({- required this.theme,+ required this.customCss,});- SystemConfigThemeDto theme;+ String customCss;@overridebool operator ==(Object other) => identical(this, other) || other is ServerThemeDto &&- other.theme == theme;+ other.customCss == customCss;@overrideint get hashCode =>// ignore: unnecessary_parenthesis- (theme.hashCode);+ (customCss.hashCode);@override- String toString() => 'ServerThemeDto[theme=$theme]';+ String toString() => 'ServerThemeDto[customCss=$customCss]';Map<String, dynamic> toJson() {final json = <String, dynamic>{};- json[r'theme'] = this.theme;+ json[r'customCss'] = this.customCss;return json;}@@ -44,7 +44,7 @@ class ServerThemeDto {final json = value.cast<String, dynamic>();return ServerThemeDto(- theme: SystemConfigThemeDto.fromJson(json[r'theme'])!,+ customCss: mapValueOfType<String>(json, r'customCss')!,);}return null;@@ -92,7 +92,7 @@ class ServerThemeDto {/// The list of required keys that must be present in a JSON.static const requiredKeys = <String>{- 'theme',+ 'customCss',};}diff --git a/mobile/openapi/test/server_theme_dto_test.dart b/mobile/openapi/test/server_theme_dto_test.dartindex c1f63ea499..d340b8f55d 100644--- a/mobile/openapi/test/server_theme_dto_test.dart+++ b/mobile/openapi/test/server_theme_dto_test.dart@@ -16,8 +16,8 @@ void main() {// final instance = ServerThemeDto();group('test ServerThemeDto', () {- // SystemConfigThemeDto theme- test('to test the property `theme`', () async {+ // String customCss+ test('to test the property `customCss`', () async {// TODO});diff --git a/server/immich-openapi-specs.json b/server/immich-openapi-specs.jsonindex 58e0e3055a..d934d50b3c 100644--- a/server/immich-openapi-specs.json+++ b/server/immich-openapi-specs.json@@ -7836,12 +7836,12 @@},"ServerThemeDto": {"properties": {- "theme": {- "$ref": "#/components/schemas/SystemConfigThemeDto"+ "customCss": {+ "type": "string"}},"required": [- "theme"+ "customCss"],"type": "object"},diff --git a/server/src/domain/server-info/server-info.dto.ts b/server/src/domain/server-info/server-info.dto.tsindex 40a5f3a474..846458223d 100644--- a/server/src/domain/server-info/server-info.dto.ts+++ b/server/src/domain/server-info/server-info.dto.ts@@ -80,9 +80,7 @@ export class ServerMediaTypesResponseDto {sidecar!: string[];}-export class ServerThemeDto {- theme!: SystemConfigThemeDto;-}+export class ServerThemeDto extends SystemConfigThemeDto {}export class ServerConfigDto {oauthButtonText!: string;diff --git a/server/src/domain/server-info/server-info.service.ts b/server/src/domain/server-info/server-info.service.tsindex bb1b22729b..f2d3123432 100644--- a/server/src/domain/server-info/server-info.service.ts+++ b/server/src/domain/server-info/server-info.service.ts@@ -72,7 +72,7 @@ export class ServerInfoService {async getTheme() {const { theme } = await this.configCore.getConfig();- return { theme };+ return theme;}async getConfig(): Promise<ServerConfigDto> {diff --git a/server/test/e2e/server-info.e2e-spec.ts b/server/test/e2e/server-info.e2e-spec.tsindex 8f776187f4..a19c6235ee 100644--- a/server/test/e2e/server-info.e2e-spec.ts+++ b/server/test/e2e/server-info.e2e-spec.ts@@ -161,9 +161,7 @@ describe(`${ServerInfoController.name} (e2e)`, () => {const { status, body } = await request(server).get('/server-info/theme');expect(status).toBe(200);expect(body).toEqual({- theme: {- customCss: '',- },+ customCss: '',});});});diff --git a/web/src/api/open-api/api.ts b/web/src/api/open-api/api.tsindex 688fc7a488..809f3f0079 100644--- a/web/src/api/open-api/api.ts+++ b/web/src/api/open-api/api.ts@@ -2966,10 +2966,10 @@ export interface ServerStatsResponseDto {export interface ServerThemeDto {/***- * @type {SystemConfigThemeDto}+ * @type {string}* @memberof ServerThemeDto*/- 'theme': SystemConfigThemeDto;+ 'customCss': string;}/***diff --git a/web/src/routes/custom.css/+server.ts b/web/src/routes/custom.css/+server.tsindex d5ea304cd5..e71728f2a6 100644--- a/web/src/routes/custom.css/+server.ts+++ b/web/src/routes/custom.css/+server.ts@@ -1,9 +1,7 @@import { RequestHandler, text } from '@sveltejs/kit';export const GET = (async ({ locals: { api } }) => {const {- data: {- theme: { customCss },- },+ data: { customCss },} = await api.serverInfoApi.getTheme();return text(customCss, {headers: {