Skip to content

Commit

Permalink
fix: Fix Kudos Sending outside of activities - MEED-2476 - Meeds-io/m…
Browse files Browse the repository at this point in the history
…eeds#1090 (#346)

Prior to this change, when sending a kudos outside of an activity, the Parent Entity Identifier is null while it was set as mandatory in Hibernate Entity Mapping. This change will ensure to use the exact same constraint as the ones made in database for this field, which is nullable.
  • Loading branch information
boubaker committed Sep 9, 2023
1 parent 04bad37 commit 5261c14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class KudosEntity implements Serializable {
@Column(name = "IS_RECEIVER_USER", nullable = false)
public boolean isReceiverUser;

@Column(name = "PARENT_ENTITY_ID", nullable = false)
@Column(name = "PARENT_ENTITY_ID", nullable = true)
public Long parentEntityId;

@Column(name = "ENTITY_ID", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ public static KudosEntity toEntity(Kudos kudos) {
kudosEntity.setActivityId(kudos.getActivityId());
if (StringUtils.isNoneBlank(kudos.getParentEntityId())) {
kudosEntity.setParentEntityId(Long.parseLong(kudos.getParentEntityId()));
} else {
kudosEntity.setParentEntityId(0l);
}
kudosEntity.setEntityType(KudosEntityType.valueOf(kudos.getEntityType()).ordinal());
kudosEntity.setSenderId(Long.parseLong(kudos.getSenderIdentityId()));
Expand Down

0 comments on commit 5261c14

Please sign in to comment.