chore(repo): import lab2 sources as lab3 baseline

This commit is contained in:
Голиков Maximillian Антон
2026-10-06 18:59:51 +03:00
parent 0ab3a341aa
commit a7ba75be4b
53 changed files with 3244 additions and 2 deletions
@@ -0,0 +1,30 @@
package middleware
import (
"github.com/gin-gonic/gin"
"high-loud-apps-labs/internal/domain"
)
const (
CurrentUserKey = "current_user"
CurrentTokenKey = "current_token"
)
func CurrentUser(c *gin.Context) *domain.User {
if v, ok := c.Get(CurrentUserKey); ok {
if u, ok := v.(*domain.User); ok {
return u
}
}
return nil
}
func CurrentToken(c *gin.Context) string {
if v, ok := c.Get(CurrentTokenKey); ok {
if s, ok := v.(string); ok {
return s
}
}
return ""
}