Initial scaffold: full-stack RackMapper application
Complete project scaffold with working auth, REST API, Prisma/SQLite schema, Docker config, and React frontend for both Rack Planner and Service Mapper modules. Both server and client pass TypeScript strict mode with zero errors. Initial migration applied. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
44
server/lib/constants.ts
Normal file
44
server/lib/constants.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
// SQLite doesn't support Prisma enums — use string literals throughout the server.
|
||||
// These types mirror client/src/types/index.ts
|
||||
|
||||
export type ModuleType =
|
||||
| 'SWITCH' | 'AGGREGATE_SWITCH' | 'MODEM' | 'ROUTER' | 'NAS'
|
||||
| 'PDU' | 'PATCH_PANEL' | 'SERVER' | 'FIREWALL' | 'AP' | 'BLANK' | 'OTHER';
|
||||
|
||||
export type PortType = 'ETHERNET' | 'SFP' | 'SFP_PLUS' | 'QSFP' | 'CONSOLE' | 'UPLINK';
|
||||
|
||||
export type VlanMode = 'ACCESS' | 'TRUNK' | 'HYBRID';
|
||||
|
||||
export type NodeType =
|
||||
| 'SERVICE' | 'DATABASE' | 'API' | 'DEVICE' | 'EXTERNAL'
|
||||
| 'USER' | 'VLAN' | 'FIREWALL' | 'LOAD_BALANCER' | 'NOTE';
|
||||
|
||||
export const MODULE_PORT_DEFAULTS: Record<ModuleType, number> = {
|
||||
SWITCH: 24,
|
||||
AGGREGATE_SWITCH: 8,
|
||||
ROUTER: 4,
|
||||
FIREWALL: 8,
|
||||
PATCH_PANEL: 24,
|
||||
AP: 1,
|
||||
MODEM: 2,
|
||||
SERVER: 2,
|
||||
NAS: 1,
|
||||
PDU: 12,
|
||||
BLANK: 0,
|
||||
OTHER: 0,
|
||||
};
|
||||
|
||||
export const MODULE_U_DEFAULTS: Record<ModuleType, number> = {
|
||||
SWITCH: 1,
|
||||
AGGREGATE_SWITCH: 2,
|
||||
ROUTER: 1,
|
||||
FIREWALL: 1,
|
||||
PATCH_PANEL: 1,
|
||||
AP: 1,
|
||||
MODEM: 1,
|
||||
SERVER: 2,
|
||||
NAS: 4,
|
||||
PDU: 1,
|
||||
BLANK: 1,
|
||||
OTHER: 1,
|
||||
};
|
||||
14
server/lib/prisma.ts
Normal file
14
server/lib/prisma.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
// Singleton pattern prevents multiple PrismaClient instances in dev (hot reload)
|
||||
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient };
|
||||
|
||||
export const prisma =
|
||||
globalForPrisma.prisma ??
|
||||
new PrismaClient({
|
||||
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
globalForPrisma.prisma = prisma;
|
||||
}
|
||||
Reference in New Issue
Block a user