f7a720204a
- 移除 GovAI, nomifun-tauri, 算力盒子 的 submodule 引用 - 添加所有子项目的完整源代码 - 保留原始 .git 为 .git.bak 备份
56 lines
2.3 KiB
Rust
56 lines
2.3 KiB
Rust
//! Branding configuration service — converts DB rows to API types.
|
|
use nomifun_api_types::{
|
|
BrandingConfigResponse, PresetColorsResponse, ThemePresetResponse,
|
|
};
|
|
use nomifun_db::models::{BrandingConfigRow, ThemePreset};
|
|
|
|
/// Convert `BrandingConfigRow` to `BrandingConfigResponse`.
|
|
pub fn branding_config_row_to_response(row: BrandingConfigRow) -> BrandingConfigResponse {
|
|
BrandingConfigResponse {
|
|
id: row.id,
|
|
logo_light: row.logo_light,
|
|
logo_dark: row.logo_dark,
|
|
logo_favicon: row.logo_favicon,
|
|
primary_color: row.primary_color,
|
|
secondary_color: row.secondary_color,
|
|
accent_color: row.accent_color,
|
|
background_light: row.background_light,
|
|
background_dark: row.background_dark,
|
|
surface_light: row.surface_light,
|
|
surface_dark: row.surface_dark,
|
|
text_primary_light: row.text_primary_light,
|
|
text_primary_dark: row.text_primary_dark,
|
|
text_secondary_light: row.text_secondary_light,
|
|
text_secondary_dark: row.text_secondary_dark,
|
|
border_light: row.border_light,
|
|
border_dark: row.border_dark,
|
|
active_preset: row.active_preset,
|
|
custom_css: row.custom_css,
|
|
created_at: row.created_at,
|
|
updated_at: row.updated_at,
|
|
}
|
|
}
|
|
|
|
/// Convert `ThemePreset` to `ThemePresetResponse`.
|
|
pub fn theme_preset_to_response(preset: ThemePreset) -> ThemePresetResponse {
|
|
ThemePresetResponse {
|
|
id: preset.id,
|
|
name: preset.name,
|
|
description: preset.description,
|
|
colors: PresetColorsResponse {
|
|
primary_color: preset.colors.primary_color,
|
|
secondary_color: preset.colors.secondary_color,
|
|
accent_color: preset.colors.accent_color,
|
|
background_light: preset.colors.background_light,
|
|
background_dark: preset.colors.background_dark,
|
|
surface_light: preset.colors.surface_light,
|
|
surface_dark: preset.colors.surface_dark,
|
|
text_primary_light: preset.colors.text_primary_light,
|
|
text_primary_dark: preset.colors.text_primary_dark,
|
|
text_secondary_light: preset.colors.text_secondary_light,
|
|
text_secondary_dark: preset.colors.text_secondary_dark,
|
|
border_light: preset.colors.border_light,
|
|
border_dark: preset.colors.border_dark,
|
|
},
|
|
}
|
|
} |