Add site builder service to Docker Compose and remove obsolete scripts
- Introduced a new service `igny8_site_builder` in `docker-compose.app.yml` for site building functionality, including environment variables and volume mappings. - Deleted several outdated scripts: `create_test_users.py`, `test_image_write_access.py`, `update_free_plan.py`, and the database file `db.sqlite3` to clean up the backend. - Updated Django settings and URL configurations to integrate the new site builder module.
This commit is contained in:
61
site-builder/src/api/builder.api.ts
Normal file
61
site-builder/src/api/builder.api.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import axios from 'axios';
|
||||
import type {
|
||||
BuilderFormData,
|
||||
PageBlueprint,
|
||||
SiteBlueprint,
|
||||
SiteStructure,
|
||||
} from '../types/siteBuilder';
|
||||
|
||||
const API_ROOT = import.meta.env.VITE_API_URL ?? 'http://localhost:8010/api';
|
||||
const BASE_PATH = `${API_ROOT}/v1/site-builder`;
|
||||
|
||||
const client = axios.create({
|
||||
baseURL: BASE_PATH,
|
||||
withCredentials: true,
|
||||
});
|
||||
|
||||
export interface CreateBlueprintPayload {
|
||||
name: string;
|
||||
description?: string;
|
||||
site_id: number;
|
||||
sector_id: number;
|
||||
hosting_type: BuilderFormData['hostingType'];
|
||||
config_json: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface GenerateStructurePayload {
|
||||
business_brief: string;
|
||||
objectives: string[];
|
||||
style: BuilderFormData['style'];
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export const builderApi = {
|
||||
async listBlueprints(): Promise<SiteBlueprint[]> {
|
||||
const res = await client.get('/blueprints/');
|
||||
if (Array.isArray(res.data?.results)) {
|
||||
return res.data.results as SiteBlueprint[];
|
||||
}
|
||||
return Array.isArray(res.data) ? res.data : [];
|
||||
},
|
||||
|
||||
async createBlueprint(payload: CreateBlueprintPayload): Promise<SiteBlueprint> {
|
||||
const res = await client.post('/blueprints/', payload);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async generateStructure(
|
||||
blueprintId: number,
|
||||
payload: GenerateStructurePayload,
|
||||
): Promise<{ task_id?: string; success?: boolean; structure?: SiteStructure }> {
|
||||
const res = await client.post(`/blueprints/${blueprintId}/generate_structure/`, payload);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async listPages(blueprintId: number): Promise<PageBlueprint[]> {
|
||||
const res = await client.get(`/pages/?site_blueprint=${blueprintId}`);
|
||||
return Array.isArray(res.data?.results) ? res.data.results : res.data;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user