Skip to content

Commit e3672fe

Browse files
committed
feat: updating parent thread functionality.
1 parent e17d91c commit e3672fe

File tree

6 files changed

+247
-21
lines changed

6 files changed

+247
-21
lines changed

apps/hasura/metadata/databases/masterbots/tables/public_thread.yaml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,30 @@ insert_permissions:
3434
permission:
3535
check: {}
3636
columns:
37+
- chatbot_id
38+
- created_at
3739
- is_approved
3840
- is_blocked
3941
- is_public
4042
- model
41-
- chatbot_id
42-
- created_at
43-
- updated_at
43+
- parent_thread_id
4444
- thread_id
45+
- updated_at
4546
- user_id
4647
comment: ""
4748
- role: user
4849
permission:
49-
check: {}
50+
check:
51+
thread:
52+
user_id:
53+
_eq: X-Hasura-User-Id
5054
columns:
5155
- chatbot_id
52-
- thread_id
53-
- user_id
5456
- is_public
5557
- model
58+
- parent_thread_id
59+
- thread_id
60+
- user_id
5661
comment: ""
5762
select_permissions:
5863
- role: anonymous
@@ -71,14 +76,15 @@ select_permissions:
7176
- role: moderator
7277
permission:
7378
columns:
79+
- chatbot_id
80+
- created_at
7481
- is_approved
7582
- is_blocked
7683
- is_public
7784
- model
78-
- chatbot_id
79-
- created_at
80-
- updated_at
85+
- parent_thread_id
8186
- thread_id
87+
- updated_at
8288
- user_id
8389
filter: {}
8490
allow_aggregations: true
@@ -91,10 +97,14 @@ select_permissions:
9197
- is_approved
9298
- is_public
9399
- model
100+
- parent_thread_id
94101
- thread_id
95102
- updated_at
96103
- user_id
97-
filter: {}
104+
filter:
105+
thread:
106+
user_id:
107+
_eq: X-Hasura-User-Id
98108
comment: ""
99109
update_permissions:
100110
- role: moderator
@@ -112,7 +122,10 @@ update_permissions:
112122
- chatbot_id
113123
- is_public
114124
- model
115-
filter: {}
125+
filter:
126+
thread:
127+
user_id:
128+
_eq: X-Hasura-User-Id
116129
check: {}
117130
comment: ""
118131
delete_permissions:
@@ -122,5 +135,8 @@ delete_permissions:
122135
comment: ""
123136
- role: user
124137
permission:
125-
filter: {}
138+
filter:
139+
thread:
140+
user_id:
141+
_eq: X-Hasura-User-Id
126142
comment: ""
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
alter table "public"."thread" drop constraint "thread_parent_thread_id_fkey",
2+
add constraint "thread_parent_thread_id_fkey"
3+
foreign key ("parent_thread_id")
4+
references "public"."thread"
5+
("thread_id") on update no action on delete no action;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
alter table "public"."thread" drop constraint "thread_parent_thread_id_fkey",
2+
add constraint "thread_parent_thread_id_fkey"
3+
foreign key ("parent_thread_id")
4+
references "public"."thread"
5+
("thread_id") on update restrict on delete restrict;

