@jrmc/adonis-attachment
Version:
Turn any field on your Lucid model to an attachment data type
30 lines (29 loc) • 891 B
JavaScript
import { AttachmentRecordService } from '../src/services/attachment/index.js';
export default class RegenerateService {
model(Model, options = {}) {
this.
this.
return this;
}
row(row, options = {}) {
this.
this.
return this;
}
async run() {
if (this.
const record = new AttachmentRecordService(this.
return record.regenerateVariants(this.
}
else if (this.
const entities = await this.
return Promise.all(entities.map(async (entity) => {
const record = new AttachmentRecordService(entity);
return record.regenerateVariants(this.
}));
}
}
}