This commit is contained in:
xCyanGrizzly
2026-02-18 14:26:36 +01:00
commit 3a5726e82b
167 changed files with 104081 additions and 0 deletions

3
src/types/api.types.ts Normal file
View File

@@ -0,0 +1,3 @@
export type ActionResult<T = void> =
| { success: true; data: T }
| { success: false; error: string; fieldErrors?: Record<string, string[]> };

14
src/types/auth.types.ts Normal file
View File

@@ -0,0 +1,14 @@
import { type DefaultSession } from "next-auth";
declare module "next-auth" {
interface Session {
user: {
id: string;
role: "ADMIN" | "USER";
} & DefaultSession["user"];
}
interface User {
role?: "ADMIN" | "USER";
}
}

View File

@@ -0,0 +1,33 @@
export type CatalogItemType = "filament" | "resin" | "paint";
export interface CatalogItem {
id: string;
name: string;
brand: string;
type: CatalogItemType;
color?: string;
colorHex?: string;
material?: string;
resinType?: string;
line?: string;
finish?: string;
volume?: number;
weight?: number;
price?: number;
currency?: string;
imageUrl?: string;
productCode?: string;
sourceUrl?: string;
}
export interface CatalogBrand {
id: string;
name: string;
type: CatalogItemType;
itemCount: number;
}
export interface CatalogResponse {
items: CatalogItem[];
brands: CatalogBrand[];
}

6
src/types/index.ts Normal file
View File

@@ -0,0 +1,6 @@
export type { ActionResult } from "./api.types";
export type {
DataTableSearchParams,
PaginatedResult,
DataTableFilterOption,
} from "./table.types";

19
src/types/table.types.ts Normal file
View File

@@ -0,0 +1,19 @@
export interface DataTableSearchParams {
page?: string;
perPage?: string;
sort?: string;
order?: "asc" | "desc";
search?: string;
[key: string]: string | string[] | undefined;
}
export interface PaginatedResult<T> {
data: T[];
pageCount: number;
totalCount: number;
}
export interface DataTableFilterOption {
label: string;
value: string;
}