feat: basic auth shit + db init
This commit is contained in:
parent
db49da5fd9
commit
d8caef7e5d
10 changed files with 261 additions and 69 deletions
|
@ -1,10 +1,9 @@
|
|||
package types
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
"stereo.cat/backend/internal/auth/client"
|
||||
)
|
||||
|
||||
type Route struct {
|
||||
|
@ -14,23 +13,8 @@ type Route struct {
|
|||
}
|
||||
|
||||
type StereoConfig struct {
|
||||
Router *gin.Engine
|
||||
ImagePath string
|
||||
}
|
||||
|
||||
type User struct {
|
||||
gorm.Model
|
||||
ID uint
|
||||
Username string
|
||||
RegistrationDate time.Time
|
||||
Blacklisted bool
|
||||
Email string
|
||||
}
|
||||
|
||||
func RegisterRoutes(groupName string, routes []Route, cfg *StereoConfig) {
|
||||
group := cfg.Router.Group(groupName)
|
||||
|
||||
for _, route := range routes {
|
||||
group.Handle(route.Method, route.Path, route.Exec(cfg))
|
||||
}
|
||||
Router *gin.Engine
|
||||
Client client.Client
|
||||
Database *gorm.DB
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue