Commit 7d60ae94 authored by Дмитрий Малюгин's avatar Дмитрий Малюгин 🕓
Browse files

Merge branch 'feature/divider' into 'main'

Feature/divider

See merge request !4
parents 6dd81b06 e7822db4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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?
+11 −3
Original line number Diff line number Diff line
@@ -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);

@@ -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);
      });
+339 −135

File changed.

Preview size limit exceeded, changes collapsed.