From 1a2241c40e10193c5ff7008a7b7b36cc1d855d96 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Tue, 25 Mar 2025 15:55:45 +0900 Subject: initial commit --- types/react-file-pond.d.ts | 7 +++++ types/table.d.ts | 78 ++++++++++++++++++++++++++++++++++++++++++++++ types/user.d.ts | 28 +++++++++++++++++ types/vendorData.d.ts | 9 ++++++ 4 files changed, 122 insertions(+) create mode 100644 types/react-file-pond.d.ts create mode 100644 types/table.d.ts create mode 100644 types/user.d.ts create mode 100644 types/vendorData.d.ts (limited to 'types') diff --git a/types/react-file-pond.d.ts b/types/react-file-pond.d.ts new file mode 100644 index 00000000..1f64884b --- /dev/null +++ b/types/react-file-pond.d.ts @@ -0,0 +1,7 @@ +declare module "react-file-pond" { + import * as React from "react"; + import type { FilePondOptions } from "filepond"; + + export class FilePond extends React.Component {} + export function registerPlugin(...plugins: any[]): void; + } \ No newline at end of file diff --git a/types/table.d.ts b/types/table.d.ts new file mode 100644 index 00000000..207a0c19 --- /dev/null +++ b/types/table.d.ts @@ -0,0 +1,78 @@ +import type { ColumnSort, Row } from "@tanstack/react-table" +import { type SQL } from "drizzle-orm" +import { type z } from "zod" + +import { type DataTableConfig } from "@/config/data-table" +import { type filterSchema } from "@/lib/parsers" + +export type Prettify = { + [K in keyof T]: T[K] +} & {} + +export type StringKeyOf = Extract + +export interface SearchParams { + [key: string]: string | string[] | undefined +} + +export interface Option { + label: string + value: string | number + icon?: React.ComponentType<{ className?: string }> + count?: number +} + +export interface ExtendedColumnSort extends Omit { + id: StringKeyOf +} + +export type ExtendedSortingState = ExtendedColumnSort[] + +export type ColumnType = DataTableConfig["columnTypes"][number] + +export type FilterOperator = DataTableConfig["globalOperators"][number] + +export type JoinOperator = DataTableConfig["joinOperators"][number]["value"] + +export interface DataTableFilterField { + id: StringKeyOf + label: string + placeholder?: string + options?: Option[] +} + +export interface DataTableAdvancedFilterField + extends DataTableFilterField { + type: ColumnType +} + +export type Filter = Prettify< + Omit, "id"> & { + id: StringKeyOf + } +> + +export interface DataTableRowAction { + row: Row + type: "responseDetail"|"signature"|"update" | "delete" | "user" | "pemission" | "invite" | "items" | "attachment" |"comments" | "open" | "select" | "files" +} + +export interface QueryBuilderOpts { + where?: SQL + orderBy?: SQL + distinct?: boolean + nullish?: boolean +} + + +declare module '@tanstack/react-table' { + interface ColumnMeta { + // Custom column meta properties + excelHeader?: string + group?: string + type?: string + paddingFactor?: number + minWidth?: number + maxWidth?: number + } +} diff --git a/types/user.d.ts b/types/user.d.ts new file mode 100644 index 00000000..61be4630 --- /dev/null +++ b/types/user.d.ts @@ -0,0 +1,28 @@ +export interface User { + id: number; + name: string; + email: string; + createdAt: Date; + imageUrl: string; +} + + +export interface Otp { + email: string; + code: string; + otpToken: string; + createdAt: Date; + otpExpires: Date; +} + +export interface UserWithCompanyAndRoles { + userId: number; + userName: string; + userEmail: string; + companyId: number | null; + companyName: string | null; + roles: string[]; + createdAt?: Date; // 조인 SELECT 시 가져왔다면 +} + + diff --git a/types/vendorData.d.ts b/types/vendorData.d.ts new file mode 100644 index 00000000..55a5bf74 --- /dev/null +++ b/types/vendorData.d.ts @@ -0,0 +1,9 @@ +export interface Tag { + id?: number + contractItemId: number + tagNo: string + tagType: string + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string +} \ No newline at end of file -- cgit v1.2.3