source: chapterx-frontend/src/types/index.ts

main
Last change on this file was 0b502c2, checked in by kikisrbinoska <srbinoskakristina07@…>, 13 days ago

Fixed user profile and reading lists

  • Property mode set to 100644
File size: 2.9 KB
Line 
1export type UserRole = 'admin' | 'writer' | 'regular' | 'guest'
2export type StoryStatus = 'draft' | 'published' | 'archived'
3export type PermissionLevel = 1 | 2 | 3 | 4 | 5
4export type CollaboratorRole = 'co-author' | 'editor' | 'proofreader' | 'beta-reader'
5export type SuggestionType = 'grammar' | 'style' | 'plot' | 'character' | 'pacing'
6export type NotificationType = 'like' | 'comment' | 'collaboration' | 'system' | 'follow' | 'story_update'
7
8export interface User {
9 user_id: number
10 username: string
11 email: string
12 name: string
13 surname: string
14 role: UserRole
15 bio?: string
16 avatar?: string
17 created_at: string
18 follower_count: number
19 following_count: number
20}
21
22export interface Story {
23 story_id: number
24 title: string
25 short_description: string
26 content: string
27 mature_content: boolean
28 user_id: number
29 author_username: string
30 status: StoryStatus
31 genres: string[]
32 created_at: string
33 updated_at: string
34 total_likes: number
35 total_comments: number
36 total_chapters: number
37 total_views: number
38 cover_image?: string
39}
40
41export interface Chapter {
42 chapter_id: number
43 story_id: number
44 title: string
45 content: string
46 chapter_number: number
47 word_count: number
48 view_count: number
49 created_at: string
50 updated_at: string
51 is_published: boolean
52}
53
54export interface Comment {
55 comment_id: number
56 story_id: number
57 user_id: number
58 username: string
59 content: string
60 created_at: string
61}
62
63export interface ReadingList {
64 list_id: number
65 user_id: number
66 username: string
67 name: string
68 description?: string
69 is_public: boolean
70 created_at: string
71 stories: ReadingListItem[]
72}
73
74export interface ReadingListItem {
75 item_id: number
76 list_id: number
77 story_id: number
78 story_title: string
79 author_username: string
80 added_at: string
81 genres: string[]
82}
83
84export interface Collaboration {
85 collab_id: number
86 story_id: number
87 story_title: string
88 user_id: number
89 username: string
90 name: string
91 role: CollaboratorRole
92 permission_level: PermissionLevel
93 joined_at: string
94}
95
96export interface AISuggestion {
97 suggestion_id: number
98 chapter_id: number
99 suggestion_type: SuggestionType
100 original_text: string
101 suggested_text: string
102 explanation: string
103 accepted: boolean | null
104 created_at: string
105 applied_at?: string
106}
107
108export interface Notification {
109 notification_id: number
110 user_id: number
111 type: NotificationType
112 title: string
113 message: string
114 is_read: boolean
115 created_at: string
116 link?: string
117}
118
119export interface Genre {
120 genre_id: number
121 name: string
122}
123
124export interface StoryAnalytics {
125 story_id: number
126 views_over_time: { date: string; views: number }[]
127 likes_over_time: { date: string; likes: number }[]
128 total_views: number
129 total_likes: number
130 total_comments: number
131 avg_read_time: number
132 completion_rate: number
133}
134
135export interface AuthState {
136 token: string | null
137 currentUser: User | null
138 showMatureContent: boolean
139}
Note: See TracBrowser for help on using the repository browser.