@jrmc/adonis-attachment 3.2.1 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -142,15 +142,11 @@ export class AttachmentManager {
142
142
  await attachment.getDisk().delete(attachment.path);
143
143
  if (attachment instanceof Attachment) {
144
144
  if (attachment.variants) {
145
- if (attachment.options?.disk == 'fs') {
146
- const variantPath = attachment.variants[0].folder;
147
- await attachment.getDisk().deleteAll(variantPath);
148
- }
149
- else {
150
- for (const key in attachment.variants) {
151
- if (Object.prototype.hasOwnProperty.call(attachment.variants, key)) {
152
- await attachment.getDisk().delete(attachment.variants[key].path);
153
- }
145
+ const variantPath = attachment.variants[0].folder;
146
+ await attachment.getDisk().deleteAll(variantPath); // not compatible Minio, necessary for fs as not to leave an empty directory
147
+ for (const key in attachment.variants) {
148
+ if (Object.prototype.hasOwnProperty.call(attachment.variants, key)) {
149
+ await attachment.getDisk().delete(attachment.variants[key].path);
154
150
  }
155
151
  }
156
152
  }
@@ -1,3 +1,4 @@
1
+ import string from '@adonisjs/core/helpers/string';
1
2
  import db from '@adonisjs/lucid/services/db';
2
3
  import attachmentManager from '../services/main.js';
3
4
  import * as errors from './errors.js';
@@ -32,7 +33,7 @@ export class ConverterManager {
32
33
  }
33
34
  }
34
35
  }
35
- data[this.#attributeName] = JSON.stringify(attachment.toObject());
36
+ data[string.snakeCase(this.#attributeName)] = JSON.stringify(attachment.toObject());
36
37
  const trx = await db.transaction();
37
38
  trx.after('rollback', () => {
38
39
  for (const variant of attachment.variants) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jrmc/adonis-attachment",
3
- "version": "3.2.1",
3
+ "version": "3.2.2",
4
4
  "type": "module",
5
5
  "description": "Turn any field on your Lucid model to an attachment data type",
6
6
  "engines": {