feat(api): add terminal session persistence with Prisma model and CRUD service
Some checks failed
ci/woodpecker/push/api Pipeline failed
Some checks failed
ci/woodpecker/push/api Pipeline failed
Adds database-backed TerminalSession model with ACTIVE/CLOSED status enum, migration SQL, TerminalSessionService (create/findByWorkspace/close/findById), DTO file with class-validator decorators, unit tests (12 tests), and module registration. Workspace relation and indexed columns enable efficient session listing and recovery. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,10 +5,11 @@
|
||||
*
|
||||
* Imports:
|
||||
* - AuthModule for WebSocket authentication (verifySession)
|
||||
* - PrismaModule for workspace membership queries
|
||||
* - PrismaModule for workspace membership queries and session persistence
|
||||
*
|
||||
* Providers:
|
||||
* - TerminalService: manages PTY session lifecycle
|
||||
* - TerminalService: manages PTY session lifecycle (in-memory)
|
||||
* - TerminalSessionService: persists session records to the database
|
||||
* - TerminalGateway: WebSocket gateway on /terminal namespace
|
||||
*
|
||||
* The module does not export providers; terminal sessions are
|
||||
@@ -18,11 +19,13 @@
|
||||
import { Module } from "@nestjs/common";
|
||||
import { TerminalGateway } from "./terminal.gateway";
|
||||
import { TerminalService } from "./terminal.service";
|
||||
import { TerminalSessionService } from "./terminal-session.service";
|
||||
import { AuthModule } from "../auth/auth.module";
|
||||
import { PrismaModule } from "../prisma/prisma.module";
|
||||
|
||||
@Module({
|
||||
imports: [AuthModule, PrismaModule],
|
||||
providers: [TerminalGateway, TerminalService],
|
||||
providers: [TerminalGateway, TerminalService, TerminalSessionService],
|
||||
exports: [TerminalSessionService],
|
||||
})
|
||||
export class TerminalModule {}
|
||||
|
||||
Reference in New Issue
Block a user