feat(canvas): 条件读取与历史 - 减少画布同步传输并校准版本
This commit is contained in:
1 parent
bcccddb4e9
commit
6ad1adc197
17 files changed
+783
-25
No files matched your search
@@ -0,0 +1,15 @@
|
||||
package repository
|
||||
|
||||
import "infinite-canvas/backend/internal/model"
|
||||
|
||||
// CanvasProjectMetadataForUser reads only fields needed to validate a cached
|
||||
// canvas representation, avoiding the large JSON body when the caller's ETag
|
||||
// is still current.
|
||||
func (r *Repository) CanvasProjectMetadataForUser(userID string, id string) (*model.CanvasProject, error) {
|
||||
var project model.CanvasProject
|
||||
if err := r.db.Select("id", "user_id", "project_id", "title", "revision", "created_at", "updated_at").
|
||||
First(&project, "id = ? AND user_id = ?", id, userID).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &project, nil
|
||||
}
|
||||
Reference in new issue
Block a user