From 72f051380c9ff925ce8595375cd603d1594ca2b1 Mon Sep 17 00:00:00 2001 From: xmdhs Date: Mon, 4 Sep 2023 16:12:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=A4=96=E9=94=AE=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/provide.go | 3 ++- server/route/route.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/provide.go b/server/provide.go index 583a50d..023e568 100644 --- a/server/provide.go +++ b/server/provide.go @@ -15,6 +15,7 @@ import ( "github.com/xmdhs/authlib-skin/config" "github.com/xmdhs/authlib-skin/db/cache" "github.com/xmdhs/authlib-skin/db/ent" + "github.com/xmdhs/authlib-skin/db/ent/migrate" ) 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()) } 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 { return nil, nil, fmt.Errorf("ProvideEnt: %w", err) } diff --git a/server/route/route.go b/server/route/route.go index b9136bf..794a289 100644 --- a/server/route/route.go +++ b/server/route/route.go @@ -23,6 +23,7 @@ func NewRoute(yggService *yggdrasil.Yggdrasil, handel *handle.Handel) (*httprout func newYggdrasil(r *httprouter.Router, handelY yggdrasil.Yggdrasil) error { r.POST("/api/authserver/authenticate", warpHJSON(handelY.Authenticate())) + r.POST("/api/authserver/validate", warpHJSON(handelY.Validate())) return nil }