fix(api): enforce project identifier uniqueness

This commit is contained in:
2026-07-21 14:41:30 +08:00
parent 5341b44cc5
commit 14a140985c
6 changed files with 89 additions and 31 deletions

View File

@@ -8,7 +8,8 @@ import (
var DBService *gorm.DB
func New(dsn string) error {
db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
// 启用 Gorm 跨驱动错误翻译,业务层无需解析 Postgres 错误文本或 SQLSTATE。
db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{TranslateError: true})
if err != nil {
return err
}