mirror of
https://github.com/stackrender/stackrender.git
synced 2026-09-10 19:25:44 +00:00
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
|
|
import { DataType } from "@/lib/schemas/data-type-schema";
|
|
import { FieldInsertType, FieldType } from "@/lib/schemas/field-schema";
|
|
import { RelationshipInsertType, RelationshipType } from "@/lib/schemas/relationship-schema";
|
|
import { TableInsertType, TableType } from "@/lib/schemas/table-schema";
|
|
import { QueryResult } from "@powersync/web";
|
|
import { createContext } from "react";
|
|
|
|
|
|
|
|
|
|
export interface DatabaseContextType {
|
|
tables: TableType[],
|
|
data_types: DataType[] ,
|
|
relationships : RelationshipType[] ,
|
|
// table operations
|
|
createTable: (table: TableInsertType) => Promise<QueryResult>,
|
|
editTable: (table: TableInsertType) => Promise<QueryResult>,
|
|
deleteTable: (id: string) => Promise<QueryResult>,
|
|
// field operations
|
|
createField: (field: FieldInsertType) => Promise<QueryResult>,
|
|
editField: (field: FieldInsertType) => Promise<QueryResult>,
|
|
deleteField: (id: string) => Promise<QueryResult>,
|
|
orderTableFields: (fields: FieldType[]) => Promise<QueryResult> ,
|
|
// relationship operations
|
|
createRelationship : ( relationship : RelationshipInsertType) => Promise<QueryResult> ,
|
|
editRelationship : ( relationship : RelationshipInsertType) => Promise<QueryResult> ,
|
|
deleteRelationship : ( id : string) => Promise<QueryResult> ,
|
|
}
|
|
|
|
|
|
|
|
|
|
export default createContext<DatabaseContextType>({} as DatabaseContextType);
|
|
|