This commit is contained in:
Valentin CZERYBA 2022-06-12 00:11:48 +02:00
parent b2389b5ef8
commit 824d75dfcd
2 changed files with 17 additions and 3 deletions

View File

@ -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();
}