@@ -2,8 +2,7 @@ const sequelize = require('sequelize');
22const { Op } = sequelize ;
33
44module . exports = ( Model , App ) => {
5- const CreateThumbnail = async ( user , thumbnail ) => {
6-
5+ const CreateThumbnail = async ( user , thumbnail , file ) => {
76 const thumbnailExists = await Model . thumbnail . findOne ( {
87 where : {
98 file_id : { [ Op . eq ] : thumbnail . file_id } ,
@@ -13,6 +12,7 @@ module.exports = (Model, App) => {
1312
1413 const thumbnailInfo = {
1514 file_id : thumbnail . file_id ,
15+ file_uuid : file . uuid ,
1616 type : thumbnail . type ,
1717 max_width : thumbnail . max_width ,
1818 max_height : thumbnail . max_height ,
@@ -27,17 +27,14 @@ module.exports = (Model, App) => {
2727 if ( thumbnailExists ) {
2828 thumbnailInfo . updated_at = new Date ( ) ;
2929 await App . services . Inxt . DeleteFile ( user , thumbnailExists . bucket_id , thumbnailExists . bucket_file ) ;
30- await Model . thumbnail . update (
31- thumbnailInfo ,
32- {
33- where : {
34- file_id : { [ Op . eq ] : thumbnail . file_id } ,
35- max_width : { [ Op . eq ] : thumbnail . max_width } ,
36- max_height : { [ Op . eq ] : thumbnail . max_height } ,
37- type : { [ Op . eq ] : thumbnail . type } ,
38- }
30+ await Model . thumbnail . update ( thumbnailInfo , {
31+ where : {
32+ file_id : { [ Op . eq ] : thumbnail . file_id } ,
33+ max_width : { [ Op . eq ] : thumbnail . max_width } ,
34+ max_height : { [ Op . eq ] : thumbnail . max_height } ,
35+ type : { [ Op . eq ] : thumbnail . type } ,
3936 } ,
40- ) ;
37+ } ) ;
4138 return await Model . thumbnail . findOne ( {
4239 where : {
4340 file_id : { [ Op . eq ] : thumbnail . file_id } ,
0 commit comments