aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource/NotificationResource.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/api/resource/NotificationResource.java')
-rw-r--r--src/org/traccar/api/resource/NotificationResource.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/org/traccar/api/resource/NotificationResource.java b/src/org/traccar/api/resource/NotificationResource.java
index 5bec7fd85..03f7e4ba0 100644
--- a/src/org/traccar/api/resource/NotificationResource.java
+++ b/src/org/traccar/api/resource/NotificationResource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.traccar.api.resource;
import java.sql.SQLException;
import java.util.Collection;
+import javax.mail.MessagingException;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -29,7 +30,9 @@ import javax.ws.rs.core.Response;
import org.traccar.Context;
import org.traccar.api.BaseResource;
+import org.traccar.model.Event;
import org.traccar.model.Notification;
+import org.traccar.notification.NotificationMail;
@Path("users/notifications")
@Produces(MediaType.APPLICATION_JSON)
@@ -46,7 +49,7 @@ public class NotificationResource extends BaseResource {
userId = getUserId();
}
Context.getPermissionsManager().checkUser(getUserId(), userId);
- return Context.getNotificationManager().getUserNotifications(userId);
+ return Context.getNotificationManager().getAllUserNotifications(userId);
}
@POST
@@ -56,4 +59,12 @@ public class NotificationResource extends BaseResource {
Context.getNotificationManager().updateNotification(entity);
return Response.ok(entity).build();
}
+
+ @Path("test")
+ @POST
+ public Response testMail() throws MessagingException {
+ NotificationMail.sendMailSync(getUserId(), new Event("test", 0), null);
+ return Response.noContent().build();
+ }
+
}