improved README.md for first steps
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
package net.hostsharing.hsadminng;
|
||||
|
||||
import org.hibernate.type.PostgresUUIDType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@ -9,7 +8,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
public class TestController {
|
||||
@ -17,12 +15,10 @@ public class TestController {
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
@RequestMapping(value = "/api/test", method = RequestMethod.GET)
|
||||
public List<Object> test() {
|
||||
final var query = em.createNativeQuery("select * from public.rbacuser")
|
||||
.unwrap(org.hibernate.query.NativeQuery.class)
|
||||
.addScalar("uuidColumn", PostgresUUIDType.INSTANCE);
|
||||
return query.getResultList();
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/api/ping", method = RequestMethod.GET)
|
||||
public String ping() {
|
||||
return "pong\n";
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@ -32,6 +28,6 @@ public class TestController {
|
||||
em.createNativeQuery("SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';").executeUpdate();
|
||||
em.createNativeQuery("SET LOCAL hsadminng.assumedRoles = '';").executeUpdate();
|
||||
final var query = em.createNativeQuery("select currentUser()");
|
||||
return query.getSingleResult().toString();
|
||||
return query.getSingleResult() + "\n";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user