Add historyType and historyId to Appeal, update database schema, API, and email templates to include punishment details.

This commit is contained in:
2025-08-16 23:40:20 +02:00
parent c3f3b20807
commit de1876c90c
8 changed files with 51 additions and 21 deletions
@@ -1,5 +1,6 @@
package com.alttd.altitudeweb.services.mail;
import com.alttd.altitudeweb.database.litebans.HistoryRecord;
import com.alttd.altitudeweb.database.web_db.forms.Appeal;
import jakarta.mail.MessagingException;
import jakarta.mail.internet.MimeMessage;
@@ -30,9 +31,9 @@ public class AppealMail {
*
* @param appeal The appeal object containing all necessary information
*/
public void sendAppealNotification(Appeal appeal) {
public void sendAppealNotification(Appeal appeal, HistoryRecord history) {
try {
sendEmailToAppealsTeam(appeal);
sendEmailToAppealsTeam(appeal, history);
log.info("Appeal notification emails sent successfully for appeal ID: {}", appeal.id());
} catch (Exception e) {
@@ -40,7 +41,7 @@ public class AppealMail {
}
}
private void sendEmailToAppealsTeam(Appeal appeal) throws MessagingException {
private void sendEmailToAppealsTeam(Appeal appeal, HistoryRecord history) throws MessagingException {
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, true);
@@ -51,6 +52,9 @@ public class AppealMail {
Context context = new Context();
context.setVariable("appeal", appeal);
context.setVariable("history", history);
context.setVariable("createdAt", appeal.createdAt().toString());
context.setVariable("active", history.getUntil() <= 0 || history.getUntil() > System.currentTimeMillis());
String content = templateEngine.process("appeal-email", context);
helper.setText(content, true);