Loading prisma/schema.prisma +2 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ model Home_entity { entity_uuid String @id @default(uuid()) entity_order Int @default(autoincrement()) entity_type String divider_height Int? divider_type String? title String? text String? @db.Text font_size String? Loading src/services/homeService.js +11 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ class HomeService { const blob = await response.blob(); const arrayBuffer = await blob.arrayBuffer(); const buffer = Buffer.from(arrayBuffer); const extension = body.extension.split('/')[1]; const imagePath = path.join(path.resolve(), `/public/images/backgrounds/homeBackground.jpg`); fs.writeFileSync(imagePath, buffer); Loading Loading @@ -74,10 +73,19 @@ class HomeService { async createEntity(body) { if (body.image_buffer) { const imagePath = path.join(path.resolve(), `/public/images/image.jpg`); let newImagePath = imagePath.split('/'); let newImagePath; if (process.platform.includes('win')) { newImagePath = imagePath.split('\\'); } else { newImagePath = imagePath.split('/'); } newImagePath.splice(-1); newImagePath.push(`${body.entity_uuid}.jpg`); if (process.platform.includes('win')) { newImagePath = newImagePath.join('\\'); } else { newImagePath = newImagePath.join('/'); } fs.rename(imagePath, newImagePath, function (err) { if (err) console.log('ERROR in fs.rename: ' + err); }); Loading yarn.lock +339 −135 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
prisma/schema.prisma +2 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ model Home_entity { entity_uuid String @id @default(uuid()) entity_order Int @default(autoincrement()) entity_type String divider_height Int? divider_type String? title String? text String? @db.Text font_size String? Loading
src/services/homeService.js +11 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ class HomeService { const blob = await response.blob(); const arrayBuffer = await blob.arrayBuffer(); const buffer = Buffer.from(arrayBuffer); const extension = body.extension.split('/')[1]; const imagePath = path.join(path.resolve(), `/public/images/backgrounds/homeBackground.jpg`); fs.writeFileSync(imagePath, buffer); Loading Loading @@ -74,10 +73,19 @@ class HomeService { async createEntity(body) { if (body.image_buffer) { const imagePath = path.join(path.resolve(), `/public/images/image.jpg`); let newImagePath = imagePath.split('/'); let newImagePath; if (process.platform.includes('win')) { newImagePath = imagePath.split('\\'); } else { newImagePath = imagePath.split('/'); } newImagePath.splice(-1); newImagePath.push(`${body.entity_uuid}.jpg`); if (process.platform.includes('win')) { newImagePath = newImagePath.join('\\'); } else { newImagePath = newImagePath.join('/'); } fs.rename(imagePath, newImagePath, function (err) { if (err) console.log('ERROR in fs.rename: ' + err); }); Loading