feat: add normalization helper functions and integrate into services

- Introduced new helper functions for string and date normalization, enhancing input validation across various services.
- Updated SiteSettingService and SystemSettingService to utilize the new normalization functions for improved data handling.
- Refactored existing code to replace custom normalization logic with the new helper methods, ensuring consistency and reducing redundancy.
- Enhanced localization files to support new error messages related to normalization.

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-11-22 01:21:26 +08:00
parent f0678038c2
commit 9095bb08c8
36 changed files with 5273 additions and 340 deletions

View File

@@ -215,15 +215,23 @@ export interface CustomStorageConfig {
[key: string]: unknown
}
export type StorageConfig = S3Config | B2Config | GitHubConfig | EagleConfig | LocalConfig | CustomStorageConfig
export type RemoteStorageProviderName = 's3' | 'b2' | 'github'
export type LocalStorageProviderName = 'eagle' | 'local'
export const REMOTE_STORAGE_PROVIDERS = ['s3', 'b2', 'github'] as const
export const LOCAL_STORAGE_PROVIDERS = ['eagle', 'local'] as const
export const REMOTE_STORAGE_PROVIDERS: readonly RemoteStorageProviderName[] = ['s3', 'b2', 'github']
export const LOCAL_STORAGE_PROVIDERS: readonly LocalStorageProviderName[] = ['eagle', 'local']
export type RemoteStorageProviderName = (typeof REMOTE_STORAGE_PROVIDERS)[number]
export type LocalStorageProviderName = (typeof LOCAL_STORAGE_PROVIDERS)[number]
export type RemoteStorageConfig = S3Config | B2Config | GitHubConfig
export type LocalStorageConfig = EagleConfig | LocalConfig
export type ManagedStorageConfig = {
provider: 'managed'
tenantId: string
providerKey?: string | null
basePrefix?: string | null
upstream: RemoteStorageConfig
}
export type StorageConfig = RemoteStorageConfig | LocalStorageConfig | ManagedStorageConfig | CustomStorageConfig
export type StorageProviderCategory = 'remote' | 'local'
export type RemoteStorageConfig = Extract<StorageConfig, { provider: RemoteStorageProviderName }>
export type LocalStorageConfig = Extract<StorageConfig, { provider: LocalStorageProviderName }>