[www] added Image::findByFile
This commit is contained in:
1 parent
6d0b94e3ff
commit
047c934953
1 file changed
+8
@@ -14,6 +14,14 @@ class Image {
|
|||||||
return new Image({...data, artifacts})
|
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}) {
|
constructor({hash, file, artifacts}) {
|
||||||
this.hash = hash
|
this.hash = hash
|
||||||
this.file = file
|
this.file = file
|
||||||
|
|||||||
Reference in new issue
Block a user