delete unneeded types
This commit is contained in:
@@ -25,48 +25,3 @@ export type FactTrigger = {
|
||||
scopeConversationId: string;
|
||||
createdAt?: string;
|
||||
};
|
||||
|
||||
export type User = Omit<Users, "id"> & {
|
||||
id: string;
|
||||
};
|
||||
|
||||
export interface Entity<T> {
|
||||
construct: (data: T) => T;
|
||||
create: (data: Omit<T, "id">) => Promise<T>;
|
||||
createMany: (data: Omit<T, "id">[]) => Promise<T[]>;
|
||||
findAll: (user?: { userId: string }) => Promise<T[]>;
|
||||
findById: (id: string) => Promise<T | undefined>;
|
||||
update: (id: string, data: Partial<T>) => Promise<void>;
|
||||
delete: (id: string) => Promise<void>;
|
||||
}
|
||||
|
||||
export interface ConversationEntity extends Entity<Conversation> {
|
||||
fetchMessages: (conversationId: string) => Promise<Array<CommittedMessage>>;
|
||||
}
|
||||
|
||||
export interface FactEntity extends Entity<Fact> {
|
||||
findByConversationId: (conversationId: string) => Promise<Array<Fact>>;
|
||||
}
|
||||
|
||||
export interface MessageEntity extends Entity<CommittedMessage> {
|
||||
findByConversationId: (
|
||||
conversationId: string
|
||||
) => Promise<Array<CommittedMessage>>;
|
||||
}
|
||||
|
||||
export type FactTriggerEntity = Entity<FactTrigger> & {
|
||||
findByFactId: (factId: string) => Promise<Array<FactTrigger>>;
|
||||
findByConversationId: (conversationId: string) => Promise<Array<FactTrigger>>;
|
||||
};
|
||||
|
||||
export type UserEntity = Entity<User> & {
|
||||
findByEmailAddress: (emailAddress: string) => Promise<User | undefined>;
|
||||
};
|
||||
|
||||
export interface ApplicationDatabase {
|
||||
conversations: ConversationEntity;
|
||||
factTriggers: FactTriggerEntity;
|
||||
facts: FactEntity;
|
||||
messages: MessageEntity;
|
||||
users: UserEntity;
|
||||
}
|
||||
|
||||
@@ -3,14 +3,6 @@ import { neon } from "@neondatabase/serverless";
|
||||
import { Kysely /*PostgresDialect*/ } from "kysely";
|
||||
import { NeonDialect } from "kysely-neon";
|
||||
import type Database from "./generated/Database";
|
||||
import type {
|
||||
ConversationEntity,
|
||||
FactEntity,
|
||||
FactTriggerEntity,
|
||||
MessageEntity,
|
||||
UserEntity,
|
||||
} from "./common.ts";
|
||||
import type { CommittedMessage } from "../types";
|
||||
|
||||
// export const pool = new Pool({
|
||||
// connectionString: env.POSTGRES_CONNECTION_STRING as string,
|
||||
|
||||
Reference in New Issue
Block a user