feat: initialize frontend with React, Vite, and Tailwind CSS
- Added package.json for project dependencies and scripts. - Configured PostCSS with Tailwind CSS. - Created main application structure with App component and routing. - Implemented API client for handling requests with Axios. - Developed authentication API for login, logout, and user verification. - Created entities API for managing virtual entities. - Implemented logs API for fetching dispatch logs. - Added navigation bar component for app navigation. - Created protected route component for route guarding. - Set up global CSS with Tailwind directives. - Configured main entry point for React application. - Developed basic Dashboard and Login pages. - Set up router for application navigation. - Added Jest testing setup for testing library. - Configured Tailwind CSS with content paths. - Set TypeScript configuration for frontend. - Created Vite configuration for development and production builds. - Added Nginx configuration for serving the application and proxying API requests.
This commit is contained in:
58
frontend/src/api/entitiesApi.ts
Normal file
58
frontend/src/api/entitiesApi.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import apiClient from './apiClient'
|
||||
|
||||
export interface VirtualEntityResponse {
|
||||
id: string
|
||||
name: string
|
||||
email: string
|
||||
jobTitle: string
|
||||
personality: string
|
||||
scheduleCron: string
|
||||
contextWindowDays: number
|
||||
active: boolean
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export interface VirtualEntityCreateDto {
|
||||
name: string
|
||||
email: string
|
||||
jobTitle: string
|
||||
personality: string
|
||||
scheduleCron: string
|
||||
contextWindowDays: number
|
||||
}
|
||||
|
||||
export type VirtualEntityUpdateDto = Partial<VirtualEntityCreateDto>
|
||||
|
||||
/** GET /api/v1/virtual-entities — list all virtual entities. */
|
||||
export async function getEntities(): Promise<VirtualEntityResponse[]> {
|
||||
const response = await apiClient.get<VirtualEntityResponse[]>('/v1/virtual-entities')
|
||||
return response.data
|
||||
}
|
||||
|
||||
/** GET /api/v1/virtual-entities/:id — get one entity by id. */
|
||||
export async function getEntity(id: string): Promise<VirtualEntityResponse> {
|
||||
const response = await apiClient.get<VirtualEntityResponse>(`/v1/virtual-entities/${id}`)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/** POST /api/v1/virtual-entities — create a new entity. */
|
||||
export async function createEntity(data: VirtualEntityCreateDto): Promise<VirtualEntityResponse> {
|
||||
const response = await apiClient.post<VirtualEntityResponse>('/v1/virtual-entities', data)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/** PUT /api/v1/virtual-entities/:id — update an entity. */
|
||||
export async function updateEntity(id: string, data: VirtualEntityUpdateDto): Promise<VirtualEntityResponse> {
|
||||
const response = await apiClient.put<VirtualEntityResponse>(`/v1/virtual-entities/${id}`, data)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/** DELETE /api/v1/virtual-entities/:id — soft-delete (deactivate) an entity. */
|
||||
export async function deleteEntity(id: string): Promise<void> {
|
||||
await apiClient.delete(`/v1/virtual-entities/${id}`)
|
||||
}
|
||||
|
||||
/** POST /api/v1/virtual-entities/:id/trigger — manually trigger the entity pipeline. */
|
||||
export async function triggerEntity(id: string): Promise<void> {
|
||||
await apiClient.post(`/v1/virtual-entities/${id}/trigger`)
|
||||
}
|
||||
Reference in New Issue
Block a user