From 6b7570534790eb9373c82cd0871f8991f1dcbd13 Mon Sep 17 00:00:00 2001 From: Jon Sundin Date: Wed, 31 Jan 2024 01:47:53 +0000 Subject: [PATCH] removed posted_by validation, added updateMessageById method --- src/main/java/Service/MessageService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/Service/MessageService.java b/src/main/java/Service/MessageService.java index 84d0e29..76e678a 100644 --- a/src/main/java/Service/MessageService.java +++ b/src/main/java/Service/MessageService.java @@ -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; } @@ -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); }