refactor(web): slim down unused props

This commit is contained in:
Collin Barrett 2025-06-28 12:40:23 -05:00
parent 74f399ec12
commit 321bcf210b
7 changed files with 16 additions and 65 deletions

View file

@ -8,7 +8,6 @@ export type FilterList = {
syntaxIds: readonly number[];
languageIds: readonly number[];
tagIds: readonly number[];
// primaryViewUrl: string | null; // TODO: rm from the API?
maintainerIds: readonly number[];
};
@ -18,18 +17,8 @@ export async function getFilterLists(): Promise<FilterList[]> {
});
if (!response.ok) {
throw new Error(`Failed to fetch filter lists: ${response.statusText}`);
throw new Error(`Failed to fetch FilterLists: ${response.statusText}`);
}
const data = await response.json();
return data.map((item: Record<string, unknown>) => ({
id: item.id as number,
name: item.name as string,
description: item.description as string | null,
licenseId: item.licenseId as number,
syntaxIds: item.syntaxIds as readonly number[],
languageIds: item.languageIds as readonly number[],
tagIds: item.tagIds as readonly number[],
maintainerIds: item.maintainerIds as readonly number[],
}));
return await response.json();
}

View file

@ -4,7 +4,6 @@ export type Language = {
id: number;
iso6391: string;
name: string;
// filterListIds: readonly number[]; // TODO: rm from the API?
};
export async function getLanguages(): Promise<Language[]> {
@ -16,10 +15,5 @@ export async function getLanguages(): Promise<Language[]> {
throw new Error(`Failed to fetch languages: ${response.statusText}`);
}
const data = await response.json();
return data.map((item: Record<string, unknown>) => ({
id: item.id as number,
iso6391: item.iso6391 as string,
name: item.name as string,
}));
return await response.json();
}

View file

@ -4,10 +4,9 @@ export type License = {
id: number;
name: string;
url: string | null;
// permitsModification: boolean;
// permitsDistribution: boolean;
// permitsCommercialUse: boolean;
// filterListIds: readonly number[]; // TODO: rm from the API?
permitsModification: boolean;
permitsDistribution: boolean;
permitsCommercialUse: boolean;
};
export async function getLicenses(): Promise<License[]> {
@ -19,10 +18,5 @@ export async function getLicenses(): Promise<License[]> {
throw new Error(`Failed to fetch licenses: ${response.statusText}`);
}
const data = await response.json();
return data.map((item: Record<string, unknown>) => ({
id: item.id as number,
name: item.name as string,
url: item.url as string | null,
}));
return await response.json();
}

View file

@ -4,9 +4,8 @@ export type Maintainer = {
id: number;
name: string;
url: string | null;
// emailAddress: string | null;
// twitterHandle: string | null;
// filterListIds: readonly number[]; // TODO: rm from the API?
emailAddress: string | null;
twitterHandle: string | null;
};
export async function getMaintainers(): Promise<Maintainer[]> {
@ -18,10 +17,5 @@ export async function getMaintainers(): Promise<Maintainer[]> {
throw new Error(`Failed to fetch maintainers: ${response.statusText}`);
}
const data = await response.json();
return data.map((item: Record<string, unknown>) => ({
id: item.id as number,
name: item.name as string,
url: item.url as string | null,
}));
return await response.json();
}

View file

@ -5,9 +5,9 @@ export type Software = {
name: string;
description: string | null;
homeUrl: string | null;
// downloadUrl: string | null;
// supportsAbpUrlScheme: boolean;
// syntaxIds: readonly number[]; // TODO: rm from the API?
downloadUrl: string | null;
supportsAbpUrlScheme: boolean;
syntaxIds: readonly number[];
};
export async function getSoftware(): Promise<Software[]> {
@ -19,11 +19,5 @@ export async function getSoftware(): Promise<Software[]> {
throw new Error(`Failed to fetch software: ${response.statusText}`);
}
const data = await response.json();
return data.map((item: Record<string, unknown>) => ({
id: item.id as number,
name: item.name as string,
description: item.description as string | null,
homeUrl: item.homeUrl as string | null,
}));
return await response.json();
}

View file

@ -5,8 +5,6 @@ export type Syntax = {
name: string;
description: string | null;
url: string | null;
// filterListIds: readonly number[]; // TODO: rm from the API?
// softwareIds: readonly number[]; // TODO: rm from the API?
};
export async function getSyntaxes(): Promise<Syntax[]> {
@ -18,11 +16,5 @@ export async function getSyntaxes(): Promise<Syntax[]> {
throw new Error(`Failed to fetch syntaxes: ${response.statusText}`);
}
const data = await response.json();
return data.map((item: Record<string, unknown>) => ({
id: item.id as number,
name: item.name as string,
description: item.description as string | null,
url: item.url as string | null,
}));
return await response.json();
}

View file

@ -4,7 +4,6 @@ export type Tag = {
id: number;
name: string;
description: string | null;
// filterListIds: readonly number[]; // TODO: rm from the API?
};
export async function getTags(): Promise<Tag[]> {
@ -16,10 +15,5 @@ export async function getTags(): Promise<Tag[]> {
throw new Error(`Failed to fetch tags: ${response.statusText}`);
}
const data = await response.json();
return data.map((item: Record<string, unknown>) => ({
id: item.id as number,
name: item.name as string,
description: item.description as string | null,
}));
return await response.json();
}