diff --git a/apps/hasura/metadata/databases/masterbots/tables/public_chatbot.yaml b/apps/hasura/metadata/databases/masterbots/tables/public_chatbot.yaml index b442cfeb..aa0a832e 100644 --- a/apps/hasura/metadata/databases/masterbots/tables/public_chatbot.yaml +++ b/apps/hasura/metadata/databases/masterbots/tables/public_chatbot.yaml @@ -29,6 +29,13 @@ array_relationships: table: name: chat schema: public + - name: followers + using: + foreign_key_constraint_on: + column: followee_id_chatbot + table: + name: social_following + schema: public - name: metadataLabels using: foreign_key_constraint_on: diff --git a/apps/hasura/metadata/databases/masterbots/tables/public_social_following.yaml b/apps/hasura/metadata/databases/masterbots/tables/public_social_following.yaml index 062cc3a0..2a2b153c 100644 --- a/apps/hasura/metadata/databases/masterbots/tables/public_social_following.yaml +++ b/apps/hasura/metadata/databases/masterbots/tables/public_social_following.yaml @@ -2,6 +2,9 @@ table: name: social_following schema: public object_relationships: + - name: chatbot + using: + foreign_key_constraint_on: followee_id_chatbot - name: user using: foreign_key_constraint_on: followee_id @@ -9,6 +12,19 @@ object_relationships: using: foreign_key_constraint_on: follower_id insert_permissions: + - role: moderator + permission: + check: + _and: + - followee_id: + _eq: X-Hasura-User-Id + - follower_id: + _eq: X-Hasura-User-Id + columns: + - followee_id + - followee_id_chatbot + - follower_id + comment: "" - role: user permission: check: @@ -19,22 +35,74 @@ insert_permissions: _neq: X-Hasura-User-Id columns: - followee_id + - followee_id_chatbot - follower_id comment: "" select_permissions: + - role: anonymous + permission: + columns: + - created_at + - followee_id + - followee_id_chatbot + - follower_id + filter: {} + comment: "" + - role: moderator + permission: + columns: + - created_at + - followee_id + - followee_id_chatbot + - follower_id + filter: {} + comment: "" - role: user permission: columns: - followee_id + - followee_id_chatbot - follower_id filter: _or: - follower_id: _eq: X-Hasura-User-Id - followee_id: + _neq: X-Hasura-User-Id + comment: "" +update_permissions: + - role: moderator + permission: + columns: + - followee_id + - followee_id_chatbot + - follower_id + filter: + follower_id: + _eq: X-Hasura-User-Id + check: null + comment: "" + - role: user + permission: + columns: + - followee_id + - followee_id_chatbot + - follower_id + filter: + _and: + - follower_id: _eq: X-Hasura-User-Id + - followee_id: + _neq: X-Hasura-User-Id + check: null comment: "" delete_permissions: + - role: moderator + permission: + filter: + follower_id: + _eq: X-Hasura-User-Id + comment: "" - role: user permission: filter: diff --git a/apps/hasura/metadata/databases/masterbots/tables/public_user.yaml b/apps/hasura/metadata/databases/masterbots/tables/public_user.yaml index 354c518a..0ddd14e7 100644 --- a/apps/hasura/metadata/databases/masterbots/tables/public_user.yaml +++ b/apps/hasura/metadata/databases/masterbots/tables/public_user.yaml @@ -1,7 +1,6 @@ table: name: user schema: public - array_relationships: - name: chats using: @@ -31,7 +30,6 @@ array_relationships: table: name: preference schema: public - - name: prompts using: foreign_key_constraint_on: @@ -39,7 +37,6 @@ array_relationships: table: name: prompt_user schema: public - - name: referrals using: foreign_key_constraint_on: @@ -47,7 +44,6 @@ array_relationships: table: name: referral schema: public - - name: referralsByUserId using: foreign_key_constraint_on: @@ -55,7 +51,6 @@ array_relationships: table: name: referral schema: public - - name: threads using: foreign_key_constraint_on: diff --git a/apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/down.sql b/apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/down.sql new file mode 100644 index 00000000..e5d74d0b --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/down.sql @@ -0,0 +1,5 @@ +alter table "public"."social_following" + add constraint "social_following_followee_id_fkey" + foreign key ("followee_id") + references "public"."user" + ("user_id") on update restrict on delete restrict; diff --git a/apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/up.sql b/apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/up.sql new file mode 100644 index 00000000..03bf030c --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734184725302_delete_fk_public_social_following_social_following_followee_id_fkey/up.sql @@ -0,0 +1 @@ +alter table "public"."social_following" drop constraint "social_following_followee_id_fkey"; diff --git a/apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/down.sql b/apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/down.sql new file mode 100644 index 00000000..e5eaabaf --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/down.sql @@ -0,0 +1,4 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- ALTER TABLE social_following +-- DROP CONSTRAINT IF EXISTS social_following_followee_id_fkey; diff --git a/apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/up.sql b/apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/up.sql new file mode 100644 index 00000000..9090b302 --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734184748787_run_sql_migration/up.sql @@ -0,0 +1,2 @@ +ALTER TABLE social_following +DROP CONSTRAINT IF EXISTS social_following_followee_id_fkey; diff --git a/apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/down.sql b/apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/down.sql new file mode 100644 index 00000000..ce5422ce --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/down.sql @@ -0,0 +1 @@ +alter table "public"."social_following" rename column "follower_id_n" to "follower_id"; diff --git a/apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/up.sql b/apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/up.sql new file mode 100644 index 00000000..c3b0a520 --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734196561972_alter_table_public_social_following_alter_column_follower_id/up.sql @@ -0,0 +1 @@ +alter table "public"."social_following" rename column "follower_id" to "follower_id_n"; diff --git a/apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/down.sql b/apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/down.sql new file mode 100644 index 00000000..c3b0a520 --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/down.sql @@ -0,0 +1 @@ +alter table "public"."social_following" rename column "follower_id" to "follower_id_n"; diff --git a/apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/up.sql b/apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/up.sql new file mode 100644 index 00000000..ce5422ce --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734196575364_alter_table_public_social_following_alter_column_follower_id_n/up.sql @@ -0,0 +1 @@ +alter table "public"."social_following" rename column "follower_id_n" to "follower_id"; diff --git a/apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/down.sql b/apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/down.sql new file mode 100644 index 00000000..03bf030c --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/down.sql @@ -0,0 +1 @@ +alter table "public"."social_following" drop constraint "social_following_followee_id_fkey"; diff --git a/apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/up.sql b/apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/up.sql new file mode 100644 index 00000000..e5d74d0b --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734292953319_set_fk_public_social_following_followee_id/up.sql @@ -0,0 +1,5 @@ +alter table "public"."social_following" + add constraint "social_following_followee_id_fkey" + foreign key ("followee_id") + references "public"."user" + ("user_id") on update restrict on delete restrict; diff --git a/apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/down.sql b/apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/down.sql new file mode 100644 index 00000000..9398e11e --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/down.sql @@ -0,0 +1,4 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."social_following" add column "followee_id_chatbot" integer +-- null; diff --git a/apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/up.sql b/apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/up.sql new file mode 100644 index 00000000..9919c59a --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734300490458_alter_table_public_social_following_add_column_followee_id_chatbot/up.sql @@ -0,0 +1,2 @@ +alter table "public"."social_following" add column "followee_id_chatbot" integer + null; diff --git a/apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/down.sql b/apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/down.sql new file mode 100644 index 00000000..f802bd7e --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/down.sql @@ -0,0 +1 @@ +alter table "public"."social_following" drop constraint "social_following_followee_id_chatbot_fkey"; diff --git a/apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/up.sql b/apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/up.sql new file mode 100644 index 00000000..df6d60e2 --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734300526426_set_fk_public_social_following_followee_id_chatbot/up.sql @@ -0,0 +1,5 @@ +alter table "public"."social_following" + add constraint "social_following_followee_id_chatbot_fkey" + foreign key ("followee_id_chatbot") + references "public"."chatbot" + ("chatbot_id") on update restrict on delete restrict; diff --git a/apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/down.sql b/apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/down.sql new file mode 100644 index 00000000..0533b897 --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/down.sql @@ -0,0 +1 @@ +alter table "public"."social_following" alter column "followee_id" set not null; diff --git a/apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/up.sql b/apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/up.sql new file mode 100644 index 00000000..c3ed363a --- /dev/null +++ b/apps/hasura/migrations/masterbots/1734356983533_alter_table_public_social_following_alter_column_followee_id/up.sql @@ -0,0 +1 @@ +alter table "public"."social_following" alter column "followee_id" drop not null; diff --git a/apps/masterbots.ai/components/layout/sidebar/sidebar-category-general.tsx b/apps/masterbots.ai/components/layout/sidebar/sidebar-category-general.tsx index f97d3355..73e86f3d 100644 --- a/apps/masterbots.ai/components/layout/sidebar/sidebar-category-general.tsx +++ b/apps/masterbots.ai/components/layout/sidebar/sidebar-category-general.tsx @@ -5,7 +5,7 @@ import { useSidebar } from '@/lib/hooks/use-sidebar' export function SidebarCategoryGeneral({ page }: { page?: string }) { const { filteredCategories, isFilterMode } = useSidebar() - + if (!filteredCategories.length) return
No matching categories found
return (