go-duck-cli 1.1.35 → 1.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -217,6 +217,8 @@ find api -name "*.proto" -exec protoc --proto_path=. \\
217
217
  echo "✅ Protos compiled successfully!"
218
218
  `;
219
219
  const generateBat = `@echo off
220
+ setlocal enabledelayedexpansion
221
+
220
222
  echo 🦆 Syncing Protobuf Dependencies...
221
223
  if not exist "third_party\\google\\api" mkdir "third_party\\google\\api"
222
224
  curl -sSL https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/annotations.proto > third_party\\google\\api\\annotations.proto
@@ -230,7 +232,13 @@ if %errorlevel% neq 0 (
230
232
  )
231
233
 
232
234
  for /f "tokens=*" %%f in ('dir /b /s api\\*.proto') do (
233
- protoc --proto_path=. --proto_path=./api --proto_path=./third_party --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:. "%%f"
235
+ set "abspath=%%f"
236
+ set "relpath=!abspath:%CD%\\=!"
237
+ protoc --proto_path=. --proto_path=./api --proto_path=./third_party --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:. "!relpath!"
238
+ if !errorlevel! neq 0 (
239
+ echo ❌ Error: Failed to compile !relpath!
240
+ exit /b 1
241
+ )
234
242
  )
235
243
 
236
244
  echo ✅ Protos compiled successfully!
@@ -308,7 +316,11 @@ func TenantServerInterceptor(conf *config.Config, db *gorm.DB) middleware.Middle
308
316
  db.Raw("SELECT role_name, db_name, is_primary FROM tenant_roles WHERE LOWER(role_name) IN ? AND tenant_id = ?", lowerRoles, requestedTenant).Scan(&mappings)
309
317
  }
310
318
  } else {
311
- db.Raw("SELECT role_name, db_name, is_primary FROM tenant_roles WHERE LOWER(role_name) IN ?", lowerRoles).Scan(&mappings)
319
+ if isAdmin {
320
+ db.Raw("SELECT role_name, db_name, is_primary FROM tenant_roles").Scan(&mappings)
321
+ } else {
322
+ db.Raw("SELECT role_name, db_name, is_primary FROM tenant_roles WHERE LOWER(role_name) IN ?", lowerRoles).Scan(&mappings)
323
+ }
312
324
  }
313
325
 
314
326
  siloConnections := make(map[string]*gorm.DB)
@@ -179,7 +179,11 @@ func TenantMiddleware(db *gorm.DB, cfg *config.Config) gin.HandlerFunc {
179
179
  db.Raw("SELECT role_name, db_name, is_primary FROM tenant_roles WHERE LOWER(role_name) IN ? AND tenant_id IN ?", lowerRoles, requestedTenants).Scan(&mappings)
180
180
  }
181
181
  } else {
182
- db.Raw("SELECT role_name, db_name, is_primary FROM tenant_roles WHERE LOWER(role_name) IN ?", lowerRoles).Scan(&mappings)
182
+ if isAdmin {
183
+ db.Raw("SELECT role_name, db_name, is_primary FROM tenant_roles").Scan(&mappings)
184
+ } else {
185
+ db.Raw("SELECT role_name, db_name, is_primary FROM tenant_roles WHERE LOWER(role_name) IN ?", lowerRoles).Scan(&mappings)
186
+ }
183
187
  }
184
188
 
185
189
  // Filter out unauthorized mappings (e.g. admin_db for non-admins)
@@ -299,6 +303,8 @@ func PublicTenantMiddleware(db *gorm.DB, cfg *config.Config) gin.HandlerFunc {
299
303
  var mappings []models.TenantRole
300
304
  if len(requestedTenants) > 0 {
301
305
  db.Raw("SELECT db_name, is_primary FROM tenant_roles WHERE tenant_id IN ?", requestedTenants).Scan(&mappings)
306
+ } else {
307
+ db.Raw("SELECT db_name, is_primary FROM tenant_roles ORDER BY is_primary DESC, id ASC LIMIT 1").Scan(&mappings)
302
308
  }
303
309
 
304
310
  dbName := fallbackDB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "go-duck-cli",
3
- "version": "1.1.35",
3
+ "version": "1.1.37",
4
4
  "description": "The Ultimate Evolutionary Go Microservice Scaffolder.",
5
5
  "main": "index.js",
6
6
  "type": "module",