Files
flatrender/services/studio/FlatRender.StudioSvc/Models/Requests/Requests.cs
T
soroush.asadi c0d04fa855 feat(studio+render): wire theme picker → saved_shared_colors → FlexStory render
Closes the theme→render gap: the studio theme picker now actually drives a
FlexStory render's colours. GetFlexStoryProps reads saved_shared_colors by
element_key (accentColor/secondaryColor/backgroundColor/textColor), but the studio
only wrote the theme into scene_data — so the picker never reached the MP4.

- studio-svc: UpdateSharedColorsAsync upserts saved_shared_colors by (project,
  element_key) + PATCH /v1/saved-projects/{id}/shared-colors endpoint +
  UpdateColorsRequest/UpdateColorItem. Mirrors UpdateSceneContentsAsync. (dotnet
  build: 0 errors.)
- gateway already wildcard-routes /v1/saved-projects/*path → studio-svc (no change).
- Next: /api/projects/[id]/colors route → gateway; project-api patchProjectColors
  + themeColorsFromSceneData (maps scene_data sceneAccentColor… → the colorSchema
  keys); performSave best-effort pushes the 4 colours alongside contents.

Chain: theme picker → store → scene_data → performSave → patchProjectColors →
gateway → studio-svc upsert → saved_shared_colors → GetFlexStoryProps → render.
Verified: Next build + dotnet build both clean; theme presets render cohesively
across all 6 (incl. dark Midnight). End-to-end studio→render needs the live stack.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 17:04:47 +03:30

137 lines
3.4 KiB
C#

namespace FlatRender.StudioSvc.Models.Requests;
public record CreateSavedProjectRequest(
Guid OriginalProjectId,
string? Name,
Guid? PresetStoryId,
bool CopyDefaultValues = true
);
public record UpdateSavedProjectRequest(
string? Name,
string? Image,
string? Type,
Guid? MusicFileId,
Guid? MusicTrackId,
decimal? MusicVolume,
Guid? VoiceoverFileId,
decimal? VoiceoverVolume,
bool? VoiceoverRecordedInBrowser,
decimal? SfxVolume,
bool? SfxEnabled,
string? AudioVisualizerMusicUrl,
decimal? AudioVisualizerDurationSec,
bool? ManualColorPicker,
Guid? SelectedPresetStoryId,
string? LastEditStep,
string? EditState
);
public record SaveSceneRequest(
Guid? OriginalSceneId,
string Key,
string? Title,
string? Image,
string? SceneColorSvg,
string SceneType,
int Sort,
decimal SceneLengthSec,
decimal? MinDurationSec,
decimal? MaxDurationSec,
decimal OverlapAtEndSec,
bool CanHandleDuration,
bool ManualColorSelection,
List<SaveSceneContentRequest> Contents,
List<SaveSceneColorRequest> Colors,
List<SaveSharedColorRequest> SharedColors,
List<SaveSharedLayerRequest> SharedLayers
);
public record SaveSceneContentRequest(
string Key,
string? Title,
string Type,
string? Value,
Guid? ValueFileId,
string? InsertedFileType,
string? FontFace,
string? FontFaceName,
int? FontSize,
int? DefaultFontSize,
string? DefaultFontFace,
string? Justify,
int PositionInContainer,
int DirectionLayerValue,
bool IsTextBox,
string? AiInputType,
int? SelectedDp,
string? RepeaterItemKey,
int? RepeaterIndex,
bool IsFocused,
string? MappedList,
string? Thumbnail,
int Sort
);
public record SaveSceneColorRequest(
string ElementKey,
string? Title,
string? Icon,
string AttrValue,
string Value,
bool IsSelected,
int Sort
);
public record SaveSharedColorRequest(
string ElementKey,
string? Title,
string? Icon,
string AttrValue,
string Value,
bool IsSelected,
int Sort
);
public record SaveSharedLayerRequest(
string Key,
string? Title,
string Type,
string? Value,
Guid? ValueFileId,
string? FontFace,
string? FontFaceName,
int? FontSize,
string? Justify,
int PositionInContainer,
int DirectionLayerValue,
bool IsTextBox,
string? AiInputType,
string? MappedList,
string? Thumbnail,
int? Width,
int? Height,
bool IsFocused,
bool IsFontChangeable,
bool IsFontSizeChangeable,
int Sort
);
public record SavedProjectListRequest(
int Page = 1,
int PageSize = 20,
string? Q = null,
string? Type = null
);
/// <summary>Lightweight update of individual scene-input values — the studio editor
/// writes the user's edits here (by content key) so the render binder picks them up.</summary>
public record UpdateContentsRequest(List<UpdateContentItem> Items);
public record UpdateContentItem(string Key, string? Value, Guid? ValueFileId);
/// <summary>Update the project-wide theme colours (the studio theme picker) by
/// element key (accentColor/secondaryColor/backgroundColor/textColor) so the
/// FlexStory render binder reads them from saved_shared_colors.</summary>
public record UpdateColorsRequest(List<UpdateColorItem> Items);
public record UpdateColorItem(string Key, string Value);