🎉 init: 小龙的工作空间
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "@shared/config",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Shared configuration for fullstack project
|
||||
|
||||
/** API base URL — reads from env or defaults */
|
||||
export const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001";
|
||||
|
||||
/** API prefix for all endpoints */
|
||||
export const API_PREFIX = "/api";
|
||||
|
||||
/** Full API URL */
|
||||
export const API_URL = `${API_BASE_URL}${API_PREFIX}`;
|
||||
|
||||
/** Auth token storage key */
|
||||
export const AUTH_TOKEN_KEY = "auth_token";
|
||||
|
||||
/** Default page size for paginated endpoints */
|
||||
export const DEFAULT_PAGE_SIZE = 20;
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"declaration": true,
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "@shared/types",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts"
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
// Shared types for fullstack project
|
||||
// Auto-generated — used by both apps/web and apps/api
|
||||
|
||||
// ─── Entities ────────────────────────────────────────
|
||||
export interface User {
|
||||
id?: string;
|
||||
username: string;
|
||||
passwordHash: string;
|
||||
nickname?: string;
|
||||
role?: string;
|
||||
phone?: string;
|
||||
avatarUrl?: string;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface Contract {
|
||||
id?: string;
|
||||
userId: string;
|
||||
title: string;
|
||||
partyA?: string;
|
||||
partyB?: string;
|
||||
amount?: number;
|
||||
signedAt?: string;
|
||||
expiresAt?: string;
|
||||
status?: string;
|
||||
fileUrl?: string;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface Approval {
|
||||
id?: string;
|
||||
userId: string;
|
||||
entityType: string;
|
||||
entityId?: string;
|
||||
applicantId: string;
|
||||
status?: string;
|
||||
formData?: Record<string, unknown>;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface Customer {
|
||||
id?: string;
|
||||
userId: string;
|
||||
name: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
company?: string;
|
||||
source?: string;
|
||||
tags?: Record<string, unknown>;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface Reminder {
|
||||
id?: string;
|
||||
userId: string;
|
||||
entityType: string;
|
||||
entityId?: string;
|
||||
remindAt: string;
|
||||
message?: string;
|
||||
sent?: boolean;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface Items {
|
||||
id: string;
|
||||
userId?: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
status?: string;
|
||||
data?: Record<string, unknown>;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface Clients {
|
||||
id: string;
|
||||
userId?: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
status?: string;
|
||||
data?: Record<string, unknown>;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface Templates {
|
||||
id: string;
|
||||
userId?: string;
|
||||
title: string;
|
||||
partyA?: string;
|
||||
partyB?: string;
|
||||
amount?: number;
|
||||
signedAt?: string;
|
||||
expiresAt?: string;
|
||||
status?: string;
|
||||
fileUrl?: string;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
// ─── API Response Wrappers ───────────────────────────
|
||||
export interface ApiResponse<T> {
|
||||
data: T;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface PaginatedResponse<T> {
|
||||
data: T[];
|
||||
total: number;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
}
|
||||
|
||||
export interface ErrorResponse {
|
||||
error: string;
|
||||
message: string;
|
||||
statusCode: number;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"declaration": true,
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user