-
Notifications
You must be signed in to change notification settings - Fork 0
/
routers.go
62 lines (45 loc) · 1.18 KB
/
routers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package api
import (
"github.com/gin-gonic/gin"
)
func UserRegister(router *gin.RouterGroup) {
router.POST("/", UserRegistration)
}
func UserRetrieve(router *gin.RouterGroup) {
router.GET("/:name", UserRetrieval)
}
func UserUpdate(router *gin.RouterGroup) {
router.PUT("/", UserModification)
}
func UserDelete(router *gin.RouterGroup) {
router.DELETE("/:name", UserDeletion)
}
func SlotCreate(router *gin.RouterGroup) {
router.POST("/", SlotCreation)
}
func SlotRetrieve(router *gin.RouterGroup) {
router.GET("/:name", SlotRetrieval)
}
func SlotRetrieveAll(router *gin.RouterGroup) {
router.GET("/", SlotRetrievalAll)
}
func SlotDelete(router *gin.RouterGroup) {
router.DELETE("/:name", SlotDeletion)
}
func ScheduleRetrieve(router *gin.RouterGroup) {
router.GET("/", ScheduleRetrieval)
}
func SetupRoutes() *gin.Engine {
r := gin.Default()
v1 := r.Group("/api")
UserRegister(v1.Group("/user"))
UserRetrieve(v1.Group("/user"))
UserUpdate(v1.Group("/user"))
UserDelete(v1.Group("/user"))
SlotCreate(v1.Group("/slots"))
SlotRetrieve(v1.Group("/slots"))
SlotRetrieveAll(v1.Group("/slots"))
SlotDelete(v1.Group("/slots"))
ScheduleRetrieve(v1.Group("/schedule"))
return r
}