2023-09-04 11:13:21 +02:00
|
|
|
package routes
|
|
|
|
|
|
|
|
|
|
import (
|
2023-09-11 08:08:24 +02:00
|
|
|
"gitlab.com/pactual1/backend/controllers"
|
2023-09-11 08:08:24 +02:00
|
|
|
|
2023-09-06 11:58:33 +02:00
|
|
|
"github.com/gin-gonic/gin"
|
2023-09-04 11:13:21 +02:00
|
|
|
)
|
|
|
|
|
|
2023-09-18 12:27:40 +02:00
|
|
|
func RegisterPublicRoutes(r *gin.Engine) {
|
2023-09-04 11:13:21 +02:00
|
|
|
|
2023-10-13 11:48:14 +02:00
|
|
|
// Health checks
|
|
|
|
|
r.GET("/health", controllers.HealthCheck)
|
|
|
|
|
|
2023-09-27 19:20:44 +02:00
|
|
|
// Map dashboard
|
2023-09-19 08:15:42 +02:00
|
|
|
r.GET("/dashboard/map/contract/devices", controllers.GetDevicesByContract)
|
|
|
|
|
r.GET("/dashboard/map/contracts", controllers.GetLatestContracts)
|
|
|
|
|
r.GET("/dashboard/map/device_data", controllers.GetDeviceData)
|
|
|
|
|
|
2023-09-27 19:20:44 +02:00
|
|
|
// Invoices
|
|
|
|
|
r.GET("/invoices", controllers.GetInvoices)
|
2023-10-13 11:48:14 +02:00
|
|
|
r.GET("/invoices/:id", controllers.GetInvoiceByID)
|
2023-09-27 19:20:44 +02:00
|
|
|
|
2023-09-27 08:04:50 +02:00
|
|
|
r.POST("/device_data/save", controllers.SaveDeviceInfo)
|
2023-10-13 11:48:14 +02:00
|
|
|
r.GET("/buyers", controllers.ListCompanies)
|
|
|
|
|
r.GET("/products", controllers.ListProductTemplates)
|
|
|
|
|
r.GET("/templates", controllers.ListTextTemplates)
|
|
|
|
|
r.POST("/templates/save", controllers.CreateTextTemplate)
|
|
|
|
|
r.GET("/products/:template_id", controllers.GetProductTemplate)
|
2023-10-03 18:26:57 +02:00
|
|
|
|
|
|
|
|
// Contracts
|
|
|
|
|
r.GET("/contracts/statuses", controllers.GetContractStatuses)
|
2023-10-06 10:47:26 +02:00
|
|
|
r.GET("/contracts", controllers.GetBuyerContracts)
|
|
|
|
|
r.POST("/contracts/create", controllers.CreateContract)
|
2023-10-12 05:23:34 +02:00
|
|
|
|
2023-10-10 08:39:50 +02:00
|
|
|
r.GET("/contracts/:contract_id", controllers.GetContractByID)
|
|
|
|
|
r.PATCH("/contracts/:contract_id", controllers.UpdateContract)
|
2023-10-12 05:23:34 +02:00
|
|
|
|
|
|
|
|
// Locations
|
|
|
|
|
r.GET("/locations", controllers.SearchPlace)
|
2023-10-09 18:23:44 +02:00
|
|
|
|
|
|
|
|
// Notifications
|
|
|
|
|
r.GET("/notifications", controllers.GetNotifications)
|
2023-10-20 12:03:59 +02:00
|
|
|
|
|
|
|
|
// Stats
|
|
|
|
|
r.GET("/stats/measurements", controllers.GetCompanyRelatedDeviceInfoCount)
|
|
|
|
|
r.GET("/stats/devices", controllers.GetCompanyRelatedDeviceInfoCountWithTempRange)
|
|
|
|
|
r.GET("/stats/contracts", controllers.GetContractCountByStatus)
|
|
|
|
|
r.GET("/stats/contracts/total", controllers.GetTotalContractCount)
|
|
|
|
|
r.GET("/stats/invoices", controllers.GetInvoiceCountByStatus)
|
|
|
|
|
r.GET("/stats/milestones", controllers.GetContractsMatchingDeviceLocation)
|
2023-10-30 19:21:43 +01:00
|
|
|
|
|
|
|
|
//Users
|
|
|
|
|
r.POST("/user/reset/password", controllers.ResetPassword)
|
|
|
|
|
r.POST("/user/set/password", controllers.UpdatePassword)
|
2023-11-06 11:22:51 +01:00
|
|
|
r.POST("/user/login", controllers.Login)
|
|
|
|
|
r.POST("/user/logout", controllers.Logout)
|
2023-09-04 11:13:21 +02:00
|
|
|
}
|