|
| 1 | +/** |
| 2 | + * Dashboard Types |
| 3 | + * |
| 4 | + * These types integrate with the auto-generated API contracts. |
| 5 | + * |
| 6 | + * TO REGENERATE API TYPES: |
| 7 | + * 1. Ensure backend is running: cd backend && python app.py |
| 8 | + * 2. Run: npm run generate:types |
| 9 | + * |
| 10 | + * The generated types are at: shared/contracts/index.d.ts |
| 11 | + */ |
| 12 | + |
| 13 | +// Re-export API types from shared contracts |
| 14 | +// Note: These are generated from OpenAPI spec - do not modify directly |
| 15 | +export type { |
| 16 | + components, |
| 17 | + paths, |
| 18 | + operations, |
| 19 | +} from '@shared/contracts/index'; |
| 20 | + |
| 21 | +// Type aliases for commonly used schemas |
| 22 | +import type { components } from '@shared/contracts/index'; |
| 23 | + |
| 24 | +/** Request body for saving a post */ |
| 25 | +export type SavePostRequest = components['schemas']['SavePostRequest']; |
| 26 | + |
| 27 | +/** Request body for batch post generation */ |
| 28 | +export type BatchGenerateRequest = components['schemas']['BatchGenerateRequest']; |
| 29 | + |
| 30 | +/** Request body for publishing to LinkedIn */ |
| 31 | +export type FullPublishRequest = components['schemas']['FullPublishRequest']; |
| 32 | + |
| 33 | +/** Request body for scanning GitHub activity */ |
| 34 | +export type ScanRequest = components['schemas']['ScanRequest']; |
| 35 | + |
| 36 | +/** Request body for scheduling a post */ |
| 37 | +export type SchedulePostRequest = components['schemas']['SchedulePostRequest']; |
| 38 | + |
| 39 | +/** User settings request */ |
| 40 | +export type UserSettingsRequest = components['schemas']['UserSettingsRequest']; |
| 41 | + |
| 42 | +/** Image preview request */ |
| 43 | +export type ImagePreviewRequest = components['schemas']['ImagePreviewRequest']; |
| 44 | + |
| 45 | +// ============================================================================ |
| 46 | +// Frontend-only types (not in API spec) |
| 47 | +// ============================================================================ |
| 48 | + |
| 49 | +/** |
| 50 | + * GitHub activity item from scan endpoint |
| 51 | + * Note: This is a frontend representation, the actual API returns generic objects |
| 52 | + */ |
1 | 53 | export interface GitHubActivity { |
2 | 54 | id: string; |
3 | 55 | type: string; |
4 | 56 | icon: string; |
5 | 57 | title: string; |
6 | 58 | description: string; |
7 | 59 | time_ago: string; |
8 | | - context: any; |
| 60 | + repo: string; |
| 61 | + context: Record<string, unknown>; |
9 | 62 | } |
10 | 63 |
|
11 | | -export interface Post { |
12 | | - id: number; |
13 | | - post_content: string; |
14 | | - post_type: string; |
15 | | - status: string; |
16 | | - created_at: number; |
17 | | - published_at: number | null; |
| 64 | +/** |
| 65 | + * Post item for the dashboard queue |
| 66 | + */ |
| 67 | +export interface DashboardPost { |
| 68 | + id: string; |
| 69 | + content: string; |
| 70 | + image_url?: string; |
| 71 | + status: 'draft' | 'published' | 'scheduled'; |
| 72 | + activity?: GitHubActivity; |
18 | 73 | } |
19 | 74 |
|
| 75 | +/** |
| 76 | + * Template option for post generation styles |
| 77 | + */ |
20 | 78 | export interface Template { |
21 | 79 | id: string; |
22 | 80 | name: string; |
23 | 81 | description: string; |
24 | 82 | icon: string; |
25 | | - context: any; |
| 83 | + value: string; |
| 84 | +} |
| 85 | + |
| 86 | +/** |
| 87 | + * User stats from analytics endpoint |
| 88 | + */ |
| 89 | +export interface UserStats { |
| 90 | + total_posts: number; |
| 91 | + published_posts: number; |
| 92 | + draft_posts: number; |
| 93 | + posts_this_month: number; |
26 | 94 | } |
27 | 95 |
|
| 96 | +/** |
| 97 | + * Post context for AI generation |
| 98 | + */ |
28 | 99 | export interface PostContext { |
29 | 100 | type: string; |
30 | | - commits: number; |
31 | | - repo: string; |
32 | | - full_repo: string; |
33 | | - date: string; |
| 101 | + commits?: number; |
| 102 | + repo?: string; |
| 103 | + full_repo?: string; |
| 104 | + date?: string; |
| 105 | + [key: string]: unknown; |
34 | 106 | } |
0 commit comments