feat: [#4] modèles de données du domaine (Task, Project, Section, Label, Source)

This commit is contained in:
2026-06-06 05:55:12 +02:00
parent b0b073c8ec
commit c5fffb93b4
10 changed files with 167 additions and 0 deletions
@@ -0,0 +1,3 @@
package com.planify.mobile.domain.model
enum class BackendType { LOCAL, CALDAV, TODOIST }
@@ -0,0 +1,16 @@
package com.planify.mobile.domain.model
data class DueDate(
val date: String,
val timezone: String? = null,
val isRecurring: Boolean = false,
val recurrencyType: RecurrencyType = RecurrencyType.NONE,
val recurrencyInterval: Int = 1,
val recurrencyWeekDays: List<Int> = emptyList(),
val recurrencyCount: Int? = null,
val recurrencyEnd: String? = null,
)
enum class RecurrencyType {
NONE, MINUTELY, HOURLY, EVERY_DAY, EVERY_WEEK, EVERY_MONTH, EVERY_YEAR
}
@@ -0,0 +1,12 @@
package com.planify.mobile.domain.model
data class Label(
val id: String,
val name: String,
val color: String,
val order: Int = 0,
val sourceId: String? = null,
val backendType: BackendType = BackendType.LOCAL,
val isFavorite: Boolean = false,
val isDeleted: Boolean = false,
)
@@ -0,0 +1,25 @@
package com.planify.mobile.domain.model
data class Project(
val id: String,
val name: String,
val color: String = "#4CAF50",
val emoji: String? = null,
val parentId: String? = null,
val sourceId: String? = null,
val backendType: BackendType = BackendType.LOCAL,
val isInbox: Boolean = false,
val isFavorite: Boolean = false,
val isArchived: Boolean = false,
val isDeleted: Boolean = false,
val viewStyle: ViewStyle = ViewStyle.LIST,
val sortedBy: SortBy = SortBy.MANUAL,
val sortAscending: Boolean = true,
val childOrder: Int = 0,
val calendarUrl: String? = null,
val syncId: String? = null,
)
enum class ViewStyle { LIST, BOARD }
enum class SortBy { MANUAL, NAME, DUE_DATE, ADDED_DATE, PRIORITY }
@@ -0,0 +1,11 @@
package com.planify.mobile.domain.model
data class Reminder(
val id: String,
val taskId: String,
val type: ReminderType,
val dueDate: DueDate? = null,
val minutesOffset: Int? = null,
)
enum class ReminderType { ABSOLUTE, RELATIVE }
@@ -0,0 +1,13 @@
package com.planify.mobile.domain.model
data class Section(
val id: String,
val name: String,
val projectId: String,
val order: Int = 0,
val isArchived: Boolean = false,
val isDeleted: Boolean = false,
val collapsed: Boolean = false,
val icalUrl: String? = null,
val etag: String? = null,
)
@@ -0,0 +1,26 @@
package com.planify.mobile.domain.model
data class Source(
val id: String,
val type: SourceType,
val displayName: String,
val addedAt: String,
val updatedAt: String,
val isVisible: Boolean = true,
val lastSync: String? = null,
val caldavData: SourceCalDavData? = null,
)
enum class SourceType { LOCAL, CALDAV }
data class SourceCalDavData(
val serverUrl: String,
val username: String,
val calendarHomeUrl: String? = null,
val userDisplayName: String? = null,
val userEmail: String? = null,
val caldavType: CalDavType = CalDavType.GENERIC,
val ignoreSsl: Boolean = false,
)
enum class CalDavType { NEXTCLOUD, GENERIC }
@@ -0,0 +1,28 @@
package com.planify.mobile.domain.model
data class Task(
val id: String,
val content: String,
val description: String = "",
val projectId: String,
val sectionId: String? = null,
val parentId: String? = null,
val priority: Int = 4,
val checked: Boolean = false,
val dueDate: DueDate? = null,
val deadlineDate: String? = null,
val labels: List<String> = emptyList(),
val pinned: Boolean = false,
val collapsed: Boolean = false,
val childOrder: Int = 0,
val addedAt: String = "",
val updatedAt: String = "",
val completedAt: String? = null,
val itemType: ItemType = ItemType.TASK,
val calendarEventUid: String? = null,
val icalUrl: String? = null,
val etag: String? = null,
val responsibleUid: String? = null,
)
enum class ItemType { TASK, NOTE }
@@ -0,0 +1,15 @@
package com.planify.mobile.domain.repository
import com.planify.mobile.domain.model.Project
import kotlinx.coroutines.flow.Flow
interface ProjectRepository {
fun getAllProjects(): Flow<List<Project>>
fun getFavoriteProjects(): Flow<List<Project>>
fun getSubProjects(parentId: String): Flow<List<Project>>
suspend fun getProjectById(id: String): Project?
suspend fun getInboxProject(): Project?
suspend fun insertProject(project: Project)
suspend fun updateProject(project: Project)
suspend fun deleteProject(id: String)
}
@@ -0,0 +1,18 @@
package com.planify.mobile.domain.repository
import com.planify.mobile.domain.model.Task
import kotlinx.coroutines.flow.Flow
interface TaskRepository {
fun getTasksByProject(projectId: String): Flow<List<Task>>
fun getTasksBySection(sectionId: String): Flow<List<Task>>
fun getInboxTasks(): Flow<List<Task>>
fun getTodayTasks(): Flow<List<Task>>
fun getOverdueTasks(): Flow<List<Task>>
fun getSubTasks(parentId: String): Flow<List<Task>>
suspend fun getTaskById(id: String): Task?
suspend fun insertTask(task: Task)
suspend fun updateTask(task: Task)
suspend fun deleteTask(id: String)
suspend fun checkTask(id: String, checked: Boolean)
}