feat(service): NestJS kernel skeleton + 10-table kernel schema (P1.1+1.2)

Reuses support-service bootstrap/health/prisma patterns. Kernel-only Prisma
schema (scope/source_handle/actor/channel/thread/participant/interaction/
message_part/outbox/processed_event) with orgId/appId NOT NULL and
@@unique([scopeId, idempotencyKey]). Health verified: {status:ok,db:true}.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-30 21:16:31 +05:30
parent c73acce0e8
commit 9cfd1ab1ab
12 changed files with 3743 additions and 10 deletions
+9
View File
@@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { PrismaModule } from './prisma/prisma.module';
import { HealthController } from './health.controller';
@Module({
imports: [PrismaModule],
controllers: [HealthController],
})
export class AppModule {}
@@ -0,0 +1,19 @@
import { Controller, Get } from '@nestjs/common';
import { PrismaService } from './prisma/prisma.service';
@Controller('health')
export class HealthController {
constructor(private readonly prisma: PrismaService) {}
@Get()
async check(): Promise<{ status: string; db: boolean }> {
let db = false;
try {
await this.prisma.$queryRaw`SELECT 1`;
db = true;
} catch {
db = false;
}
return { status: 'ok', db };
}
}
+18
View File
@@ -0,0 +1,18 @@
import 'reflect-metadata';
import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import { AppModule } from './app.module';
async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule);
app.useGlobalPipes(
new ValidationPipe({ whitelist: true, forbidNonWhitelisted: true, transform: true }),
);
app.enableCors({ origin: true, credentials: true });
const port = Number(process.env.PORT ?? 3200);
await app.listen(port);
// eslint-disable-next-line no-console
console.log(`iios-service listening on :${port}`);
}
void bootstrap();
@@ -0,0 +1,9 @@
import { Global, Module } from '@nestjs/common';
import { PrismaService } from './prisma.service';
@Global()
@Module({
providers: [PrismaService],
exports: [PrismaService],
})
export class PrismaModule {}
@@ -0,0 +1,9 @@
import { Injectable, OnModuleInit } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
async onModuleInit(): Promise<void> {
await this.$connect();
}
}