mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 08:22:24 +01:00
fix (share): update model
This commit is contained in:
parent
7fa253f7b1
commit
03daa29917
1 changed files with 17 additions and 0 deletions
|
|
@ -44,6 +44,23 @@ func ShareList(backend string, path string) ([]Share, error) {
|
|||
return sharedFiles, nil
|
||||
}
|
||||
|
||||
func ShareAll() ([]Share, error) {
|
||||
rows, err := DB.Query("SELECT id, related_path, params FROM Share")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sharedFiles := []Share{}
|
||||
for rows.Next() {
|
||||
var a Share
|
||||
var params []byte
|
||||
rows.Scan(&a.Id, &a.Path, ¶ms)
|
||||
json.Unmarshal(params, &a)
|
||||
sharedFiles = append(sharedFiles, a)
|
||||
}
|
||||
rows.Close()
|
||||
return sharedFiles, nil
|
||||
}
|
||||
|
||||
func ShareGet(id string) (Share, error) {
|
||||
var p Share
|
||||
stmt, err := DB.Prepare("SELECT id, related_backend, related_path, auth, params FROM share WHERE id = ?")
|
||||
|
|
|
|||
Loading…
Reference in a new issue