-
Notifications
You must be signed in to change notification settings - Fork 0
DN-3423 feat: Events occuring multiple times #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
goomens
merged 12 commits into
main
from
feature/DN-3423-Events-occurring-multiple-times-versioning
Nov 26, 2025
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
105d9a8
DN-3423 feat: Events occuring multiple times
raboer 8e3474a
DN-3423 Fixed some small issues
raboer 57b05fe
DN-3423 Added nuget
raboer 604c369
DN-3423 Store type of operation in eventlog (insert, update). Delete …
raboer 818cf35
Merge branch 'main' into feature/DN-3423-Events-occurring-multiple-ti…
raboer 84ea5a5
DN-3423 Handle deletion of events
raboer ef6ad13
Merge branch 'main' into feature/DN-3423-Events-occurring-multiple-ti…
goomens 6a81dd4
Merge branch 'main' into feature/DN-3423-Events-occurring-multiple-ti…
raboer 154e10a
DN-3423 Made eventlog operation enum and did some refactorings
raboer 4559198
Merge branch 'main' into feature/DN-3423-Events-occurring-multiple-ti…
goomens 2764b00
DN-3423 chore: formatting
goomens d4266e6
DN-3423 Fixed issue where enum wasnt serialized as string
raboer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,27 @@ | ||
| using UvA.Workflow.Api.Infrastructure; | ||
| using UvA.Workflow.Events; | ||
|
|
||
| namespace UvA.Workflow.Api.Events; | ||
|
|
||
| [Route("/WorkflowInstances/{instanceId}/Events")] | ||
| public class EventsController(IWorkflowInstanceRepository workflowRepository, InstanceService instanceService) | ||
| public class EventsController( | ||
| IWorkflowInstanceRepository workflowRepository, | ||
| IUserService userService, | ||
| IInstanceEventService eventService) | ||
| : ApiControllerBase | ||
| { | ||
| [HttpDelete] | ||
| [Route("{eventName}")] | ||
| public async Task<IActionResult> DeleteEvent(string instanceId, string eventName, CancellationToken ct) | ||
| { | ||
| var user = await userService.GetCurrentUser(ct); | ||
| if (user == null) | ||
| return Unauthorized(); | ||
|
|
||
| var instance = await workflowRepository.GetById(instanceId, ct); | ||
| if (instance == null) | ||
| return WorkflowInstanceNotFound; | ||
| await instanceService.DeleteEvent(instance, eventName, ct); | ||
| await eventService.DeleteEvent(instance, eventName, user, ct); | ||
| return Ok(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| using UvA.Workflow.Events; | ||
| using UvA.Workflow.WorkflowInstances; | ||
|
|
||
| namespace UvA.Workflow.Tests; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| namespace UvA.Workflow.Events; | ||
|
|
||
| public interface IInstanceEventRepository | ||
| { | ||
| /// <summary> | ||
| /// Adds a new event to a workflow instance or updates an existing event if it already exists. | ||
| /// Logs the operation specifying whether it was an addition or update. | ||
| /// </summary> | ||
| /// <param name="instance">The workflow instance in which the event should be added or updated.</param> | ||
| /// <param name="newEvent">The new event to add or the existing event to update.</param> | ||
| /// <param name="user">The user initiating the add or update operation.</param> | ||
| /// <param name="ct">The cancellation token used to observe the operation's cancellation.</param> | ||
| /// <returns>An asynchronous operation representing the add or update process.</returns> | ||
| Task AddOrUpdateEvent(WorkflowInstance instance, InstanceEvent newEvent, User user, | ||
| CancellationToken ct); | ||
|
|
||
| /// <summary> | ||
| /// Deletes a specified event from a workflow instance and logs the deletion. | ||
| /// </summary> | ||
| /// <param name="instance">The workflow instance from which the event is to be deleted.</param> | ||
| /// <param name="eventToDelete">The event to remove from the instance.</param> | ||
| /// <param name="user">The user executing the deletion action.</param> | ||
| /// <param name="ct">The cancellation token used to observe the operation's cancellation.</param> | ||
| /// <returns>An asynchronous operation representing the deletion process.</returns> | ||
| Task DeleteEvent(WorkflowInstance instance, InstanceEvent eventToDelete, User user, | ||
| CancellationToken ct); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| namespace UvA.Workflow.Events; | ||
|
|
||
| public class InstanceEvent | ||
| { | ||
| public string Id { get; set; } = null!; | ||
| public DateTime? Date { get; set; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| using MongoDB.Bson.Serialization.Attributes; | ||
|
|
||
| namespace UvA.Workflow.Events; | ||
|
|
||
| [JsonConverter(typeof(JsonStringEnumConverter))] | ||
| public enum EventLogOperation | ||
| { | ||
| Create, | ||
| Update, | ||
| Delete | ||
| } | ||
|
|
||
| public class InstanceEventLogEntry | ||
| { | ||
| [BsonId] | ||
| [BsonRepresentation(BsonType.ObjectId)] | ||
| public string Id { get; set; } = null!; | ||
|
|
||
| [BsonElement("Timestamp")] public DateTime Timestamp { get; set; } = DateTime.UtcNow; | ||
|
|
||
| [BsonElement("InstanceId")] | ||
| [BsonRepresentation(BsonType.ObjectId)] | ||
| public string WorkflowInstanceId { get; set; } = null!; | ||
goomens marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| [BsonElement("EventId")] public string EventId { get; set; } = null!; | ||
|
|
||
| [BsonElement("ExecutedBy")] | ||
| [BsonRepresentation(BsonType.ObjectId)] | ||
| public string ExecutedBy { get; set; } = null!; | ||
|
|
||
| [BsonElement("EventDate")] | ||
| [BsonDateTimeOptions(Kind = DateTimeKind.Utc)] | ||
| public DateTime? EventDate { get; set; } | ||
|
|
||
| [BsonRepresentation(BsonType.String)] | ||
| [BsonElement("Operation")] | ||
| public EventLogOperation Operation { get; set; } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.