25 lines
565 B
Java
25 lines
565 B
Java
package com.drinkool.services;
|
|
|
|
import com.drinkool.Jwt;
|
|
import com.drinkool.Url;
|
|
import com.drinkool.models.UserModel;
|
|
import jakarta.transaction.Transactional;
|
|
import jakarta.ws.rs.*;
|
|
import jakarta.ws.rs.core.Response;
|
|
import java.util.UUID;
|
|
|
|
@Path("")
|
|
public class UserService {
|
|
|
|
@POST
|
|
@Path(Url.Me)
|
|
@Transactional
|
|
public Response me(@HeaderParam(Jwt.userId) UUID id) {
|
|
if (id == null) return Response.status(Response.Status.BAD_REQUEST)
|
|
.entity("InvalidUserId")
|
|
.build();
|
|
|
|
return Response.ok(UserModel.find("id", id).firstResult()).build();
|
|
}
|
|
}
|