|
@@ -189,7 +189,9 @@ extension Photo{
|
|
|
photo.file = result?.string(forColumn: "fileName")
|
|
|
photo.key = result?.string(forColumn: "fileKey")
|
|
|
if photo.recovery(){
|
|
|
- photos.append(photo)
|
|
|
+ if self.filter(photo, user){
|
|
|
+ photos.append(photo)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
let keys = photos.map({$0.key}).compactMap({$0}).reversed()
|
|
@@ -204,7 +206,7 @@ extension Photo{
|
|
|
return returnDic
|
|
|
}
|
|
|
|
|
|
- static func allList() -> [String:[Photo]]{
|
|
|
+ static func allList(user:User) -> [String:[Photo]]{
|
|
|
var returnDic:[String:[Photo]]
|
|
|
let contactDB = SqlClient.shared.DB
|
|
|
returnDic = [String:[Photo]]()
|
|
@@ -226,7 +228,9 @@ extension Photo{
|
|
|
photo.key = result?.string(forColumn: "fileKey")
|
|
|
|
|
|
if photo.recovery(){
|
|
|
- photos.append(photo)
|
|
|
+ if self.filter(photo, user){
|
|
|
+ photos.append(photo)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
let keys = photos.map({$0.key}).compactMap({$0}).reversed()
|
|
@@ -240,6 +244,12 @@ extension Photo{
|
|
|
return returnDic
|
|
|
}
|
|
|
|
|
|
+ static func filter(_ photo:Photo, _ user:User) -> Bool {
|
|
|
+ if photo.user?.userId != user.userId{
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|