Skip to content

Commit b650a92

Browse files
committed
Add posts_count to Technology and TechnologyHistory and order popular tags by postsCount
1 parent aa94bd3 commit b650a92

9 files changed

Lines changed: 344 additions & 327 deletions

File tree

TechStacks.Client/src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ function HomePageContent() {
412412
key={tech.id}
413413
href={`/tech/${tech.slug}`}
414414
className="px-3 py-1.5 rounded-full text-sm font-medium transition-colors bg-gray-100 text-gray-700 hover:bg-gray-200"
415-
title={`${tech.name} (${tech.favCount || 0} favorites)`}
415+
title={`${tech.name} (${tech.postsCount || 0} posts)`}
416416
>
417417
{tech.name}
418418
</Link>

TechStacks.Client/src/app/stacks/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ function TechStacksContent() {
8787
try {
8888
if (query) {
8989
const response = await gateway.queryTechStacks(query);
90-
setStacks(response.results || []);
90+
setStacks(response.results.map(x => x as TechnologyStack));
9191
setTotal(response.total || 0);
9292
} else {
9393
const response = await gateway.getAllTechStacks();
94-
setStacks(response.results || []);
94+
setStacks(response.results);
9595
setTotal(response.total || 0);
9696
}
9797
} catch (err) {

TechStacks.Client/src/lib/api/gateway.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ export const getTechnologyTiers = async () => {
138138

139139
export const getPopularTechnologies = async (take: number = 50) => {
140140
const request = new dtos.QueryTechnology({
141-
orderBy: '-viewCount,-favCount',
142-
fields: 'id,name,slug,logoUrl,favCount,viewCount',
141+
orderBy: '-postsCount,-viewCount,-favCount',
142+
fields: 'id,name,slug,logoUrl,favCount,viewCount,postsCount',
143143
take,
144144
});
145145
return (await client.get(request, { jsconfig: 'edv' })).results;

TechStacks.Client/src/lib/utils/technologyCache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class TechnologyCache {
9595
// Start a new fetch-all request
9696
this.fetchAllPromise = gateway.queryTechnology({
9797
fields: 'id,name,slug'
98-
}).then(res => res.results || []);
98+
}).then(res => (res.results as Technology[]) || []);
9999

100100
try {
101101
technologies = await this.fetchAllPromise;
@@ -108,7 +108,7 @@ class TechnologyCache {
108108
ids: ids.join(','),
109109
fields: 'id,name,slug'
110110
});
111-
technologies = response.results || [];
111+
technologies = response.results as Technology[] || [];
112112
}
113113

114114
const now = Date.now();

0 commit comments

Comments
 (0)