fluentcms / FluentCMS

ASP.NET Core Blazor Content Management System (CMS)
https://www.fluentcms.com
MIT License
29 stars 8 forks source link

#1757 Refactor controllers and models for API consistency #1758

Closed pournasserian closed 6 days ago

pournasserian commented 1 week ago

This commit introduces significant updates across various controllers and models to enhance API consistency, data encapsulation, and separation of concerns. Key changes include the transformation of DTOs to entity models in controllers like ApiTokenController and ContentTypeController, ensuring data is correctly mapped using AutoMapper. The FolderController now uses the Entities.Folder type for the _rootFolder field, aligning with entity model consistency.

Adjustments in the GlobalSettingsController and RoleController improve API response structures by utilizing DTOs, fostering better data encapsulation. A project reference to Shared.csproj has been added to FluentCMS.Web.Api.csproj, indicating a dependency on shared code or models. Enhancements in the MappingProfile class support the conversion between entity models and DTOs, crucial for data transformation.

The commit also includes the removal and subsequent re-addition of the ApiResult, ApiPagingResult classes, and various model classes, suggesting a refactoring effort for cleanup or modification. Changes in global usings and validation attributes indicate a reorganization of code related to model validation and namespace declarations. The namespace change for the SetupManager class and the updated configuration for the developer exception page in Program.cs reflect project restructuring for better organization.

Furthermore, the reintroduction of the ApiPagingResult class provides a structured approach to paginated API responses. New namespaces, interfaces, and models have been introduced to standardize API responses and organize models related to API data structures, enhancing the overall structure and readability of the codebase. These changes collectively aim to improve the application's maintainability, scalability, and adherence to best practices in software development.