opendata/ts/classes.businessrecord.ts

68 lines
1.6 KiB
TypeScript
Raw Normal View History

2023-11-14 16:15:11 +01:00
import * as plugins from './plugins.js';
@plugins.smartdata.Manager()
export class BusinessRecord extends plugins.smartdata.SmartDataDbDoc<
BusinessRecord,
BusinessRecord
> {
// STATIC
public static getByGermanParsedRegistration = async (parsedGermanRegistrationArg: BusinessRecord['data']['germanParsedRegistration']) => {
const businessRecords = await BusinessRecord.getInstance({
data: {
germanParsedRegistration: parsedGermanRegistrationArg,
}
});
return businessRecords;
};
// INSTANCE
@plugins.smartdata.unI()
id: string;
2023-11-14 16:15:11 +01:00
@plugins.smartdata.svDb()
data: {
name?: string;
startDate?: string;
endDate?: string;
status?: 'active' | 'liquidating' | 'closed';
address?: string;
postalCode?: string;
city?: string;
country?: string;
phone?: string;
fax?: string;
email?: string;
website?: string;
businessType?: string;
registrationId?: string;
germanParsedRegistration?: {
court?: string;
type?: 'HRA' | 'HRB' | 'GnR' | 'PR' | 'VR' | 'GsR';
number?: string;
};
legalForm?:
| 'GmbH'
| 'GmbH & Co. KG'
| 'AG'
| 'LLC'
| 'LLP'
| 'GmbH & Co. KGaA'
| 'GmbH & Co. KGaA, LLC';
managingDirectors?: string[];
boardOfDirectors?: string[];
supervisoryBoard?: string[];
foundingDate?: string;
capital?: string;
purpose?: string;
lastUpdate?: string;
2023-11-14 16:15:11 +01:00
} = {};
/**
* validates the record against the Handelregister.
*/
public async validate() {
if (!this.data.name) throw new Error('Name is required.');
}
}