feat: initialized all controllers for release 1;
feat: authentication added to swagger
This commit is contained in:
18
backend/internal/controllers/account.go
Normal file
18
backend/internal/controllers/account.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Summary Change account password
|
||||
// @Tags Account
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security JWT
|
||||
// @Router /account/changePassword [put]
|
||||
func ChangePassword(c *gin.Context) {
|
||||
c.Status(http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
65
backend/internal/controllers/profile.go
Normal file
65
backend/internal/controllers/profile.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Summary Get someone's profile details
|
||||
// @Tags Profile
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param username path string true "Username"
|
||||
// @Security JWT
|
||||
// @Router /profile/{username} [get]
|
||||
func GetProfile(c *gin.Context) {
|
||||
|
||||
username := c.Param("username")
|
||||
|
||||
if username == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"error": "Username cannot be empty",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusNotImplemented, gin.H{
|
||||
"username": username,
|
||||
})
|
||||
}
|
||||
|
||||
// @Summary Get own profile when authorized
|
||||
// @Tags Profile
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security JWT
|
||||
// @Router /profile/me [get]
|
||||
func GetOwnProfile(c *gin.Context) {
|
||||
|
||||
username := "Gregory House"
|
||||
|
||||
c.JSON(http.StatusNotImplemented, gin.H{
|
||||
"username": username,
|
||||
})
|
||||
}
|
||||
|
||||
// @Summary Get profile privacy settings
|
||||
// @Tags Profile
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security JWT
|
||||
// @Router /profile/privacy [get]
|
||||
func GetPrivacySettings(c *gin.Context) {
|
||||
c.Status(http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
// @Summary Update profile privacy settings
|
||||
// @Tags Profile
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security JWT
|
||||
// @Router /profile/privacy [patch]
|
||||
func UpdatePrivacySettings(c *gin.Context) {
|
||||
c.Status(http.StatusNotImplemented)
|
||||
}
|
||||
Reference in New Issue
Block a user