mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-05-11 06:11:15 +00:00
Init
This commit is contained in:
3
src/types/api.types.ts
Normal file
3
src/types/api.types.ts
Normal 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
14
src/types/auth.types.ts
Normal 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";
|
||||
}
|
||||
}
|
||||
33
src/types/catalog.types.ts
Normal file
33
src/types/catalog.types.ts
Normal 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
6
src/types/index.ts
Normal 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
19
src/types/table.types.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user