we0-cms-supabase-api
Version:
A CMS API package for Next.js applications with Supabase and dynamic table management
40 lines (39 loc) • 1.05 kB
TypeScript
import { CmsModelAttributes, CmsModelCreationAttributes } from "../types";
declare class CmsModelService {
private supabase;
private tableName;
constructor();
/**
* 创建新的CMS模型
*/
create(data: CmsModelCreationAttributes): Promise<CmsModelAttributes>;
/**
* 根据ID获取模型
*/
findById(id: number): Promise<CmsModelAttributes | null>;
/**
* 根据表名获取模型
*/
findByTableName(tableName: string): Promise<CmsModelAttributes | null>;
/**
* 获取所有模型
*/
findAll(): Promise<CmsModelAttributes[]>;
/**
* 更新模型
*/
update(id: number, data: Partial<CmsModelCreationAttributes>): Promise<CmsModelAttributes>;
/**
* 删除模型
*/
delete(id: number): Promise<boolean>;
}
/**
* 获取CMS模型服务实例
*/
export declare function getCmsModelService(): CmsModelService;
/**
* 初始化 CMS 模型表
*/
export declare function initializeCmsModel(): Promise<boolean>;
export default CmsModelService;