RestoreFile 恢复已删除的文件
(eid int64, fileID int64)
| 596 | |
| 597 | // RestoreFile 恢复已删除的文件 |
| 598 | func 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 获取知识库下的所有文件 |
| 616 | func GetFilesByLibraryID(eid int64, libraryID int64) ([]File, error) { |
nothing calls this directly
no test coverage detected