Skip to content

Commit 14a719a

Browse files
committed
chore: add thread creation date to CH docs for sorting
1 parent 25416de commit 14a719a

4 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/collections/CommunityHelp/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ export const CommunityHelp: CollectionConfig = {
122122
index: true,
123123
relationTo: 'docs',
124124
},
125+
{
126+
name: 'threadCreatedAt',
127+
type: 'date',
128+
admin: {
129+
position: 'sidebar',
130+
},
131+
},
125132
],
126133
labels: {
127134
plural: 'Community Helps',

src/payload-types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5114,6 +5114,7 @@ export interface CommunityHelp {
51145114
slug?: string | null;
51155115
helpful?: boolean | null;
51165116
relatedDocs?: (string | Doc)[] | null;
5117+
threadCreatedAt?: string | null;
51175118
updatedAt: string;
51185119
createdAt: string;
51195120
}
@@ -6390,6 +6391,7 @@ export interface CommunityHelpSelect<T extends boolean = true> {
63906391
slug?: T;
63916392
helpful?: T;
63926393
relatedDocs?: T;
6394+
threadCreatedAt?: T;
63936395
updatedAt?: T;
63946396
createdAt?: T;
63956397
}

src/scripts/fetchDiscord.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ async function fetchDiscord() {
252252
communityHelpJSON: thread,
253253
communityHelpType: 'discord',
254254
discordID: thread.info.id,
255+
threadCreatedAt: thread.info.createdAt,
255256
title: thread.info.name,
256257
})
257258

src/scripts/fetchGitHub.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ async function fetchGitHub(): Promise<void> {
240240
communityHelpJSON: discussion,
241241
communityHelpType: 'github',
242242
githubID: discussion.id,
243+
threadCreatedAt: discussion.createdAt,
243244
title: discussion.title,
244245
})
245246

0 commit comments

Comments
 (0)