Release 0.4.5 with metadata tools and responsive layers
This commit is contained in:
1 parent
00053e4d5f
commit
f480ce23ca
8 files changed
+253
-17
No files matched your search
@@ -147,6 +147,36 @@ public sealed class ProjectStorageService
|
||||
finally { _gate.Release(); }
|
||||
}
|
||||
|
||||
public async Task<MapProjectSummary> RenameAsync(string projectId, string name)
|
||||
{
|
||||
var normalizedName = NormalizeName(name);
|
||||
await _gate.WaitAsync();
|
||||
try
|
||||
{
|
||||
var files = await ReadProjectFilesAsync();
|
||||
var project = files.FirstOrDefault(item => item.Document.Id == projectId)
|
||||
?? throw new FileNotFoundException("Il progetto selezionato non esiste piu'.");
|
||||
if (project.Document.AccessMode == "readonly")
|
||||
{
|
||||
throw new InvalidOperationException("Il progetto e' in sola lettura. Duplicalo per modificarlo.");
|
||||
}
|
||||
if (files.Any(item => item.Document.Id != projectId
|
||||
&& string.Equals(item.Document.Name, normalizedName, StringComparison.CurrentCultureIgnoreCase)))
|
||||
{
|
||||
throw new InvalidOperationException($"Esiste gia' un progetto chiamato '{normalizedName}'.");
|
||||
}
|
||||
|
||||
project.Document.Name = normalizedName;
|
||||
project.Document.UpdatedAt = DateTimeOffset.UtcNow;
|
||||
await File.WriteAllTextAsync(
|
||||
project.Path,
|
||||
JsonSerializer.Serialize(project.Document, _jsonOptions),
|
||||
new UTF8Encoding(false));
|
||||
return project.Document.ToSummary();
|
||||
}
|
||||
finally { _gate.Release(); }
|
||||
}
|
||||
|
||||
public async Task UpdateOrganizationAsync(string projectId, string? folder = null, bool? isArchived = null)
|
||||
{
|
||||
await _gate.WaitAsync();
|
||||
|
||||
Reference in new issue
Block a user