diff options
Diffstat (limited to 'types')
| -rw-r--r-- | types/react-file-pond.d.ts | 7 | ||||
| -rw-r--r-- | types/table.d.ts | 78 | ||||
| -rw-r--r-- | types/user.d.ts | 28 | ||||
| -rw-r--r-- | types/vendorData.d.ts | 9 |
4 files changed, 122 insertions, 0 deletions
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<FilePondOptions> {} + 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<T> = { + [K in keyof T]: T[K] +} & {} + +export type StringKeyOf<TData> = Extract<keyof TData, string> + +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<TData> extends Omit<ColumnSort, "id"> { + id: StringKeyOf<TData> +} + +export type ExtendedSortingState<TData> = ExtendedColumnSort<TData>[] + +export type ColumnType = DataTableConfig["columnTypes"][number] + +export type FilterOperator = DataTableConfig["globalOperators"][number] + +export type JoinOperator = DataTableConfig["joinOperators"][number]["value"] + +export interface DataTableFilterField<TData> { + id: StringKeyOf<TData> + label: string + placeholder?: string + options?: Option[] +} + +export interface DataTableAdvancedFilterField<TData> + extends DataTableFilterField<TData> { + type: ColumnType +} + +export type Filter<TData> = Prettify< + Omit<z.infer<typeof filterSchema>, "id"> & { + id: StringKeyOf<TData> + } +> + +export interface DataTableRowAction<TData> { + row: Row<TData> + 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<TData extends RowData, TValue> { + // 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 |
