Skip to content

Commit 4857e56

Browse files
committed
chore: Configure TypeScript for the web project and define dashboard-related types.
1 parent fad5b79 commit 4857e56

File tree

2 files changed

+91
-14
lines changed

2 files changed

+91
-14
lines changed

web/src/types/dashboard.ts

Lines changed: 85 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,106 @@
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+
*/
153
export interface GitHubActivity {
254
id: string;
355
type: string;
456
icon: string;
557
title: string;
658
description: string;
759
time_ago: string;
8-
context: any;
60+
repo: string;
61+
context: Record<string, unknown>;
962
}
1063

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;
1873
}
1974

75+
/**
76+
* Template option for post generation styles
77+
*/
2078
export interface Template {
2179
id: string;
2280
name: string;
2381
description: string;
2482
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;
2694
}
2795

96+
/**
97+
* Post context for AI generation
98+
*/
2899
export interface PostContext {
29100
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;
34106
}

web/tsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,19 @@
2525
"paths": {
2626
"@/*": [
2727
"./src/*"
28+
],
29+
"@shared/*": [
30+
"../shared/*"
2831
]
2932
}
3033
},
3134
"include": [
3235
"next-env.d.ts",
3336
"**/*.ts",
3437
"**/*.tsx",
35-
"jest.d.ts"
38+
"jest.d.ts",
39+
"../shared/**/*.ts",
40+
"../shared/**/*.d.ts"
3641
],
3742
"exclude": [
3843
"node_modules"

0 commit comments

Comments
 (0)