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.
35 lines
1.0 KiB
TypeScript
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>;
|
|
}
|