Creates the errands table (with conflictFiles column), errand-repository port interface, DrizzleErrandRepository adapter, and wires the repository into TRPCContext, the DI container, _helpers.ts requireErrandRepository guard, and the test harness. Also fixes pre-existing TS error in controller.test.ts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
/**
|
|
* Errand Repository Port Interface
|
|
*
|
|
* Port for Errand aggregate operations.
|
|
* Implementations (Drizzle, etc.) are adapters.
|
|
*/
|
|
|
|
import type { Errand, NewErrand, ErrandStatus } from '../schema.js';
|
|
|
|
/**
|
|
* Data for creating a new errand.
|
|
* Omits system-managed fields (id, createdAt, updatedAt).
|
|
*/
|
|
export type CreateErrandData = Omit<NewErrand, 'id' | 'createdAt' | 'updatedAt'>;
|
|
|
|
/**
|
|
* Data for updating an errand.
|
|
*/
|
|
export type UpdateErrandData = Partial<Omit<NewErrand, 'id' | 'createdAt'>>;
|
|
|
|
/**
|
|
* Errand with the agent alias joined in.
|
|
*/
|
|
export interface ErrandWithAlias extends Errand {
|
|
agentAlias: string | null;
|
|
}
|
|
|
|
/**
|
|
* Filter options for listing errands.
|
|
*/
|
|
export interface FindAllErrandOptions {
|
|
projectId?: string;
|
|
status?: ErrandStatus;
|
|
}
|
|
|
|
/**
|
|
* Errand Repository Port
|
|
*/
|
|
export interface ErrandRepository {
|
|
create(data: CreateErrandData): Promise<Errand>;
|
|
findById(id: string): Promise<ErrandWithAlias | null>;
|
|
findAll(options?: FindAllErrandOptions): Promise<ErrandWithAlias[]>;
|
|
update(id: string, data: UpdateErrandData): Promise<Errand | null>;
|
|
delete(id: string): Promise<void>;
|
|
}
|