mirror of
https://github.com/AppFlowy-IO/AppFlowy-Cloud.git
synced 2025-04-19 03:24:42 -04:00
fix: sorting order of template category and creator
This commit is contained in:
parent
59e5a13ee4
commit
3481dab2bf
3 changed files with 6 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT\n tc.creator_id AS \"id!\",\n name AS \"name!\",\n avatar_url AS \"avatar_url!\",\n ARRAY_AGG((al.link_type, al.url)) FILTER (WHERE link_type IS NOT NULL) AS \"account_links: Vec<AccountLinkColumn>\"\n FROM af_template_creator tc\n LEFT OUTER JOIN af_template_creator_account_link al\n ON tc.creator_id = al.creator_id\n WHERE name LIKE $1\n GROUP BY (tc.creator_id, name, avatar_url)\n ",
|
||||
"query": "\n SELECT\n tc.creator_id AS \"id!\",\n name AS \"name!\",\n avatar_url AS \"avatar_url!\",\n ARRAY_AGG((al.link_type, al.url)) FILTER (WHERE link_type IS NOT NULL) AS \"account_links: Vec<AccountLinkColumn>\"\n FROM af_template_creator tc\n LEFT OUTER JOIN af_template_creator_account_link al\n ON tc.creator_id = al.creator_id\n WHERE name LIKE $1\n GROUP BY (tc.creator_id, name, avatar_url)\n ORDER BY created_at ASC\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
|
@ -36,5 +36,5 @@
|
|||
null
|
||||
]
|
||||
},
|
||||
"hash": "e6be710a038f8fbcc979c9bd52eb42c65941003857e7004ca809d658d3005a4f"
|
||||
"hash": "5c76d9b602d0e47bc28a499c834182d77a6b993d9d526d57ae713aef2c291731"
|
||||
}
|
|
@ -118,7 +118,7 @@ pub async fn select_template_categories<'a, E: Executor<'a, Database = Postgres>
|
|||
query_builder.push_bind(name_contains);
|
||||
query_builder.push(" , '%')");
|
||||
};
|
||||
query_builder.push(" ORDER BY priority DESC");
|
||||
query_builder.push(" ORDER BY priority DESC, created_at ASC");
|
||||
let query = query_builder.build_query_as::<AFTemplateCategoryRow>();
|
||||
|
||||
let category_rows: Vec<AFTemplateCategoryRow> = query.fetch_all(executor).await?;
|
||||
|
@ -313,6 +313,7 @@ pub async fn select_template_creators_by_name<'a, E: Executor<'a, Database = Pos
|
|||
ON tc.creator_id = al.creator_id
|
||||
WHERE name LIKE $1
|
||||
GROUP BY (tc.creator_id, name, avatar_url)
|
||||
ORDER BY created_at ASC
|
||||
"#,
|
||||
substr_match
|
||||
)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
CREATE TABLE IF NOT EXISTS af_template_creator (
|
||||
creator_id UUID NOT NULL DEFAULT gen_random_uuid(),
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
name TEXT NOT NULL,
|
||||
avatar_url TEXT NOT NULL,
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue