New backoffice: Add new codefile controllers and services (#14157)
* Add scaffolding * Entities not Entitys * Remove unececary obsoleted constructor * Implement create script * Return a simplified ScriptFile instead of IScript That file abstraction seems way too bloated, containing a lot of stuff that's not relevant for files, such as IDs and keys. * Use IScript instead of custom return model * Add validation when creating script * Add Get script endpoint * Add response types * Add Delete * Throw if user key not found * Remove unused maapper * Add update endpoint * Add Get by path * Add create folder endpoint * Don't pass performingUserId to folder creation * Remove update folder * Add delete folder endpoint * Use specific ScriptFolderOperationStatus instead of ScriptOperationStatus * Add OperationStatusResult * Check folder for invalid name * Check name for invalid characters * Add partial view snippet endpoint * Start working on CreatePartialView * Add create partial view endpoint * Retrieve key from audit method * Add operation status results * Add Get endpoint * Return 201 when creating * Add update partial view endpoint * Add delete endpoint * Add response types * Add folder base implementation * Add folder endpoints * User property for allowed file extensions * Rename async method to async * Break snippet into endpoint in two * Make content non-nullable * Remove IService * Add get by path * Add viewmodels * Add create and update models * Add create stylesheet * Add update endpoint * Rename StylesheetControllerBase to StylesheetControllerBase * Add stylesheet delete * Rename controller bases * Add stylesheet folders * Add status results * Add response types to folders * Add richtext rules endpoints * Add Get all endpoint * Add get rules by path endpoint * Aling validates so they're not async These are private methods, so there's no reason to make them preemptively async * Add template obsoletions to interface * Add stream methods This is evidently used by deploy 🤷 * Obsolete stylesheet operations * Add get and getall across all services * Obsolete script operations * Obsolete old partial view methods * Add some method docs * Add compatibility suppression * Update OpenApi.json * Rename action * formatting * Fix import * add expression body * Invert if * Move base on own line * Rename file * Rename to all * Change to stylesheet instead of script * Add Umbraco.Code.MapAll to map definitions * Add comment about auditing * use publish cancelable async * use expression body * formatting * fix to use pattern matching --------- Co-authored-by: Zeegaan <nge@umbraco.dk>
This commit is contained in:
@@ -101,6 +101,7 @@ public class FileService : RepositoryService, IFileService
|
||||
#region Stylesheets
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
|
||||
public IEnumerable<IStylesheet> GetStylesheets(params string[] paths)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
@@ -113,6 +114,7 @@ public class FileService : RepositoryService, IFileService
|
||||
_auditRepository.Save(new AuditItem(objectId, type, userId, entityType));
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
|
||||
public IStylesheet? GetStylesheet(string? path)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
@@ -122,6 +124,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
|
||||
public void SaveStylesheet(IStylesheet? stylesheet, int? userId = null)
|
||||
{
|
||||
if (stylesheet is null)
|
||||
@@ -150,6 +153,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
|
||||
public void DeleteStylesheet(string path, int? userId)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -181,6 +185,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
|
||||
public void CreateStyleSheetFolder(string folderPath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -191,6 +196,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IStylesheetFolderService for stylesheet folder operations - will be removed in Umbraco 15")]
|
||||
public void DeleteStyleSheetFolder(string folderPath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -201,6 +207,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
|
||||
public Stream GetStylesheetFileContentStream(string filepath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
@@ -210,6 +217,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
|
||||
public void SetStylesheetFileContent(string filepath, Stream content)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -220,6 +228,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
|
||||
public long GetStylesheetFileSize(string filepath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
@@ -233,6 +242,7 @@ public class FileService : RepositoryService, IFileService
|
||||
#region Scripts
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
|
||||
public IEnumerable<IScript> GetScripts(params string[] names)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
@@ -242,6 +252,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
|
||||
public IScript? GetScript(string? name)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
@@ -251,6 +262,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
|
||||
public void SaveScript(IScript? script, int? userId)
|
||||
{
|
||||
if (userId is null)
|
||||
@@ -283,6 +295,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
|
||||
public void DeleteScript(string path, int? userId = null)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -313,6 +326,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IScriptFolderService for script folder operations - will be removed in Umbraco 15")]
|
||||
public void CreateScriptFolder(string folderPath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -323,6 +337,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IScriptFolderService for script folder operations - will be removed in Umbraco 15")]
|
||||
public void DeleteScriptFolder(string folderPath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -333,6 +348,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
|
||||
public Stream GetScriptFileContentStream(string filepath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
@@ -342,6 +358,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
|
||||
public void SetScriptFileContent(string filepath, Stream content)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -352,6 +369,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
|
||||
public long GetScriptFileSize(string filepath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
@@ -571,6 +589,7 @@ public class FileService : RepositoryService, IFileService
|
||||
|
||||
#region Partial Views
|
||||
|
||||
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
|
||||
public IEnumerable<string> GetPartialViewSnippetNames(params string[] filterNames)
|
||||
{
|
||||
var snippetProvider =
|
||||
@@ -590,6 +609,7 @@ public class FileService : RepositoryService, IFileService
|
||||
return empty.Union(files.Except(empty)).WhereNotNull();
|
||||
}
|
||||
|
||||
[Obsolete("Please use IPartialViewFolderService for partial view folder operations - will be removed in Umbraco 15")]
|
||||
public void DeletePartialViewFolder(string folderPath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -608,6 +628,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
|
||||
public IEnumerable<IPartialView> GetPartialViews(params string[] names)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
@@ -616,6 +637,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
|
||||
public IPartialView? GetPartialView(string path)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
@@ -632,12 +654,14 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
|
||||
public Attempt<IPartialView?> CreatePartialView(IPartialView partialView, string? snippetName = null, int? userId = Constants.Security.SuperUserId) =>
|
||||
CreatePartialViewMacro(partialView, PartialViewType.PartialView, snippetName, userId);
|
||||
|
||||
public Attempt<IPartialView?> CreatePartialViewMacro(IPartialView partialView, string? snippetName = null, int? userId = Constants.Security.SuperUserId) =>
|
||||
CreatePartialViewMacro(partialView, PartialViewType.PartialViewMacro, snippetName, userId);
|
||||
|
||||
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
|
||||
public bool DeletePartialView(string path, int? userId = null) =>
|
||||
DeletePartialViewMacro(path, PartialViewType.PartialView, userId);
|
||||
|
||||
@@ -719,6 +743,7 @@ public class FileService : RepositoryService, IFileService
|
||||
public bool DeletePartialViewMacro(string path, int? userId = null) =>
|
||||
DeletePartialViewMacro(path, PartialViewType.PartialViewMacro, userId);
|
||||
|
||||
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
|
||||
public Attempt<IPartialView?> SavePartialView(IPartialView partialView, int? userId = null) =>
|
||||
SavePartialView(partialView, PartialViewType.PartialView, userId);
|
||||
|
||||
@@ -757,6 +782,7 @@ public class FileService : RepositoryService, IFileService
|
||||
public Attempt<IPartialView?> SavePartialViewMacro(IPartialView partialView, int? userId = null) =>
|
||||
SavePartialView(partialView, PartialViewType.PartialViewMacro, userId);
|
||||
|
||||
[Obsolete("Please use IPartialViewFolderService for partial view folder operations - will be removed in Umbraco 15")]
|
||||
public void CreatePartialViewFolder(string folderPath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -772,6 +798,7 @@ public class FileService : RepositoryService, IFileService
|
||||
return headerMatch.Replace(contents, string.Empty);
|
||||
}
|
||||
|
||||
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
|
||||
private Attempt<IPartialView?> SavePartialView(IPartialView partialView, PartialViewType partialViewType, int? userId = null)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -823,6 +850,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
|
||||
public Stream GetPartialViewFileContentStream(string filepath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
@@ -845,6 +873,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
|
||||
public void SetPartialViewFileContent(string filepath, Stream content)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope())
|
||||
@@ -855,6 +884,7 @@ public class FileService : RepositoryService, IFileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
|
||||
public long GetPartialViewFileSize(string filepath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
|
||||
Reference in New Issue
Block a user