chore: init next prisma and file structure
This commit is contained in:
149
lib/types.ts
Normal file
149
lib/types.ts
Normal file
@@ -0,0 +1,149 @@
|
||||
// Types de base pour les tâches
|
||||
export type TaskStatus = 'todo' | 'in_progress' | 'done' | 'cancelled';
|
||||
export type TaskPriority = 'low' | 'medium' | 'high' | 'urgent';
|
||||
export type TaskSource = 'reminders' | 'jira';
|
||||
|
||||
// Interface principale pour les tâches
|
||||
export interface Task {
|
||||
id: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
status: TaskStatus;
|
||||
priority: TaskPriority;
|
||||
source: TaskSource;
|
||||
sourceId?: string;
|
||||
tags: string[];
|
||||
dueDate?: Date;
|
||||
completedAt?: Date;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
|
||||
// Métadonnées Jira
|
||||
jiraProject?: string;
|
||||
jiraKey?: string;
|
||||
assignee?: string;
|
||||
}
|
||||
|
||||
// Interface pour les tags
|
||||
export interface Tag {
|
||||
id: string;
|
||||
name: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
// Interface pour les logs de synchronisation
|
||||
export interface SyncLog {
|
||||
id: string;
|
||||
source: TaskSource;
|
||||
status: 'success' | 'error';
|
||||
message?: string;
|
||||
tasksSync: number;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
// Types pour les rappels macOS
|
||||
export interface MacOSReminder {
|
||||
id: string;
|
||||
title: string;
|
||||
notes?: string;
|
||||
completed: boolean;
|
||||
dueDate?: Date;
|
||||
completionDate?: Date;
|
||||
priority: number; // 0=None, 1=Low, 5=Medium, 9=High
|
||||
list: string;
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
// Types pour Jira
|
||||
export interface JiraTask {
|
||||
id: string;
|
||||
key: string;
|
||||
summary: string;
|
||||
description?: string;
|
||||
status: {
|
||||
name: string;
|
||||
category: string;
|
||||
};
|
||||
priority?: {
|
||||
name: string;
|
||||
};
|
||||
assignee?: {
|
||||
displayName: string;
|
||||
emailAddress: string;
|
||||
};
|
||||
project: {
|
||||
key: string;
|
||||
name: string;
|
||||
};
|
||||
duedate?: string;
|
||||
created: string;
|
||||
updated: string;
|
||||
labels: string[];
|
||||
}
|
||||
|
||||
// Types pour l'API
|
||||
export interface ApiResponse<T> {
|
||||
data?: T;
|
||||
error?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface PaginatedResponse<T> {
|
||||
data: T[];
|
||||
total: number;
|
||||
page: number;
|
||||
limit: number;
|
||||
}
|
||||
|
||||
// Types pour les filtres
|
||||
export interface TaskFilters {
|
||||
status?: TaskStatus[];
|
||||
priority?: TaskPriority[];
|
||||
source?: TaskSource[];
|
||||
tags?: string[];
|
||||
assignee?: string;
|
||||
search?: string;
|
||||
dueDate?: {
|
||||
from?: Date;
|
||||
to?: Date;
|
||||
};
|
||||
}
|
||||
|
||||
// Types pour les statistiques d'équipe
|
||||
export interface TeamStats {
|
||||
totalTasks: number;
|
||||
completedTasks: number;
|
||||
inProgressTasks: number;
|
||||
velocity: number;
|
||||
burndownData: BurndownPoint[];
|
||||
memberStats: MemberStats[];
|
||||
}
|
||||
|
||||
export interface BurndownPoint {
|
||||
date: Date;
|
||||
remaining: number;
|
||||
completed: number;
|
||||
}
|
||||
|
||||
export interface MemberStats {
|
||||
name: string;
|
||||
email: string;
|
||||
totalTasks: number;
|
||||
completedTasks: number;
|
||||
averageCompletionTime: number;
|
||||
}
|
||||
|
||||
// Types d'erreur
|
||||
export class BusinessError extends Error {
|
||||
constructor(message: string, public code?: string) {
|
||||
super(message);
|
||||
this.name = 'BusinessError';
|
||||
}
|
||||
}
|
||||
|
||||
export class ValidationError extends Error {
|
||||
constructor(message: string, public field?: string) {
|
||||
super(message);
|
||||
this.name = 'ValidationError';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user