Generalize WIP
This commit is contained in:
parent
a3e8b89128
commit
cb7a3a08dc
31 changed files with 657 additions and 106 deletions
|
|
@ -1,6 +1,42 @@
|
|||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { GridColDef } from "@mui/x-data-grid-pro";
|
||||
import { Database } from "./database";
|
||||
|
||||
export interface Service {
|
||||
const entities = [
|
||||
"facebook",
|
||||
"whatsapp",
|
||||
"signal",
|
||||
"voice",
|
||||
"webhook",
|
||||
"user",
|
||||
] as const;
|
||||
|
||||
export type Entity = (typeof entities)[number];
|
||||
|
||||
export type FieldDescription = {
|
||||
name: string;
|
||||
type: string;
|
||||
label: string;
|
||||
lines?: number;
|
||||
copyable?: boolean;
|
||||
defaultValue?: string;
|
||||
required?: boolean;
|
||||
disabled?: boolean;
|
||||
size?: number;
|
||||
helperText?: string;
|
||||
};
|
||||
|
||||
export type ServiceConfig = {
|
||||
entity: Entity;
|
||||
table: keyof Database;
|
||||
displayName: string;
|
||||
createFields: FieldDescription[];
|
||||
updateFields: FieldDescription[];
|
||||
displayFields: FieldDescription[];
|
||||
listColumns: GridColDef[];
|
||||
};
|
||||
|
||||
export type Service = {
|
||||
getAllBots: (req: NextRequest) => Promise<NextResponse>;
|
||||
getOneBot: (req: NextRequest) => Promise<NextResponse>;
|
||||
sendMessage: (req: NextRequest) => Promise<NextResponse>;
|
||||
|
|
@ -13,4 +49,4 @@ export interface Service {
|
|||
createBot: (req: NextRequest) => Promise<NextResponse>;
|
||||
deleteBot: (req: NextRequest) => Promise<NextResponse>;
|
||||
handleWebhook: (req: NextRequest) => Promise<NextResponse>;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue