UNPKG

lbx-invoice

Version:

Provides functionality around generating invoices.

139 lines (137 loc) 2.83 kB
import { JsonSchemaWithExtensions, model, property } from '@loopback/repository'; /** * The address data, which can be either a private or a company address. */ @model() export class AddressData { /** * The form of address of the customer. */ @property({ type: 'string', required: true }) formOfAddress: string; /** * The first name of the customer. */ @property({ type: 'string', required: true }) firstName: string; /** * The last name of the customer. */ @property({ type: 'string', required: true }) lastName: string; /** * The email of the customer. * This does NOT have to be the same email where the invoice is sent. * It is required for factur-x or x-rechnung compliant invoices. */ @property({ type: 'string', required: false }) email?: string; /** * The street of the address. */ @property({ type: 'string', required: true }) street: string; /** * The number of the address. */ @property({ type: 'string', required: true }) number: string; /** * The postcode of the address. */ @property({ type: 'string', required: true, minLength: 5, maxLength: 5 }) postcode: string; /** * The city of the address. */ @property({ type: 'string', required: true }) city: string; /** * The country id of the address. * Eg. 'US'. */ @property({ type: 'string', required: true }) countryId: string; /** * Whether or not the address is of a company. */ @property({ type: 'boolean', required: true }) company: boolean; /** * The name of the company. */ @property({ type: 'string', required: false }) companyName?: string; } /** * Json schema for address data. */ export const addressDataJsonSchema: JsonSchemaWithExtensions = { properties: { formOfAddress: { type: 'string' }, firstName: { type: 'string' }, lastName: { type: 'string' }, street: { type: 'string' }, number: { type: 'string' }, postcode: { type: 'string', minLength: 5, maxLength: 5 }, city: { type: 'string' }, company: { type: 'boolean' }, companyName: { type: 'string' } }, required: ['formOfAddress', 'firstName', 'lastName', 'street', 'number', 'postcode', 'city', 'company'] };