packages/mb-genql/generated/schema.graphql

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6081,7 +6081,47 @@ type Thread {
60816081

60826082
"""An object relationship"""
60836083
modelsEnum: ModelsEnum!
6084+
parentThreadId: uuid
6085+
6086+
"""An object relationship"""
6087+
thread: Thread
60846088
threadId: uuid!
6089+
6090+
"""An array relationship"""
6091+
threads(
6092+
"""distinct select on columns"""
6093+
distinctOn: [ThreadSelectColumn!]
6094+
6095+
"""limit the number of rows returned"""
6096+
limit: Int
6097+
6098+
"""skip the first n rows. Use only with order_by"""
6099+
offset: Int
6100+
6101+
"""sort the rows by one or more columns"""
6102+
orderBy: [ThreadOrderBy!]
6103+
6104+
"""filter the rows returned"""
6105+
where: ThreadBoolExp
6106+
): [Thread!]!
6107+
6108+
"""An aggregate relationship"""
6109+
threadsAggregate(
6110+
"""distinct select on columns"""
6111+
distinctOn: [ThreadSelectColumn!]
6112+
6113+
"""limit the number of rows returned"""
6114+
limit: Int
6115+
6116+
"""skip the first n rows. Use only with order_by"""
6117+
offset: Int
6118+
6119+
"""sort the rows by one or more columns"""
6120+
orderBy: [ThreadOrderBy!]
6121+
6122+
"""filter the rows returned"""
6123+
where: ThreadBoolExp
6124+
): ThreadAggregate!
60856125
updatedAt: timestamptz!
60866126

60876127
"""An object relationship"""
@@ -6176,7 +6216,11 @@ input ThreadBoolExp {
61766216
messagesAggregate: MessageAggregateBoolExp
61776217
model: ModelsEnumEnumComparisonExp
61786218
modelsEnum: ModelsEnumBoolExp
6219+
parentThreadId: UuidComparisonExp
6220+
thread: ThreadBoolExp
61796221
threadId: UuidComparisonExp
6222+
threads: ThreadBoolExp
6223+
threadsAggregate: ThreadAggregateBoolExp
61806224
updatedAt: TimestamptzComparisonExp
61816225
user: UserBoolExp
61826226
userId: UuidComparisonExp
@@ -6217,7 +6261,10 @@ input ThreadInsertInput {
62176261
messages: MessageArrRelInsertInput
62186262
model: ModelsEnumEnum
62196263
modelsEnum: ModelsEnumObjRelInsertInput
6264+
parentThreadId: uuid
6265+
thread: ThreadObjRelInsertInput
62206266
threadId: uuid
6267+
threads: ThreadArrRelInsertInput
62216268
updatedAt: timestamptz
62226269
user: UserObjRelInsertInput
62236270
userId: uuid
@@ -6227,6 +6274,7 @@ input ThreadInsertInput {
62276274
type ThreadMaxFields {
62286275
chatbotId: Int
62296276
createdAt: timestamptz
6277+
parentThreadId: uuid
62306278
threadId: uuid
62316279
updatedAt: timestamptz
62326280
userId: uuid
@@ -6238,6 +6286,7 @@ order by max() on columns of table "thread"
62386286
input ThreadMaxOrderBy {
62396287
chatbotId: OrderBy
62406288
createdAt: OrderBy
6289+
parentThreadId: OrderBy
62416290
threadId: OrderBy
62426291
updatedAt: OrderBy
62436292
userId: OrderBy
@@ -6247,6 +6296,7 @@ input ThreadMaxOrderBy {
62476296
type ThreadMinFields {
62486297
chatbotId: Int
62496298
createdAt: timestamptz
6299+
parentThreadId: uuid
62506300
threadId: uuid
62516301
updatedAt: timestamptz
62526302
userId: uuid
@@ -6258,6 +6308,7 @@ order by min() on columns of table "thread"
62586308
input ThreadMinOrderBy {
62596309
chatbotId: OrderBy
62606310
createdAt: OrderBy
6311+
parentThreadId: OrderBy
62616312
threadId: OrderBy
62626313
updatedAt: OrderBy
62636314
userId: OrderBy
@@ -6304,7 +6355,10 @@ input ThreadOrderBy {
63046355
messagesAggregate: MessageAggregateOrderBy
63056356
model: OrderBy
63066357
modelsEnum: ModelsEnumOrderBy
6358+
parentThreadId: OrderBy
6359+
thread: ThreadOrderBy
63076360
threadId: OrderBy
6361+
threadsAggregate: ThreadAggregateOrderBy
63086362
updatedAt: OrderBy
63096363
user: UserOrderBy
63106364
userId: OrderBy
@@ -6337,6 +6391,9 @@ enum ThreadSelectColumn {
63376391
"""column name"""
63386392
model
63396393

6394+
"""column name"""
6395+
parentThreadId
6396+
63406397
"""column name"""
63416398
threadId
63426399

@@ -6385,6 +6442,7 @@ input ThreadSetInput {
63856442
isBlocked: Boolean
63866443
isPublic: Boolean
63876444
model: ModelsEnumEnum
6445+
parentThreadId: uuid
63886446
threadId: uuid
63896447
updatedAt: timestamptz
63906448
userId: uuid
@@ -6445,6 +6503,7 @@ input ThreadStreamCursorValueInput {
64456503
isBlocked: Boolean
64466504
isPublic: Boolean
64476505
model: ModelsEnumEnum
6506+
parentThreadId: uuid
64486507
threadId: uuid
64496508
updatedAt: timestamptz
64506509
userId: uuid
@@ -6484,6 +6543,9 @@ enum ThreadUpdateColumn {
64846543
"""column name"""
64856544
model
64866545

6546+
"""column name"""
6547+
parentThreadId
6548+
64876549
"""column name"""
64886550
threadId
64896551

0 commit comments

Comments
 (0)