mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat: import resources from csv/xlsx
This commit is contained in:
41
packages/server/src/models/Import.ts
Normal file
41
packages/server/src/models/Import.ts
Normal 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 [];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user