feat: import resources from csv/xlsx

This commit is contained in:
Ahmed Bouhuolia
2024-03-11 00:21:36 +02:00
parent 1fc6445123
commit 90b4f3ef6d
16 changed files with 467 additions and 184 deletions

View File

@@ -0,0 +1,41 @@
import TenantModel from 'models/TenantModel';
export default class Import extends TenantModel {
mapping!: string;
/**
* Table name.
*/
static get tableName() {
return 'imports';
}
/**
* Virtual attributes.
*/
static get virtualAttributes() {
return ['mappingParsed'];
}
/**
* Timestamps columns.
*/
get timestamps() {
return [];
}
/**
* Relationship mapping.
*/
static get relationMappings() {
return {};
}
public get mappingParsed() {
try {
return JSON.parse(this.mapping);
} catch {
return [];
}
}
}