Files
Codewalkers/apps/server/db/repositories/page-repository.ts
Lukas May fcf822363c feat: Add persistent chat sessions for iterative phase/task refinement
Introduces a chat loop where users send instructions to an agent that
applies changes (create/update/delete phases, tasks, pages) and stays
alive for follow-up messages. Includes schema + migration, repository
layer, chat prompt, file-io action field extension, output handler chat
mode, revert support for deletes, tRPC procedures, events, frontend
slide-over UI with inline changeset display and revert, and docs.
2026-03-04 10:14:28 +01:00

35 lines
1.0 KiB
TypeScript

/**
* Page Repository Port Interface
*
* Port for Page aggregate operations.
* Implementations (Drizzle, etc.) are adapters.
*/
import type { Page, NewPage } from '../schema.js';
/**
* Data for creating a new page.
* Omits system-managed fields (id, createdAt, updatedAt).
*/
export type CreatePageData = Omit<NewPage, 'id' | 'createdAt' | 'updatedAt'> & { id?: string };
/**
* Data for updating a page.
*/
export type UpdatePageData = Partial<Pick<NewPage, 'title' | 'content' | 'sortOrder'>>;
/**
* Page Repository Port
*/
export interface PageRepository {
create(data: CreatePageData): Promise<Page>;
findById(id: string): Promise<Page | null>;
findByIds(ids: string[]): Promise<Page[]>;
findByInitiativeId(initiativeId: string): Promise<Page[]>;
findByParentPageId(parentPageId: string): Promise<Page[]>;
findRootPage(initiativeId: string): Promise<Page | null>;
getOrCreateRootPage(initiativeId: string): Promise<Page>;
update(id: string, data: UpdatePageData): Promise<Page>;
delete(id: string): Promise<void>;
}