diff --git a/src/main/java/com/covas/Resources/MailRessource.java b/src/main/java/com/covas/Resources/MailRessource.java index d97a839..5cdc2ad 100644 --- a/src/main/java/com/covas/Resources/MailRessource.java +++ b/src/main/java/com/covas/Resources/MailRessource.java @@ -1,13 +1,16 @@ package com.covas.Resources; +import java.util.UUID; import java.util.concurrent.CompletionStage; import java.util.concurrent.Flow; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; +import com.covas.Entity.UsersEntity; import io.quarkus.mailer.MailTemplate; import io.quarkus.qute.CheckedTemplate; @@ -17,15 +20,26 @@ import io.smallrye.mutiny.Uni; public class MailRessource { @Inject - private MailTemplate hello; + private MailTemplate mailer; @GET - public Response sendMail(){ + public Response sendMail(UsersEntity users){ + if(UsersEntity.findByPseudo(users.pseudo) == null){ + return Response.status(Response.Status.NOT_FOUND).build(); + } + mailer.to("valcze808@gmail.com").subject("test").data("name", "Robert").send().subscribeAsCompletionStage(); + return Response.ok().build(); + } - hello.to("valcze808@gmail.com").subject("test").data("name", "Robert").send().subscribeAsCompletionStage(); + @GET + @Path("{id}") + public Response activateUsers(@PathParam("id") String id){ + if(UsersEntity.findById(UUID.fromString(id)) == null){ + return Response.status(Response.Status.NOT_FOUND).build(); + } return Response.ok().build(); } diff --git a/src/main/resources/templates/hello.txt b/src/main/resources/templates/mailer.txt similarity index 100% rename from src/main/resources/templates/hello.txt rename to src/main/resources/templates/mailer.txt