Skip to content

Commit

Permalink
removed posted_by validation, added updateMessageById method
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsundin committed Jan 31, 2024
1 parent 372dffa commit 6b75705
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/Service/MessageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ public MessageService(MessageDAO messageDAO, AccountDAO accountDAO) {
this.accountDAO = accountDAO;
}

public boolean messageIsValid(int posted_by, String message_text) {
public boolean messageIsValid(String message_text) {
if (message_text.length() == 0 || message_text.length() > 255) return false;
else if (accountDAO.findAccountByAccountId(posted_by) == null) return false;
else return true;
}

Expand All @@ -43,6 +42,10 @@ public Message getMessageById(int message_id) {
return messageDAO.getMessageById(message_id);
}

public Message updateMessageById(int message_id, String updated_message_text) {
return messageDAO.updateMessageById(message_id, updated_message_text);
}

public Message deleteMessageById(int message_id) {
return messageDAO.deleteMessageById(message_id);
}
Expand Down

0 comments on commit 6b75705

Please sign in to comment.