MCPcopy Create free account
hub / github.com/53AI/53AIHub / RestoreFile

Function RestoreFile

api/model/file.go:598–613  ·  view source on GitHub ↗

RestoreFile 恢复已删除的文件

(eid int64, fileID int64)

Source from the content-addressed store, hash-verified

596
597// RestoreFile 恢复已删除的文件
598func RestoreFile(eid int64, fileID int64) error {
599 file, err := GetFileByID(eid, fileID)
600 if err != nil {
601 return err
602 }
603 if err := DB.Model(&File{}).Where("eid = ? AND id = ?", eid, fileID).Updates(map[string]interface{}{
604 "is_deleted": false,
605 "is_active_deleted": false,
606 "deleted_by": 0,
607 "deleted_at": 0,
608 }).Error; err != nil {
609 return err
610 }
611 invalidateLibraryFileCountCache(eid, file.LibraryID)
612 return nil
613}
614
615// GetFilesByLibraryID 获取知识库下的所有文件
616func GetFilesByLibraryID(eid int64, libraryID int64) ([]File, error) {

Callers

nothing calls this directly

Calls 2

GetFileByIDFunction · 0.85

Tested by

no test coverage detected