🎉 init: 小龙的工作空间

This commit is contained in:
大海
2026-06-06 10:40:48 +08:00
commit a188ee1426
3201 changed files with 231817 additions and 0 deletions
@@ -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,105 @@
// 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 Items {
id: string;
userId?: string;
title: string;
description?: string;
status?: string;
data?: Record<string, unknown>;
createdAt?: string;
updatedAt?: string;
}
export interface StockIn {
id: string;
userId?: string;
productName: string;
quantity: number;
supplier?: string;
receivedBy?: string;
receivedAt?: string;
createdAt?: string;
updatedAt?: string;
}
export interface StockOut {
id: string;
userId?: string;
productName: string;
quantity: number;
recipient?: string;
approvedBy?: string;
shippedAt?: string;
createdAt?: string;
updatedAt?: string;
}
export interface Stocktaking {
id: string;
userId?: string;
warehouse?: string;
productName?: string;
expectedQty?: number;
actualQty?: number;
diff?: number;
stocktakenAt?: string;
createdAt?: string;
updatedAt?: string;
}
export interface StockAlerts {
id: string;
userId?: string;
productName: string;
currentQty?: number;
threshold?: number;
alertedAt?: string;
createdAt?: string;
updatedAt?: string;
}
export interface Warehouse {
id: string;
userId?: string;
productName: string;
quantity: number;
supplier?: string;
receivedBy?: string;
receivedAt?: 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"
]
}