untitled-2883workflows.ts14 matches
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import type { ApiResponse, CreateWorkflowRequest } from "../../shared/types.ts";
3import {
4createWorkflowTemplate,
15try {
16const templates = await getAllWorkflowTemplates();
17const response: ApiResponse = {
18success: true,
19data: templates
21return c.json(response);
22} catch (error) {
23const response: ApiResponse = {
24success: false,
25error: error.message
34const id = c.req.param("id");
35const template = await getWorkflowTemplate(id);
36const response: ApiResponse = {
37success: true,
38data: template
40return c.json(response);
41} catch (error) {
42const response: ApiResponse = {
43success: false,
44error: error.message
55// Validate required fields
56if (!data.name || !data.serviceType || !data.steps) {
57const response: ApiResponse = {
58success: false,
59error: "Missing required fields: name, serviceType, and steps are required"
6364const template = await createWorkflowTemplate(data);
65const response: ApiResponse = {
66success: true,
67data: template,
70return c.json(response, 201);
71} catch (error) {
72const response: ApiResponse = {
73success: false,
74error: error.message
85
86const template = await updateWorkflowTemplate(id, data);
87const response: ApiResponse = {
88success: true,
89data: template,
92return c.json(response);
93} catch (error) {
94const response: ApiResponse = {
95success: false,
96error: error.message
105const id = c.req.param("id");
106await deleteWorkflowTemplate(id);
107const response: ApiResponse = {
108success: true,
109message: "Workflow template deleted successfully"
111return c.json(response);
112} catch (error) {
113const response: ApiResponse = {
114success: false,
115error: error.message
141
142const newTemplate = await createWorkflowTemplate(duplicateData);
143const response: ApiResponse = {
144success: true,
145data: newTemplate,
148return c.json(response, 201);
149} catch (error) {
150const response: ApiResponse = {
151success: false,
152error: error.message
17โ โ โโโ queries.ts # Database query functions
18โ โโโ routes/
19โ โ โโโ jobs.ts # Job posting API routes
20โ โ โโโ chat.ts # Chat API routes
21โ โโโ index.ts # Main Hono server
22โโโ frontend/
34## Tech Stack
3536- **Backend**: Hono (TypeScript API framework)
37- **Database**: SQLite
38- **Frontend**: React with TypeScript
40- **Real-time**: Polling for chat updates
4142## API Endpoints
4344### Jobs
45- `GET /api/jobs` - Get all job postings
46- `POST /api/jobs` - Create a new job posting
4748### Chat
49- `GET /api/chat` - Get chat messages
50- `POST /api/chat` - Send a chat message
5152## Getting Started
71});
7273// API Routes
7475// Get all jobs
76app.get("/api/jobs", async c => {
77const jobs = await getRecentJobs();
78return c.json(jobs);
8081// Create new job posting
82app.post("/api/jobs", async c => {
83try {
84const jobData: CreateJobRequest = await c.req.json();
117118// Get specific job
119app.get("/api/jobs/:id", async c => {
120const id = parseInt(c.req.param("id"));
121const job = await getJobById(id);
129130// Get chat messages
131app.get("/api/chat", async c => {
132const messages = await getRecentMessages();
133return c.json(messages);
135136// Post chat message
137app.post("/api/chat", async c => {
138try {
139const messageData: CreateMessageRequest = await c.req.json();
untitled-8262README.md1 match
37## Deployment
3839This portfolio is automatically deployed on Val Town. The backend serves the frontend files and handles any API requests.
GuitarBoardREADME.md12 matches
30โ โ โโโ migrations.ts # Database schema for messages, jobs, and applications
31โ โ โโโ queries.ts # Database query functions
32โ โโโ index.ts # Main Hono server with job and chat APIs
33โโโ frontend/
34โ โโโ components/
47## Tech Stack
4849- **Backend**: Hono (TypeScript API framework)
50- **Frontend**: React 18.2.0 with TypeScript
51- **Database**: SQLite with three tables (messages, jobs, applications)
53- **Real-time**: Server-Sent Events (SSE) for chat
5455## API Endpoints
5657### Chat Endpoints
58- `GET /api/messages` - Get recent chat messages
59- `POST /api/messages` - Send a new chat message
60- `GET /api/events` - SSE endpoint for real-time chat updates
6162### Job Endpoints
63- `GET /api/jobs` - Get job postings (with optional status filter)
64- `GET /api/jobs/:id` - Get specific job details
65- `POST /api/jobs` - Create a new job posting
66- `PATCH /api/jobs/:id/status` - Update job status
67- `GET /api/jobs/:id/applications` - Get applications for a job
68- `POST /api/jobs/:id/apply` - Apply to a specific job
6970## Job Types
untitled-9323README.md7 matches
17โ โ โโโ queries.ts # Database query functions
18โ โโโ routes/
19โ โ โโโ jobs.ts # Job posting API routes
20โ โ โโโ chat.ts # Chat API routes
21โ โโโ index.ts # Main Hono server
22โโโ frontend/
32```
3334## API Endpoints
3536- `GET /api/jobs` - Get all job postings
37- `POST /api/jobs` - Create a new job posting
38- `GET /api/chat/messages` - Get chat messages
39- `POST /api/chat/messages` - Send a chat message
4041## Getting Started
untitled-960README.md9 matches
17โ โ โโโ queries.ts # Database query functions
18โ โโโ routes/
19โ โ โโโ jobs.ts # Job posting API routes
20โ โ โโโ chat.ts # Chat API routes
21โ โโโ index.ts # Main Hono server
22โโโ frontend/
34## Tech Stack
3536- **Backend**: Hono (TypeScript API framework)
37- **Database**: SQLite
38- **Frontend**: React with TypeScript
40- **Real-time**: Polling for chat updates
4142## API Endpoints
4344### Jobs
45- `GET /api/jobs` - Get all job postings
46- `POST /api/jobs` - Create a new job posting
47- `DELETE /api/jobs/:id` - Delete a job posting
4849### Chat
50- `GET /api/chat/messages` - Get chat messages
51- `POST /api/chat/messages` - Send a chat message
5253## Getting Started
untitled-2883types.ts2 matches
86}
8788// API Response types
89export interface ApiResponse<T = any> {
90success: boolean;
91data?: T;
28```
29โโโ backend/
30โ โโโ index.ts # Hono server with SQLite database and REST API
31โโโ frontend/
32โ โโโ index.html # Main application template
53- Job references for shared postings
5455## API Endpoints
5657### Jobs
58- `GET /api/jobs` - Fetch all job postings
59- `POST /api/jobs` - Create new job posting
60- `GET /api/jobs/:id` - Get specific job details
6162### Chat
63- `GET /api/chat` - Fetch recent chat messages
64- `POST /api/chat` - Send new chat message
6566## Usage
GuitarBoardApp.tsx2 matches
38if (!isUsernameSet) return;
3940const eventSource = new EventSource('/api/events');
41eventSourceRef.current = eventSource;
427576try {
77const response = await fetch('/api/messages', {
78method: 'POST',
79headers: {