fix: 删除机器、数据库时关联的标签未删除

This commit is contained in:
meilin.huang
2023-12-13 14:01:13 +08:00
parent 8faf1831d9
commit 73986a834c
15 changed files with 358 additions and 55 deletions

View File

@@ -51,8 +51,20 @@ func (d *mongoAppImpl) GetPageList(condition *entity.MongoQuery, pageParam *mode
}
func (d *mongoAppImpl) Delete(ctx context.Context, id uint64) error {
mongoEntity, err := d.GetById(new(entity.Mongo), id)
if err != nil {
return errorx.NewBiz("mongo信息不存在")
}
mgm.CloseConn(id)
return d.GetRepo().DeleteById(ctx, id)
return d.Tx(ctx,
func(ctx context.Context) error {
return d.DeleteById(ctx, id)
},
func(ctx context.Context) error {
var tagIds []uint64
return d.tagApp.RelateResource(ctx, mongoEntity.Code, consts.TagResourceTypeMongo, tagIds)
})
}
func (d *mongoAppImpl) TestConn(me *entity.Mongo) error {