mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(api): add admin endpoints for binding management
Implement handlers for creating, listing, and updating model bindings. Register new routes in the admin server group and add DTO definitions. Update provider handlers to trigger binding synchronization on changes to ensure upstream mappings remain current.
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/ez-api/ez-api/internal/model"
|
||||
groupx "github.com/ez-api/foundation/group"
|
||||
"github.com/ez-api/foundation/jsoncodec"
|
||||
"github.com/ez-api/foundation/routing"
|
||||
"github.com/ez-api/foundation/tokenhash"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"gorm.io/gorm"
|
||||
@@ -407,9 +408,11 @@ func (s *SyncService) writeBindingsSnapshot(ctx context.Context, pipe redis.Pipe
|
||||
}
|
||||
|
||||
key := ns + "." + pm
|
||||
if err := s.hsetJSON(ctx, "config:bindings", key, snap); err != nil {
|
||||
return err
|
||||
payload, err := jsoncodec.Marshal(snap)
|
||||
if err != nil {
|
||||
return fmt.Errorf("marshal config:bindings:%s: %w", key, err)
|
||||
}
|
||||
pipe.HSet(ctx, "config:bindings", key, payload)
|
||||
}
|
||||
|
||||
meta := map[string]string{
|
||||
|
||||
Reference in New Issue
Block a user