关闭外键,增加路由
This commit is contained in:
parent
cf49d29e5a
commit
72f051380c
@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/xmdhs/authlib-skin/config"
|
"github.com/xmdhs/authlib-skin/config"
|
||||||
"github.com/xmdhs/authlib-skin/db/cache"
|
"github.com/xmdhs/authlib-skin/db/cache"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
"github.com/xmdhs/authlib-skin/db/ent"
|
||||||
|
"github.com/xmdhs/authlib-skin/db/ent/migrate"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ProvideSlog(c config.Config) slog.Handler {
|
func ProvideSlog(c config.Config) slog.Handler {
|
||||||
@ -62,7 +63,7 @@ func ProvideEnt(ctx context.Context, db *sql.DB, c config.Config, sl *slog.Logge
|
|||||||
opts = append(opts, ent.Debug())
|
opts = append(opts, ent.Debug())
|
||||||
}
|
}
|
||||||
e := ent.NewClient(opts...)
|
e := ent.NewClient(opts...)
|
||||||
err := e.Schema.Create(ctx)
|
err := e.Schema.Create(ctx, migrate.WithForeignKeys(false), migrate.WithDropIndex(true), migrate.WithDropColumn(true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("ProvideEnt: %w", err)
|
return nil, nil, fmt.Errorf("ProvideEnt: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ func NewRoute(yggService *yggdrasil.Yggdrasil, handel *handle.Handel) (*httprout
|
|||||||
|
|
||||||
func newYggdrasil(r *httprouter.Router, handelY yggdrasil.Yggdrasil) error {
|
func newYggdrasil(r *httprouter.Router, handelY yggdrasil.Yggdrasil) error {
|
||||||
r.POST("/api/authserver/authenticate", warpHJSON(handelY.Authenticate()))
|
r.POST("/api/authserver/authenticate", warpHJSON(handelY.Authenticate()))
|
||||||
|
r.POST("/api/authserver/validate", warpHJSON(handelY.Validate()))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user