PlanetaryDocs icon indicating copy to clipboard operation
PlanetaryDocs copied to clipboard

Add delete functionality.

Open JeremyLikness opened this issue 3 years ago • 6 comments

Is your feature request related to a problem? Please describe. I need to be able to delete documents!

Describe the solution you'd like Provide delete capabilities on the main list page and from the view page. The delete should:

switch to a fake alias (i.e. 'system') and call CheckAuthorChangedAsync to remove it from the existing alias. Then it should call HandleTagsAsync with author changed set to false to do the same with tags. Finally, call the delete method on the context.

Describe alternatives you've considered N/A

Additional context N/A

JeremyLikness avatar Apr 19 '21 23:04 JeremyLikness

I want to do the work can you assign it to me ?

JK-404 avatar Apr 22 '21 20:04 JK-404

My pleasure. Let me know if you have questions or feedback. Thanks, @CoonZZ!

JeremyLikness avatar Apr 23 '21 03:04 JeremyLikness

Hey @JeremyLikness I keep getting exceptions when I try to add items or do searches. I am also not sure where to add the delete functionality, do you mean with "main list"the Home tab page and with "View Page" the view tab ?

System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
   at System.Convert.FromBase64_ComputeResultLength(Char* inputPtr, Int32 inputLength)
   at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
   at System.Convert.FromBase64String(String s)
   at Microsoft.Azure.Cosmos.StringHMACSHA256Hash..ctor(String base64EncodedKey)
   at Microsoft.Azure.Cosmos.DocumentClient..ctor(Uri serviceEndpoint, String authKeyOrResourceToken, EventHandler`1 sendingRequestEventArgs, ConnectionPolicy connectionPolicy, Nullable`1 desiredConsistencyLevel, JsonSerializerSettings serializerSettings, ApiType apitype, EventHandler`1 receivedResponseEventArgs, HttpMessageHandler handler, ISessionContainer sessionContainer, Nullable`1 enableCpuMonitor, Func`2 transportClientHandlerFactory, IStoreClientFactory storeClientFactory)
   at Microsoft.Azure.Cosmos.ClientContextCore.Create(CosmosClient cosmosClient, CosmosClientOptions clientOptions)
   at Microsoft.Azure.Cosmos.CosmosClient..ctor(String accountEndpoint, String authKeyOrResourceToken, CosmosClientOptions clientOptions)
   at Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal.SingletonCosmosClientWrapper.get_Client()
   at Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal.CosmosClientWrapper.get_Client()
   at Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal.CosmosClientWrapper.CreateQuery(String containerId, String partitionKey, CosmosSqlQuery query)
   at Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal.CosmosClientWrapper.DocumentAsyncEnumerable.AsyncEnumerator.MoveNextAsync()
   at Microsoft.EntityFrameworkCore.Cosmos.Query.Internal.CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at PlanetaryDocs.DataAccess.DocumentService.LoadDocNoTrackingAsync(DocsContext context, Document document) in C:\Users\CoonZ\Documents\PlanetaryDocs\PlanetaryDocs.DataAccess\DocumentService.cs:line 298
   at PlanetaryDocs.DataAccess.DocumentService.CheckAuthorChangedAsync(DocsContext context, Document document) in C:\Users\CoonZ\Documents\PlanetaryDocs\PlanetaryDocs.DataAccess\DocumentService.cs:line 416
   at PlanetaryDocs.DataAccess.DocumentService.HandleMetaAsync(DocsContext context, Document document) in C:\Users\CoonZ\Documents\PlanetaryDocs\PlanetaryDocs.DataAccess\DocumentService.cs:line 313
   at PlanetaryDocs.DataAccess.DocumentService.InsertDocumentAsync(Document document) in C:\Users\CoonZ\Documents\PlanetaryDocs\PlanetaryDocs.DataAccess\DocumentService.cs:line 41
   at PlanetaryDocs.Pages.AddBase.<SaveAsync>b__42_0() in C:\Users\CoonZ\Documents\PlanetaryDocs\PlanetaryDocs\Pages\AddBase.cs:line 110
   at PlanetaryDocs.Services.LoadingService.WrapExecutionAsync(Func`1 execution, Func`1 stateChanged) in C:\Users\CoonZ\Documents\PlanetaryDocs\PlanetaryDocs\Services\LoadingService.cs:line 113
   at PlanetaryDocs.Services.LoadingService.WrapExecutionAsync(Func`1 execution, Func`1 stateChanged) in C:\Users\CoonZ\Documents\PlanetaryDocs\PlanetaryDocs\Services\LoadingService.cs:line 122
   at PlanetaryDocs.Pages.AddBase.SaveAsync() in C:\Users\CoonZ\Documents\PlanetaryDocs\PlanetaryDocs\Pages\AddBase.cs:line 109
   at PlanetaryDocs.Shared.EditBar.<BuildRenderTree>b__0_0() in C:\Users\CoonZ\Documents\PlanetaryDocs\PlanetaryDocs\Shared\EditBar.razor:line 7
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit '9DU89rD-jv2wQvdbCM3ivK7MJ-n2XOd51GaPDEHYX3E'.

grafik

JK-404 avatar Apr 24 '21 11:04 JK-404

That error usually happens when you don't paste the full key. It should have == at the end. I think being able to delete from both home grid and view is ideal.

JeremyLikness avatar Apr 24 '21 14:04 JeremyLikness

Ping @Mr-Billionaire did the above resolve your issue?

JeremyLikness avatar Apr 29 '21 19:04 JeremyLikness

@JeremyLikness

I using the local azure cosmos DB and it is working now. I guess I also used the wrong AccessKey in the appsettings.json I used the Primary Connection String instead of the Primary Key. But well now its working and I can start :D

JK-404 avatar Apr 30 '21 09:04 JK-404