feat: admin app version mgmt + notification system
- New tables: app_config, notifications - Admin views: App Version editor, Notification sender - API: GET /api/notifications, POST /api/notifications/:id/read, POST /api/notifications/read-all - App version now stored in DB, editable by super admin - Notifications: send to all users or specific user - Android notification models + API client - Sidebar: App Version + Notifications links for super_admin
This commit is contained in:
@@ -49,4 +49,16 @@ interface ApiService {
|
||||
|
||||
@GET("api/app-version")
|
||||
suspend fun checkVersion(): ApiResponse<AppVersionResponse>
|
||||
|
||||
@GET("api/notifications")
|
||||
suspend fun getNotifications(
|
||||
@Query("page") page: Int = 1,
|
||||
@Query("per_page") perPage: Int = 20
|
||||
): NotificationListResponse
|
||||
|
||||
@POST("api/notifications/{id}/read")
|
||||
suspend fun markNotificationRead(@Path("id") id: Int): ApiResponse<Map<String, Boolean>>
|
||||
|
||||
@POST("api/notifications/read-all")
|
||||
suspend fun markAllNotificationsRead(): ApiResponse<Map<String, Boolean>>
|
||||
}
|
||||
|
||||
@@ -25,3 +25,12 @@ data class AppVersionResponse(
|
||||
val force_update: Boolean = false,
|
||||
val release_notes: String = ""
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class NotificationListResponse(
|
||||
val success: Boolean = true,
|
||||
val data: List<AppNotification> = emptyList(),
|
||||
val error: String? = null,
|
||||
val pagination: Pagination? = null,
|
||||
val unread_count: Int = 0
|
||||
)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.devlab.app.data.model
|
||||
|
||||
@kotlinx.serialization.Serializable
|
||||
data class AppNotification(
|
||||
val id: Int = 0,
|
||||
val title: String = "",
|
||||
val message: String = "",
|
||||
val type: String = "info",
|
||||
val is_read: Int = 0,
|
||||
val created_at: String = "",
|
||||
)
|
||||
Reference in New Issue
Block a user