FRE-4533: Merge apps/{api,web,mobile} and shared-db into ShieldAI repo
- Copy apps/api (Fastify server with spamshield/voiceprint/darkwatch services) - Copy apps/web (SolidJS web app) - Copy apps/mobile (SolidJS mobile app) - Copy packages/shared-db (Prisma schema/models) - Add apps/* to pnpm-workspace.yaml
This commit is contained in:
50
packages/shared-db/src/client.ts
Normal file
50
packages/shared-db/src/client.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
// Singleton pattern for Prisma Client
|
||||
const globalForPrisma = globalThis as unknown as {
|
||||
prisma: PrismaClient | undefined;
|
||||
};
|
||||
|
||||
export const prisma =
|
||||
globalForPrisma.prisma ??
|
||||
new PrismaClient({
|
||||
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
globalForPrisma.prisma = prisma;
|
||||
}
|
||||
|
||||
// Export types from generated client
|
||||
export type {
|
||||
User,
|
||||
Account,
|
||||
Session,
|
||||
FamilyGroup,
|
||||
FamilyGroupMember,
|
||||
Subscription,
|
||||
WatchlistItem,
|
||||
Exposure,
|
||||
Alert,
|
||||
VoiceEnrollment,
|
||||
VoiceAnalysis,
|
||||
SpamFeedback,
|
||||
SpamRule,
|
||||
AuditLog,
|
||||
KPISnapshot,
|
||||
UserRole,
|
||||
FamilyMemberRole,
|
||||
SubscriptionTier,
|
||||
SubscriptionStatus,
|
||||
WatchlistType,
|
||||
ExposureSource,
|
||||
ExposureSeverity,
|
||||
AlertType,
|
||||
AlertSeverity,
|
||||
AlertChannel,
|
||||
FeedbackType,
|
||||
RuleType,
|
||||
RuleAction,
|
||||
} from '@prisma/client';
|
||||
|
||||
export * as PrismaModels from '@prisma/client';
|
||||
21
packages/shared-db/src/index.ts
Normal file
21
packages/shared-db/src/index.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
// Re-export Prisma client
|
||||
export { prisma } from './client';
|
||||
|
||||
// Export types
|
||||
export type {
|
||||
User,
|
||||
Account,
|
||||
Session,
|
||||
FamilyGroup,
|
||||
FamilyGroupMember,
|
||||
Subscription,
|
||||
WatchlistItem,
|
||||
Exposure,
|
||||
Alert,
|
||||
VoiceEnrollment,
|
||||
VoiceAnalysis,
|
||||
SpamFeedback,
|
||||
SpamRule,
|
||||
AuditLog,
|
||||
KPISnapshot,
|
||||
} from './client';
|
||||
Reference in New Issue
Block a user