Add dashboard and latest logs endpoints for smoke tracking
- Introduced a new API endpoint `GET /api/v1/smoke/dashboard` to retrieve a summary of smoking statistics over a specified date range, including today's count and weekly breakdown. - Added `GET /api/v1/smoke/logs/latest` endpoint to fetch the most recent smoking logs with a configurable limit. - Updated the smoke handler and service to support the new functionality, including error handling for date parsing and limit validation. - Enhanced documentation to reflect the new API endpoints and their usage.
This commit is contained in:
@@ -10,8 +10,10 @@ func registerSmokeRoutes(protected *gin.RouterGroup, smokeHandler *smokehandler.
|
||||
// 戒烟/抽烟记录(与 video 去水印功能在路由前缀上区分开)
|
||||
smoke := protected.Group("/smoke")
|
||||
{
|
||||
smoke.GET("/dashboard", smokeHandler.Dashboard)
|
||||
smoke.POST("/logs", smokeHandler.Create)
|
||||
smoke.GET("/logs", smokeHandler.List)
|
||||
smoke.GET("/logs/latest", smokeHandler.LatestLogs)
|
||||
smoke.GET("/logs/:id", smokeHandler.Get)
|
||||
smoke.PUT("/logs/:id", smokeHandler.Update)
|
||||
smoke.DELETE("/logs/:id", smokeHandler.Delete)
|
||||
|
||||
Reference in New Issue
Block a user