Files
scriptshare-cursor-clone/src/lib/api/scripts.ts

51 lines
1.3 KiB
TypeScript
Raw Normal View History

export interface ScriptFilters {
search?: string;
categories?: string[];
compatibleOs?: string[];
sortBy?: string;
limit?: number;
isApproved?: boolean;
}
export interface UpdateScriptData {
name?: string;
description?: string;
content?: string;
}
export interface CreateScriptData {
name: string;
description: string;
content: string;
categories: string[];
compatibleOs: string[];
tags?: string[];
}
export async function getScripts(filters?: ScriptFilters) {
return { scripts: [], total: 0 };
}
export async function getScriptById(id: string) {
return null;
}
export async function getPopularScripts() {
return [];
}
export async function getRecentScripts() {
return [];
}
export async function createScript(data: CreateScriptData, userId: string) {
return { id: "mock-script-id", ...data, authorId: userId };
}
export async function updateScript(id: string, data: UpdateScriptData, userId: string) {
return { id, ...data };
}
export async function deleteScript(id: string, userId: string) {
return { success: true };
}
export async function moderateScript(id: string, isApproved: boolean, moderatorId: string) {
return { id, isApproved };
}
export async function incrementViewCount(id: string) {
return { success: true };
}
export async function incrementDownloadCount(id: string) {
return { success: true };
}