Skip to content

Commit ec2d6b6

Browse files
committed
Refactor types.ts to improve organization by categorizing types into sections for Auth, User, Project, Task, Sprint, Status, Comment, and Links. Reinstate ErrorResponse interface for better error handling clarity.
1 parent d27b46f commit ec2d6b6

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

src/lib/types.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
// WorkTech API Types based on OpenAPI Schema
2-
3-
export interface ErrorResponse {
4-
error: string;
5-
message: string;
6-
}
7-
8-
// Auth Types
1+
// ===== Auth Types =====
92
export interface LoginRequest {
103
email: string;
114
password: string;
@@ -32,7 +25,7 @@ export interface TokenRefreshRequest {
3225
refreshToken: string;
3326
}
3427

35-
// User Types
28+
// ===== User Types =====
3629
export interface UserShortData {
3730
id: string;
3831
email: string;
@@ -80,7 +73,7 @@ export interface UpdateUserRequest {
8073
confirmPassword: string;
8174
}
8275

83-
// Project Types
76+
// ===== Project Types =====
8477
export interface ShortProjectData {
8578
id: string;
8679
name: string;
@@ -123,7 +116,7 @@ export interface ProjectData {
123116
users: UserWithTasks[];
124117
}
125118

126-
// Task Types
119+
// ===== Task Types =====
127120
export type TaskPriority = 'BLOCKER' | 'HIGH' | 'MEDIUM' | 'LOW';
128121
export type TaskType = 'BUG' | 'TASK' | 'RESEARCH' | 'STORY';
129122

@@ -185,7 +178,7 @@ export interface TaskHistory {
185178
createdAt: string;
186179
}
187180

188-
// Sprint Types
181+
// ===== Sprint Types =====
189182
export interface SprintRequest {
190183
name: string;
191184
startDate?: string;
@@ -202,7 +195,7 @@ export interface Sprint {
202195
defaultSprint: boolean;
203196
}
204197

205-
// Status Types
198+
// ===== Status Types =====
206199
export interface TaskStatusRequest {
207200
id?: number;
208201
priority: number;
@@ -227,7 +220,7 @@ export interface UpdateRequestStatuses {
227220
statuses: TaskStatusRequest[];
228221
}
229222

230-
// Comment Types
223+
// ===== Comment Types =====
231224
export interface CommentRequest {
232225
taskId: string;
233226
projectId: string;
@@ -250,7 +243,7 @@ export interface AllTasksCommentsResponse {
250243
updatedAt: string;
251244
}
252245

253-
// Link Types
246+
// ===== Link Types =====
254247
export interface LinkRequest {
255248
taskIdSource: string;
256249
taskIdTarget: string;
@@ -266,14 +259,18 @@ export interface LinkResponse {
266259
description: string;
267260
}
268261

269-
// API Response wrapper
262+
// ===== Общие типы и утилиты =====
263+
export interface ErrorResponse {
264+
error: string;
265+
message: string;
266+
}
267+
270268
export interface ApiResponse<T = Record<string, unknown>> {
271269
data?: T;
272270
error?: string;
273271
message?: string;
274272
}
275273

276-
// Common ID list type
277274
export interface StringIds {
278275
ids: string[];
279276
}

0 commit comments

Comments
 (0)