完善域名服务器项目归属与数据库关联约束
保存资源项目、所有者和操作人,接口从会话记录归属,普通更新保留创建信息。 新增三库第十一版迁移、同项目绑定约束和 SQLite 触发器保护,补充迁移回滚重试、仓储、接口及备份恢复测试。 本次整理验证:后端构建、静态检查、关联改造针对性测试和 CLI 包测试通过。 范围说明:项目成员权限及其他资源归属尚未完成;本次未重新执行外部数据库实库、独立程序及生产部署验收。
This commit is contained in:
1 parent
059e6d7b67
commit
7284958819
22 files changed
+815
-27
No files matched your search
@@ -546,6 +546,7 @@ func (s *Server) createDomain(c *gin.Context) {
|
||||
s.writeError(c, http.StatusBadRequest, err.Error(), err)
|
||||
return
|
||||
}
|
||||
item.ResourceScope = s.newResourceScope(c)
|
||||
if err := s.repository.Create(c.Request.Context(), item); err != nil {
|
||||
if repository.IsConflict(err) {
|
||||
s.writeError(c, http.StatusConflict, "域名已经存在", err)
|
||||
@@ -585,6 +586,7 @@ func (s *Server) updateDomain(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
item.ID = existing.ID
|
||||
item.ResourceScope = s.updatedResourceScope(c, existing.ResourceScope)
|
||||
item.CreatedAt = existing.CreatedAt
|
||||
item.Status = "pending"
|
||||
item.ExpiresAt = nil
|
||||
@@ -702,6 +704,7 @@ func (s *Server) createServer(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
item := serverFromRequest(request)
|
||||
item.ResourceScope = s.newResourceScope(c)
|
||||
item = item.Normalize()
|
||||
now := time.Now().UTC()
|
||||
item.CreatedAt = now
|
||||
@@ -754,6 +757,7 @@ func (s *Server) updateServer(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
item.CreatedAt = existing.CreatedAt
|
||||
item.ResourceScope = s.updatedResourceScope(c, existing.ResourceScope)
|
||||
item.UpdatedAt = time.Now().UTC()
|
||||
item, cleanup, err := s.prepareServerCredential(c.Request.Context(), item, request.Password, &existing)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user