Skip to content

Commit

Permalink
fix small issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sgmv committed Jan 21, 2025
1 parent 7e7e4f5 commit 44f6b6f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
## Table of contents

- [Incident creation for API V1](./v1/v1_incident_creation.md)
- [Availability calculation]
- [Components availability V2](./v2/v2_components_availability.md)
- [Authentication for FE part](./auth/authentication.md)
39 changes: 20 additions & 19 deletions internal/api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,48 @@ import (
)

const (
v1Group = "v1"
v2Group = "v2"
authGroup = "auth"
v1Group = "v1"
v2Group = "v2"
)

func (a *API) InitRoutes() {
authAPI := a.r.Group("auth")
authAPI := a.r.Group(authGroup)
{
authAPI.GET("login", auth.GetLoginPageHandler(a.oa2Prov, a.log))
authAPI.GET("callback", auth.GetCallbackHandler(a.oa2Prov, a.log))
authAPI.POST("token", auth.PostTokenHandler(a.oa2Prov, a.log))
authAPI.PUT("logout", auth.PutLogoutHandler(a.oa2Prov, a.log))
}

v1Api := a.r.Group(v1Group)
v1API := a.r.Group(v1Group)
{
v1Api.GET("component_status", v1.GetComponentsStatusHandler(a.db, a.log))
v1Api.POST("component_status", AuthenticationMW(a.oa2Prov, a.log), v1.PostComponentStatusHandler(a.db, a.log))
v1API.GET("component_status", v1.GetComponentsStatusHandler(a.db, a.log))
v1API.POST("component_status", AuthenticationMW(a.oa2Prov, a.log), v1.PostComponentStatusHandler(a.db, a.log))

v1Api.GET("incidents", v1.GetIncidentsHandler(a.db, a.log))
v1API.GET("incidents", v1.GetIncidentsHandler(a.db, a.log))
}

v2Api := a.r.Group(v2Group)
v2API := a.r.Group(v2Group)
{
v2Api.GET("components", v2.GetComponentsHandler(a.db, a.log))
v2Api.POST("components", AuthenticationMW(a.oa2Prov, a.log), v2.PostComponentHandler(a.db, a.log))
v2Api.GET("components/:id", v2.GetComponentHandler(a.db, a.log))
v2API.GET("components", v2.GetComponentsHandler(a.db, a.log))
v2API.POST("components", AuthenticationMW(a.oa2Prov, a.log), v2.PostComponentHandler(a.db, a.log))
v2API.GET("components/:id", v2.GetComponentHandler(a.db, a.log))

v2Api.GET("incidents", v2.GetIncidentsHandler(a.db, a.log))
v2Api.POST("incidents",
v2API.GET("incidents", v2.GetIncidentsHandler(a.db, a.log))
v2API.POST("incidents",
AuthenticationMW(a.oa2Prov, a.log),
ValidateComponentsMW(a.db, a.log),
v2.PostIncidentHandler(a.db, a.log),
)
v2Api.GET("incidents/:id", v2.GetIncidentHandler(a.db, a.log))
v2Api.PATCH("incidents/:id", AuthenticationMW(a.oa2Prov, a.log), v2.PatchIncidentHandler(a.db, a.log))
v2API.GET("incidents/:id", v2.GetIncidentHandler(a.db, a.log))
v2API.PATCH("incidents/:id", AuthenticationMW(a.oa2Prov, a.log), v2.PatchIncidentHandler(a.db, a.log))

v2Api.GET("availability", v2.GetComponentsAvailabilityHandler(a.db, a.log))
v2API.GET("availability", v2.GetComponentsAvailabilityHandler(a.db, a.log))

//nolint:gocritic
//v2Api.GET("rss")
//v2Api.GET("history")
//v2Api.GET("/separate/<incident_id>/<component_id>") - > investigate it!!!
//v2API.GET("rss")
//v2API.GET("history")
//v2API.GET("/separate/<incident_id>/<component_id>") - > investigate it!!!
}
}

0 comments on commit 44f6b6f

Please sign in to comment.