60 lines
1.4 KiB
Java
60 lines
1.4 KiB
Java
package com.covas.Resources;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.UUID;
|
|
|
|
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.redis.client.RedisClient;
|
|
|
|
@Path("mail")
|
|
public class MailRessource {
|
|
|
|
@Inject
|
|
private MailTemplate mailer;
|
|
|
|
@Inject
|
|
RedisClient redisClient;
|
|
|
|
|
|
@GET
|
|
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();
|
|
}
|
|
|
|
@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();
|
|
}
|
|
|
|
@GET
|
|
@Path("set-redis")
|
|
public Response setRedis(){
|
|
redisClient.set(Arrays.asList("toto","sss"));
|
|
return Response.ok().build();
|
|
}
|
|
|
|
@GET
|
|
@Path("get-redis/{id}")
|
|
public Response getRedis(@PathParam("id") String id){
|
|
return Response.ok().entity(redisClient.get(id)).build();
|
|
}
|
|
|
|
|
|
}
|