[www] added Image::findByFile

This commit is contained in:
Roman Timashev committed 2017-10-15 02:12:19 +03:00
1 parent 6d0b94e3ff
commit 047c934953
1 file changed
+8
+8
View File
@@ -14,6 +14,14 @@ class Image {
return new Image({...data, artifacts})
}
static async findByFile(file) {
const data = await findOne(store(), {file})
if (!data) return null
const artifacts = data.data
return new Image({...data, artifacts})
}
constructor({hash, file, artifacts}) {
this.hash = hash
this.file = file