diff --git a/web/src/components/badge-cloud.tsx b/web/src/components/badge-cloud.tsx
index 566071a63..befdb9424 100644
--- a/web/src/components/badge-cloud.tsx
+++ b/web/src/components/badge-cloud.tsx
@@ -8,16 +8,16 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
-interface BadgeItem {
+type BadgeItem = {
key: number;
value: string;
tooltip?: string;
href?: string;
-}
+};
-interface BadgeCloudProps {
+type BadgeCloudProps = {
items: readonly BadgeItem[];
-}
+};
const BadgeElement = ({ item }: { item: BadgeItem }) => {
const badge = {item.value};
diff --git a/web/src/components/filterlist-table/index.tsx b/web/src/components/filterlist-table/index.tsx
index d10b9ee6c..4564c5903 100644
--- a/web/src/components/filterlist-table/index.tsx
+++ b/web/src/components/filterlist-table/index.tsx
@@ -1,5 +1,6 @@
"use client";
+import { useEffect, useState } from "react";
import {
useReactTable,
getCoreRowModel,
@@ -7,7 +8,6 @@ import {
flexRender,
TableMeta,
} from "@tanstack/react-table";
-import { columns } from "./columns";
import {
Table,
TableBody,
@@ -16,7 +16,7 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
-import { useEffect, useState } from "react";
+import { columns } from "./columns";
import { FilterListTablePagination } from "./pagination";
import { FilterListTablePaginationSkeleton } from "./pagination-skeleton";
import { FilterList, getFilterLists } from "@/services/get-filterlists";
@@ -32,7 +32,7 @@ export interface FilterListsTableMeta extends TableMeta {
licenses: readonly License[];
}
-interface FilterListTableProps {
+type FilterListTableProps = {
columns: typeof columns;
initialFilterLists: FilterList[];
languages: readonly Language[];
@@ -41,7 +41,7 @@ interface FilterListTableProps {
software: readonly Software[];
syntaxes: readonly Syntax[];
tags: readonly Tag[];
-}
+};
export function FilterListTable({
columns,
diff --git a/web/src/components/filterlist-table/pagination.tsx b/web/src/components/filterlist-table/pagination.tsx
index b480e6a98..c4b7cbab5 100644
--- a/web/src/components/filterlist-table/pagination.tsx
+++ b/web/src/components/filterlist-table/pagination.tsx
@@ -2,9 +2,9 @@ import { Button } from "@/components/ui/button";
import { Table } from "@tanstack/react-table";
import { FilterList } from "@/services/get-filterlists";
-interface FilterListTablePaginationProps {
+type FilterListTablePaginationProps = {
table: Table;
-}
+};
export function FilterListTablePagination({
table,
diff --git a/web/src/services/get-filterlists.ts b/web/src/services/get-filterlists.ts
index 27dbf0f62..a2f924581 100644
--- a/web/src/services/get-filterlists.ts
+++ b/web/src/services/get-filterlists.ts
@@ -8,7 +8,7 @@ export type FilterList = {
syntaxIds: readonly number[];
languageIds: readonly number[];
tagIds: readonly number[];
- primaryViewUrl: string | null;
+ // primaryViewUrl: string | null; // TODO: rm from the API?
maintainerIds: readonly number[];
};
@@ -21,5 +21,15 @@ export async function getFilterLists(): Promise {
throw new Error(`Failed to fetch filter lists: ${response.statusText}`);
}
- return await response.json();
+ const data = await response.json();
+ return data.map((item: Record) => ({
+ 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[],
+ }));
}
diff --git a/web/src/services/get-languages.ts b/web/src/services/get-languages.ts
index b3d570027..193b88652 100644
--- a/web/src/services/get-languages.ts
+++ b/web/src/services/get-languages.ts
@@ -4,7 +4,7 @@ export type Language = {
id: number;
iso6391: string;
name: string;
- filterListIds: readonly number[]; // TODO: are these needed, or can we remove them from the API?
+ // filterListIds: readonly number[]; // TODO: rm from the API?
};
export async function getLanguages(): Promise {
@@ -16,5 +16,10 @@ export async function getLanguages(): Promise {
throw new Error(`Failed to fetch languages: ${response.statusText}`);
}
- return await response.json();
+ const data = await response.json();
+ return data.map((item: Record) => ({
+ id: item.id as number,
+ iso6391: item.iso6391 as string,
+ name: item.name as string,
+ }));
}
diff --git a/web/src/services/get-licenses.ts b/web/src/services/get-licenses.ts
index bb91df2e4..541bc6b5e 100644
--- a/web/src/services/get-licenses.ts
+++ b/web/src/services/get-licenses.ts
@@ -4,10 +4,10 @@ export type License = {
id: number;
name: string;
url: string | null;
- permitsModification: boolean;
- permitsDistribution: boolean;
- permitsCommercialUse: boolean;
- filterListIds: readonly number[] | null; // TODO: are these needed, or can we remove them from the API?
+ // permitsModification: boolean;
+ // permitsDistribution: boolean;
+ // permitsCommercialUse: boolean;
+ // filterListIds: readonly number[]; // TODO: rm from the API?
};
export async function getLicenses(): Promise {
@@ -19,5 +19,10 @@ export async function getLicenses(): Promise {
throw new Error(`Failed to fetch licenses: ${response.statusText}`);
}
- return await response.json();
+ const data = await response.json();
+ return data.map((item: Record) => ({
+ id: item.id as number,
+ name: item.name as string,
+ url: item.url as string | null,
+ }));
}
diff --git a/web/src/services/get-maintainers.ts b/web/src/services/get-maintainers.ts
index 3a6fe3bbf..0e032a4a0 100644
--- a/web/src/services/get-maintainers.ts
+++ b/web/src/services/get-maintainers.ts
@@ -2,11 +2,11 @@ import { API_BASE_URL, DEFAULT_REVALIDATE_SECS } from "./constants";
export type Maintainer = {
id: number;
- name: string | null;
+ name: string;
url: string | null;
- emailAddress: string | null;
- twitterHandle: string | null;
- filterListIds: readonly number[] | null;
+ // emailAddress: string | null;
+ // twitterHandle: string | null;
+ // filterListIds: readonly number[]; // TODO: rm from the API?
};
export async function getMaintainers(): Promise {
@@ -18,5 +18,10 @@ export async function getMaintainers(): Promise {
throw new Error(`Failed to fetch maintainers: ${response.statusText}`);
}
- return await response.json();
+ const data = await response.json();
+ return data.map((item: Record) => ({
+ id: item.id as number,
+ name: item.name as string,
+ url: item.url as string | null,
+ }));
}
diff --git a/web/src/services/get-software.ts b/web/src/services/get-software.ts
index 9cdb775c1..6de8c2e30 100644
--- a/web/src/services/get-software.ts
+++ b/web/src/services/get-software.ts
@@ -2,12 +2,12 @@ import { API_BASE_URL, DEFAULT_REVALIDATE_SECS } from "./constants";
export type Software = {
id: number;
- name: string | null;
+ name: string;
description: string | null;
homeUrl: string | null;
- downloadUrl: string | null;
- supportsAbpUrlScheme: boolean;
- syntaxIds: readonly number[] | null;
+ // downloadUrl: string | null;
+ // supportsAbpUrlScheme: boolean;
+ // syntaxIds: readonly number[]; // TODO: rm from the API?
};
export async function getSoftware(): Promise {
@@ -19,5 +19,11 @@ export async function getSoftware(): Promise {
throw new Error(`Failed to fetch software: ${response.statusText}`);
}
- return await response.json();
+ const data = await response.json();
+ return data.map((item: Record) => ({
+ id: item.id as number,
+ name: item.name as string,
+ description: item.description as string | null,
+ homeUrl: item.homeUrl as string | null,
+ }));
}
diff --git a/web/src/services/get-syntaxes.ts b/web/src/services/get-syntaxes.ts
index 8daaa558b..6497003cb 100644
--- a/web/src/services/get-syntaxes.ts
+++ b/web/src/services/get-syntaxes.ts
@@ -2,11 +2,11 @@ import { API_BASE_URL, DEFAULT_REVALIDATE_SECS } from "./constants";
export type Syntax = {
id: number;
- name: string | null;
+ name: string;
description: string | null;
url: string | null;
- filterListIds: readonly number[] | null;
- softwareIds: readonly number[] | null;
+ // filterListIds: readonly number[]; // TODO: rm from the API?
+ // softwareIds: readonly number[]; // TODO: rm from the API?
};
export async function getSyntaxes(): Promise {
@@ -18,5 +18,11 @@ export async function getSyntaxes(): Promise {
throw new Error(`Failed to fetch syntaxes: ${response.statusText}`);
}
- return await response.json();
+ const data = await response.json();
+ return data.map((item: Record) => ({
+ id: item.id as number,
+ name: item.name as string,
+ description: item.description as string | null,
+ url: item.url as string | null,
+ }));
}
diff --git a/web/src/services/get-tags.ts b/web/src/services/get-tags.ts
index e8a17348f..562ec4a31 100644
--- a/web/src/services/get-tags.ts
+++ b/web/src/services/get-tags.ts
@@ -2,9 +2,9 @@ import { API_BASE_URL, DEFAULT_REVALIDATE_SECS } from "./constants";
export type Tag = {
id: number;
- name: string | null;
+ name: string;
description: string | null;
- filterListIds: readonly number[] | null;
+ // filterListIds: readonly number[]; // TODO: rm from the API?
};
export async function getTags(): Promise {
@@ -16,5 +16,10 @@ export async function getTags(): Promise {
throw new Error(`Failed to fetch tags: ${response.statusText}`);
}
- return await response.json();
+ const data = await response.json();
+ return data.map((item: Record) => ({
+ id: item.id as number,
+ name: item.name as string,
+ description: item.description as string | null,
+ }));
}