Sort roles by created date.

This commit is contained in:
Kailash Nadh 2024-06-30 12:12:30 +05:30
parent d52eac0948
commit 17b5cc1774

View file

@ -1119,7 +1119,7 @@ listPerms AS (
WHERE ur.parent_id IS NOT NULL GROUP BY ur.parent_id
)
SELECT p.*, COALESCE(l.listPerms, '[]'::JSONB) AS "list_permissions" FROM mainroles p
LEFT JOIN listPerms l ON p.id = l.parent_id;
LEFT JOIN listPerms l ON p.id = l.parent_id ORDER BY p.created_at;
-- name: create-role
INSERT INTO user_roles (name, permissions, created_at, updated_at) VALUES($1, $2, NOW(), NOW()) RETURNING *;