diff --git a/libs/model/src/thread/GetThreads.query.ts b/libs/model/src/thread/GetThreads.query.ts index c215b7b1fcc..2af1f64b49d 100644 --- a/libs/model/src/thread/GetThreads.query.ts +++ b/libs/model/src/thread/GetThreads.query.ts @@ -110,7 +110,7 @@ export function GetThreads(): Query { 'id', T.id, 'name', T.name, 'description', T.description, - 'communityId', T.community_id, + 'community_id', T.community_id, 'telegram', T.telegram ) as topic, json_build_object( @@ -156,9 +156,10 @@ export function GetThreads(): Query { TT.id as thread_id, json_agg(json_strip_nulls(json_build_object( 'id', R.id, + 'address_id', R.address_id, 'reaction', R.reaction, 'updated_at', R.updated_at::text, - 'calculated_voting_weight', R.calculated_voting_weight, + 'calculated_voting_weight', R.calculated_voting_weight::text, 'profile_name', U.profile->>'name', 'avatar_url', U.profile->>'avatar_url', 'address', A.address, @@ -184,7 +185,12 @@ export function GetThreads(): Query { 'thread_id', TT.id, 'content_id', CA.content_id, 'start_time', CON.start_time, - 'end_time', CON.end_time + 'end_time', CON.end_time, + 'ContestManager', json_build_object( + 'name', CM.name, + 'cancelled', CM.cancelled, + 'interval', CM.interval + ) ))) as "associatedContests" FROM "Contests" CON JOIN "ContestManagers" CM ON CM.contest_address = CON.contest_address diff --git a/libs/schemas/src/queries/thread.schemas.ts b/libs/schemas/src/queries/thread.schemas.ts index aa09d37296f..16ffb460ca9 100644 --- a/libs/schemas/src/queries/thread.schemas.ts +++ b/libs/schemas/src/queries/thread.schemas.ts @@ -145,12 +145,13 @@ export const ThreadView = Thread.extend({ Reaction: ReactionView.nullish(), collaborators: AddressView.array().nullish(), reactions: ReactionView.array().nullish(), - associatedContests: z.array(ContestView).optional(), + associatedContests: z.array(ContestView).nullish(), topic: TopicView.optional(), topic_id: PG_INT.optional(), ContestActions: z.array(ContestActionView).optional(), Comments: z.array(CommentView).optional(), ThreadVersionHistories: z.array(ThreadVersionHistoryView).nullish(), + search: z.union([z.string(), z.record(z.any())]).nullish(), }); export const OrderByQueriesKeys = z.enum([