automate-workflowsREADME.md4 matches
5## Files
67- `index.ts` - Main entry point for the HTTP API (Hono app)
8- `github.ts` - GitHub API client for fetching repository data
910## API Endpoints
1112### POST /api/release-notes
1314Generates release notes based on GitHub commits.
automate-workflowsindex.ts2 matches
26});
2728// API endpoint to generate release notes
29app.post('/api/release-notes', async c => {
30try {
31const data = await c.req.json<ReleaseNotesRequest>();
automate-workflowsindex.js2 matches
49
50try {
51// Call API
52const response = await fetch('/api/release-notes', {
53method: 'POST',
54headers: {
automate-workflowsgithub.ts3 matches
1import { GitHubCommit } from '../shared/types';
23// GitHub API client
4export class GitHubClient {
5private baseUrl = 'https://api.github.com';
6private token: string;
7
29if (!response.ok) {
30const error = await response.text();
31throw new Error(`GitHub API error (${response.status}): ${error}`);
32}
33
automate-workflowsREADME.md2 matches
29## Project Structure
3031- `backend/` - API endpoints and GitHub integration
32- `frontend/` - User interface for the app
33- `shared/` - Shared types and utilities
3637- TypeScript
38- GitHub REST API
39- Hono (backend framework)
40- React (frontend)
24app.use("/*", cors());
2526// API routes
27app.route("/api/auth", auth);
28app.route("/api/tickets", tickets);
29app.route("/api/verification", verification);
3031// Serve static files
40// Add initial data to avoid extra round-trips
41const initialData = {
42apiUrl: "/api"
43};
44
21});
2223// API Routes
24app.get("/api/todos", async (c) => {
25const todos = await getTodos();
26return c.json(todos);
27});
2829app.post("/api/todos", async (c) => {
30const data = await c.req.json();
31const todo = await addTodo(data.text);
33});
3435app.put("/api/todos/:id", async (c) => {
36const id = parseInt(c.req.param("id"));
37const data = await c.req.json();
40});
4142app.delete("/api/todos/:id", async (c) => {
43const id = parseInt(c.req.param("id"));
44await deleteTodo(id);
3import { UserProfile } from "../../shared/types.ts";
45// Get API URL from initial data
6const apiUrl = (window as any).__INITIAL_DATA__?.apiUrl || "/api";
78interface AuthProps {
48
49// Send request
50const response = await fetch(`${apiUrl}/auth/${endpoint}`, {
51method: "POST",
52headers: {
1920// Get initial data from the server
21const initialData = (window as any).__INITIAL_DATA__ || { apiUrl: "/api" };
2223// App state types
102const fetchTickets = async (token: string) => {
103try {
104const response = await fetch(`${initialData.apiUrl}/tickets`, {
105headers: {
106"Authorization": `Bearer ${token}`
141const handleTicketPurchase = async (ticketType: string) => {
142try {
143const response = await fetch(`${initialData.apiUrl}/tickets/purchase`, {
144method: "POST",
145headers: {
180const handleVerifyTicket = async (code: string) => {
181try {
182const response = await fetch(`${initialData.apiUrl}/verification/verify`, {
183method: "POST",
184headers: {
AppTramverification.ts13 matches
2import { jwtMiddleware } from "./auth.ts";
3import { getTicketByVerificationCode, verifyTicket } from "../database/queries.ts";
4import { ApiResponse, VerificationRequest, VerificationResponse } from "../../shared/types.ts";
56const verification = new Hono();
12
13if (!code) {
14return c.json<ApiResponse<null>>({
15success: false,
16error: "Verification code is required"
21
22if (!ticket) {
23return c.json<ApiResponse<VerificationResponse>>({
24success: true,
25data: {
34// Check if ticket is expired
35if (ticket.expirationTime < now) {
36return c.json<ApiResponse<VerificationResponse>>({
37success: true,
38data: {
46// Check if ticket is already used
47if (ticket.status !== "active") {
48return c.json<ApiResponse<VerificationResponse>>({
49success: true,
50data: {
59await verifyTicket(ticket.id);
60
61return c.json<ApiResponse<VerificationResponse>>({
62success: true,
63data: {
72} catch (error) {
73console.error("Error verifying ticket:", error);
74return c.json<ApiResponse<null>>({
75success: false,
76error: "Failed to verify ticket"
86// Check if user is admin
87if (!isAdmin) {
88return c.json<ApiResponse<null>>({
89success: false,
90error: "Unauthorized"
95
96if (!code) {
97return c.json<ApiResponse<null>>({
98success: false,
99error: "Verification code is required"
104
105if (!ticket) {
106return c.json<ApiResponse<null>>({
107success: false,
108error: "Invalid ticket code"
116
117if (!verified) {
118return c.json<ApiResponse<null>>({
119success: false,
120error: "Failed to mark ticket as used"
122}
123
124return c.json<ApiResponse<{ message: string }>>({
125success: true,
126data: {
130} catch (error) {
131console.error("Error marking ticket as used:", error);
132return c.json<ApiResponse<null>>({
133success: false,
134error: "Failed to mark ticket as used"