fix(media): 签名资源下载 - 补全资源查询并修复后端生产构建

This commit is contained in:
ddCat
2026-08-04 22:17:51 +08:00
parent fb29a0f87d
commit 0552731cb5
2 changed files with 10 additions and 0 deletions

View File

@@ -2,6 +2,8 @@
## Unreleased
- 修复匿名签名资源下载缺少 repository 查询方法导致的后端生产构建失败。
## v1.0.37
- 管理后台模型能力与请求协议改为品牌卡片单选,提升配置辨识度与操作一致性。

View File

@@ -678,6 +678,14 @@ func (r *Repository) SaveResource(resource *model.Resource) error {
return r.db.Save(resource).Error
}
func (r *Repository) Resource(id string) (*model.Resource, error) {
var resource model.Resource
if err := r.db.First(&resource, "id = ?", id).Error; err != nil {
return nil, err
}
return &resource, nil
}
func (r *Repository) ResourceForUser(userID string, id string) (*model.Resource, error) {
var resource model.Resource
if err := r.db.First(&resource, "id = ? AND user_id = ?", id, userID).Error; err != nil {