Skip to content

Commit

Permalink
Merge pull request #20 from protegeproject/142-changes-to-the-web-api
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsilaghi authored Jan 6, 2025
2 parents 4c81aac + d06e753 commit 931e057
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import edu.stanford.protege.webprotege.common.UserId;

import java.time.LocalDateTime;

public record EntityChange(String changeSummary,
UserId userId,
LocalDateTime dateTime) {
@JsonProperty("timestamp") LocalDateTime timestamp) {

public static EntityChange create(String changeSummary,
UserId userId,
LocalDateTime dateTime){
return new EntityChange(changeSummary,userId,dateTime);
LocalDateTime timestamp){
return new EntityChange(changeSummary,userId,timestamp);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ public void GIVEN_validHistoryForEntity_WHEN_getEntityHistorySummaryCalled_THEN_
EntityChange entityUpdate = result.changes().get(0);
assertEquals("Update", entityUpdate.changeSummary());
assertEquals(userId2, entityUpdate.userId());
assertEquals(LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp2), ZoneId.of("UTC")), entityUpdate.dateTime());
assertEquals(LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp2), ZoneId.of("UTC")), entityUpdate.timestamp());

EntityChange entityCreate = result.changes().get(1);
assertEquals("Create", entityCreate.changeSummary());
assertEquals(userId1, entityCreate.userId());
assertEquals(LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp1), ZoneId.of("UTC")), entityCreate.dateTime());
assertEquals(LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp1), ZoneId.of("UTC")), entityCreate.timestamp());

verify(repository).findByProjectIdAndWhoficEntityIriOrderByTimestampDesc(projectId, entityIri);
verify(projectChangeMapper).mapProjectChangeDocumentToProjectChange(eventCreate.projectChange());
Expand Down

0 comments on commit 931e057

Please sign in to comment.