mirror of
https://github.com/sismics/docs.git
synced 2024-12-22 11:23:48 +01:00
Order tags by name in all requests
This commit is contained in:
parent
0ab480165c
commit
363d6eef23
@ -45,7 +45,7 @@ public class TagDao {
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Tag> getByUserId(String userId) {
|
||||
EntityManager em = ThreadLocalContext.get().getEntityManager();
|
||||
Query q = em.createQuery("select t from Tag t where t.userId = :userId and t.deleteDate is null order by t.id");
|
||||
Query q = em.createQuery("select t from Tag t where t.userId = :userId and t.deleteDate is null order by t.name");
|
||||
q.setParameter("userId", userId);
|
||||
return q.getResultList();
|
||||
}
|
||||
@ -118,6 +118,7 @@ public class TagDao {
|
||||
sb.append(" left join T_DOCUMENT d on d.DOC_ID_C = dt.DOT_IDDOCUMENT_C and d.DOC_DELETEDATE_D is null and d.DOC_IDUSER_C = :userId ");
|
||||
sb.append(" where t.TAG_DELETEDATE_D is null ");
|
||||
sb.append(" group by t.TAG_ID_C ");
|
||||
sb.append(" order by t.TAG_NAME_C ");
|
||||
|
||||
// Perform the query
|
||||
Query q = em.createNativeQuery(sb.toString());
|
||||
|
@ -110,7 +110,7 @@ public class TestTagResource extends BaseJerseyTest {
|
||||
json = response.getEntity(JSONObject.class);
|
||||
tags = json.getJSONArray("tags");
|
||||
Assert.assertTrue(tags.length() > 0);
|
||||
Assert.assertEquals("Updated name", tags.getJSONObject(0).getString("name"));
|
||||
Assert.assertEquals("Updated name", tags.getJSONObject(1).getString("name"));
|
||||
|
||||
// Deletes a tag
|
||||
tagResource = resource().path("/tag/" + tag4Id);
|
||||
|
Loading…
Reference in New Issue
Block a user