feat(canvas): 画布资源 - 缩略图字段与缓存加载支持
This commit is contained in:
1 parent
a0ba303b02
commit
e10f32ecaf
9 files changed
+312
-101
No files matched your search
@@ -1008,6 +1008,14 @@ func (r *Repository) SaveResource(resource *model.Resource) error {
|
||||
return r.db.Save(resource).Error
|
||||
}
|
||||
|
||||
// UpdateResourceThumbnail only updates a still-ready row and cannot resurrect a deleted resource.
|
||||
func (r *Repository) UpdateResourceThumbnail(userID string, id string, values map[string]any) (bool, error) {
|
||||
result := r.db.Model(&model.Resource{}).
|
||||
Where("id = ? AND user_id = ? AND status = ?", id, userID, model.ResourceStatusReady).
|
||||
Updates(values)
|
||||
return result.RowsAffected == 1, result.Error
|
||||
}
|
||||
|
||||
func (r *Repository) ResourceByUploadKey(userID string, uploadKey string) (*model.Resource, error) {
|
||||
var resource model.Resource
|
||||
if err := r.db.First(&resource, "user_id = ? AND upload_key = ?", userID, uploadKey).Error; err != nil {
|
||||
|
||||
Reference in new issue
Block a user