opencrm/backend/dist/services/customer.service.d.ts

749 lines
21 KiB
TypeScript

import { CustomerType } from '@prisma/client';
export interface CustomerFilters {
search?: string;
type?: CustomerType;
page?: number;
limit?: number;
}
export declare function getAllCustomers(filters: CustomerFilters): Promise<{
customers: ({
addresses: {
id: number;
customerId: number;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.AddressType;
isDefault: boolean;
street: string;
houseNumber: string;
postalCode: string;
city: string;
country: string;
}[];
_count: {
contracts: number;
};
} & {
id: number;
email: string | null;
firstName: string;
lastName: string;
createdAt: Date;
updatedAt: Date;
customerNumber: string;
portalEmail: string | null;
type: import(".prisma/client").$Enums.CustomerType;
salutation: string | null;
companyName: string | null;
foundingDate: Date | null;
birthDate: Date | null;
birthPlace: string | null;
phone: string | null;
mobile: string | null;
taxNumber: string | null;
businessRegistrationPath: string | null;
commercialRegisterPath: string | null;
commercialRegisterNumber: string | null;
privacyPolicyPath: string | null;
notes: string | null;
portalEnabled: boolean;
portalPasswordHash: string | null;
portalPasswordEncrypted: string | null;
portalLastLogin: Date | null;
})[];
pagination: {
page: number;
limit: number;
total: number;
totalPages: number;
};
}>;
export declare function getCustomerById(id: number): Promise<({
addresses: {
id: number;
customerId: number;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.AddressType;
isDefault: boolean;
street: string;
houseNumber: string;
postalCode: string;
city: string;
country: string;
}[];
bankCards: {
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
accountHolder: string;
iban: string;
bic: string | null;
bankName: string | null;
expiryDate: Date | null;
documentPath: string | null;
}[];
identityDocuments: {
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.DocumentType;
expiryDate: Date | null;
documentPath: string | null;
documentNumber: string;
issuingAuthority: string | null;
issueDate: Date | null;
licenseClasses: string | null;
licenseIssueDate: Date | null;
}[];
meters: ({
readings: {
id: number;
createdAt: Date;
notes: string | null;
readingDate: Date;
value: number;
unit: string;
meterId: number;
}[];
} & {
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.MeterType;
meterNumber: string;
location: string | null;
})[];
stressfreiEmails: {
id: number;
email: string;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
notes: string | null;
hasMailbox: boolean;
platform: string | null;
isProvisioned: boolean;
provisionedAt: Date | null;
provisionError: string | null;
emailPasswordEncrypted: string | null;
}[];
contracts: ({
address: {
id: number;
customerId: number;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.AddressType;
isDefault: boolean;
street: string;
houseNumber: string;
postalCode: string;
city: string;
country: string;
} | null;
salesPlatform: {
id: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
name: string;
contactInfo: string | null;
} | null;
} & {
id: number;
customerId: number;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.ContractType;
notes: string | null;
portalPasswordEncrypted: string | null;
startDate: Date | null;
status: import(".prisma/client").$Enums.ContractStatus;
customerNumberAtProvider: string | null;
tariffName: string | null;
providerName: string | null;
contractNumber: string;
contractCategoryId: number | null;
addressId: number | null;
bankCardId: number | null;
identityDocumentId: number | null;
salesPlatformId: number | null;
cancellationPeriodId: number | null;
contractDurationId: number | null;
previousContractId: number | null;
providerId: number | null;
tariffId: number | null;
priceFirst12Months: string | null;
priceFrom13Months: string | null;
priceAfter24Months: string | null;
endDate: Date | null;
commission: number | null;
cancellationLetterPath: string | null;
cancellationConfirmationPath: string | null;
cancellationLetterOptionsPath: string | null;
cancellationConfirmationOptionsPath: string | null;
cancellationConfirmationDate: Date | null;
cancellationConfirmationOptionsDate: Date | null;
wasSpecialCancellation: boolean;
portalUsername: string | null;
stressfreiEmailId: number | null;
})[];
} & {
id: number;
email: string | null;
firstName: string;
lastName: string;
createdAt: Date;
updatedAt: Date;
customerNumber: string;
portalEmail: string | null;
type: import(".prisma/client").$Enums.CustomerType;
salutation: string | null;
companyName: string | null;
foundingDate: Date | null;
birthDate: Date | null;
birthPlace: string | null;
phone: string | null;
mobile: string | null;
taxNumber: string | null;
businessRegistrationPath: string | null;
commercialRegisterPath: string | null;
commercialRegisterNumber: string | null;
privacyPolicyPath: string | null;
notes: string | null;
portalEnabled: boolean;
portalPasswordHash: string | null;
portalPasswordEncrypted: string | null;
portalLastLogin: Date | null;
}) | null>;
export declare function getCustomersByIds(ids: number[]): Promise<{
id: number;
portalEmail: string | null;
}[]>;
export declare function createCustomer(data: {
type?: CustomerType;
salutation?: string;
firstName: string;
lastName: string;
companyName?: string;
birthDate?: Date;
birthPlace?: string;
email?: string;
phone?: string;
mobile?: string;
taxNumber?: string;
businessRegistration?: string;
commercialRegister?: string;
notes?: string;
}): Promise<{
id: number;
email: string | null;
firstName: string;
lastName: string;
createdAt: Date;
updatedAt: Date;
customerNumber: string;
portalEmail: string | null;
type: import(".prisma/client").$Enums.CustomerType;
salutation: string | null;
companyName: string | null;
foundingDate: Date | null;
birthDate: Date | null;
birthPlace: string | null;
phone: string | null;
mobile: string | null;
taxNumber: string | null;
businessRegistrationPath: string | null;
commercialRegisterPath: string | null;
commercialRegisterNumber: string | null;
privacyPolicyPath: string | null;
notes: string | null;
portalEnabled: boolean;
portalPasswordHash: string | null;
portalPasswordEncrypted: string | null;
portalLastLogin: Date | null;
}>;
export declare function updateCustomer(id: number, data: {
type?: CustomerType;
salutation?: string;
firstName?: string;
lastName?: string;
companyName?: string;
birthDate?: Date;
birthPlace?: string;
email?: string;
phone?: string;
mobile?: string;
taxNumber?: string;
businessRegistration?: string;
commercialRegister?: string;
notes?: string;
}): Promise<{
id: number;
email: string | null;
firstName: string;
lastName: string;
createdAt: Date;
updatedAt: Date;
customerNumber: string;
portalEmail: string | null;
type: import(".prisma/client").$Enums.CustomerType;
salutation: string | null;
companyName: string | null;
foundingDate: Date | null;
birthDate: Date | null;
birthPlace: string | null;
phone: string | null;
mobile: string | null;
taxNumber: string | null;
businessRegistrationPath: string | null;
commercialRegisterPath: string | null;
commercialRegisterNumber: string | null;
privacyPolicyPath: string | null;
notes: string | null;
portalEnabled: boolean;
portalPasswordHash: string | null;
portalPasswordEncrypted: string | null;
portalLastLogin: Date | null;
}>;
export declare function deleteCustomer(id: number): Promise<{
id: number;
email: string | null;
firstName: string;
lastName: string;
createdAt: Date;
updatedAt: Date;
customerNumber: string;
portalEmail: string | null;
type: import(".prisma/client").$Enums.CustomerType;
salutation: string | null;
companyName: string | null;
foundingDate: Date | null;
birthDate: Date | null;
birthPlace: string | null;
phone: string | null;
mobile: string | null;
taxNumber: string | null;
businessRegistrationPath: string | null;
commercialRegisterPath: string | null;
commercialRegisterNumber: string | null;
privacyPolicyPath: string | null;
notes: string | null;
portalEnabled: boolean;
portalPasswordHash: string | null;
portalPasswordEncrypted: string | null;
portalLastLogin: Date | null;
}>;
export declare function getCustomerAddresses(customerId: number): Promise<{
id: number;
customerId: number;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.AddressType;
isDefault: boolean;
street: string;
houseNumber: string;
postalCode: string;
city: string;
country: string;
}[]>;
export declare function createAddress(customerId: number, data: {
type: 'DELIVERY_RESIDENCE' | 'BILLING';
street: string;
houseNumber: string;
postalCode: string;
city: string;
country?: string;
isDefault?: boolean;
}): Promise<{
id: number;
customerId: number;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.AddressType;
isDefault: boolean;
street: string;
houseNumber: string;
postalCode: string;
city: string;
country: string;
}>;
export declare function updateAddress(id: number, data: {
type?: 'DELIVERY_RESIDENCE' | 'BILLING';
street?: string;
houseNumber?: string;
postalCode?: string;
city?: string;
country?: string;
isDefault?: boolean;
}): Promise<{
id: number;
customerId: number;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.AddressType;
isDefault: boolean;
street: string;
houseNumber: string;
postalCode: string;
city: string;
country: string;
}>;
export declare function deleteAddress(id: number): Promise<{
id: number;
customerId: number;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.AddressType;
isDefault: boolean;
street: string;
houseNumber: string;
postalCode: string;
city: string;
country: string;
}>;
export declare function getCustomerBankCards(customerId: number, showInactive?: boolean): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
accountHolder: string;
iban: string;
bic: string | null;
bankName: string | null;
expiryDate: Date | null;
documentPath: string | null;
}[]>;
export declare function createBankCard(customerId: number, data: {
accountHolder: string;
iban: string;
bic?: string;
bankName?: string;
expiryDate?: Date;
}): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
accountHolder: string;
iban: string;
bic: string | null;
bankName: string | null;
expiryDate: Date | null;
documentPath: string | null;
}>;
export declare function updateBankCard(id: number, data: {
accountHolder?: string;
iban?: string;
bic?: string;
bankName?: string;
expiryDate?: Date;
isActive?: boolean;
}): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
accountHolder: string;
iban: string;
bic: string | null;
bankName: string | null;
expiryDate: Date | null;
documentPath: string | null;
}>;
export declare function deleteBankCard(id: number): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
accountHolder: string;
iban: string;
bic: string | null;
bankName: string | null;
expiryDate: Date | null;
documentPath: string | null;
}>;
export declare function getCustomerDocuments(customerId: number, showInactive?: boolean): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.DocumentType;
expiryDate: Date | null;
documentPath: string | null;
documentNumber: string;
issuingAuthority: string | null;
issueDate: Date | null;
licenseClasses: string | null;
licenseIssueDate: Date | null;
}[]>;
export declare function createDocument(customerId: number, data: {
type: 'ID_CARD' | 'PASSPORT' | 'DRIVERS_LICENSE' | 'OTHER';
documentNumber: string;
issuingAuthority?: string;
issueDate?: Date;
expiryDate?: Date;
licenseClasses?: string;
licenseIssueDate?: Date;
}): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.DocumentType;
expiryDate: Date | null;
documentPath: string | null;
documentNumber: string;
issuingAuthority: string | null;
issueDate: Date | null;
licenseClasses: string | null;
licenseIssueDate: Date | null;
}>;
export declare function updateDocument(id: number, data: {
type?: 'ID_CARD' | 'PASSPORT' | 'DRIVERS_LICENSE' | 'OTHER';
documentNumber?: string;
issuingAuthority?: string;
issueDate?: Date;
expiryDate?: Date;
licenseClasses?: string;
licenseIssueDate?: Date;
isActive?: boolean;
}): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.DocumentType;
expiryDate: Date | null;
documentPath: string | null;
documentNumber: string;
issuingAuthority: string | null;
issueDate: Date | null;
licenseClasses: string | null;
licenseIssueDate: Date | null;
}>;
export declare function deleteDocument(id: number): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.DocumentType;
expiryDate: Date | null;
documentPath: string | null;
documentNumber: string;
issuingAuthority: string | null;
issueDate: Date | null;
licenseClasses: string | null;
licenseIssueDate: Date | null;
}>;
export declare function getCustomerMeters(customerId: number, showInactive?: boolean): Promise<({
readings: {
id: number;
createdAt: Date;
notes: string | null;
readingDate: Date;
value: number;
unit: string;
meterId: number;
}[];
} & {
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.MeterType;
meterNumber: string;
location: string | null;
})[]>;
export declare function createMeter(customerId: number, data: {
meterNumber: string;
type: 'ELECTRICITY' | 'GAS';
location?: string;
}): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.MeterType;
meterNumber: string;
location: string | null;
}>;
export declare function updateMeter(id: number, data: {
meterNumber?: string;
type?: 'ELECTRICITY' | 'GAS';
location?: string;
isActive?: boolean;
}): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.MeterType;
meterNumber: string;
location: string | null;
}>;
export declare function deleteMeter(id: number): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
type: import(".prisma/client").$Enums.MeterType;
meterNumber: string;
location: string | null;
}>;
export declare function addMeterReading(meterId: number, data: {
readingDate: Date;
value: number;
unit?: string;
notes?: string;
}): Promise<{
id: number;
createdAt: Date;
notes: string | null;
readingDate: Date;
value: number;
unit: string;
meterId: number;
}>;
export declare function getMeterReadings(meterId: number): Promise<{
id: number;
createdAt: Date;
notes: string | null;
readingDate: Date;
value: number;
unit: string;
meterId: number;
}[]>;
export declare function updateMeterReading(meterId: number, readingId: number, data: {
readingDate?: Date;
value?: number;
unit?: string;
notes?: string;
}): Promise<{
id: number;
createdAt: Date;
notes: string | null;
readingDate: Date;
value: number;
unit: string;
meterId: number;
}>;
export declare function deleteMeterReading(meterId: number, readingId: number): Promise<{
id: number;
createdAt: Date;
notes: string | null;
readingDate: Date;
value: number;
unit: string;
meterId: number;
}>;
export declare function updatePortalSettings(customerId: number, data: {
portalEnabled?: boolean;
portalEmail?: string | null;
}): Promise<{
id: number;
portalEmail: string | null;
portalEnabled: boolean;
portalLastLogin: Date | null;
}>;
export declare function getPortalSettings(customerId: number): Promise<{
id: number;
portalEmail: string | null;
portalEnabled: boolean;
portalPasswordHash: string | null;
portalLastLogin: Date | null;
} | null>;
export declare function getCustomerRepresentatives(customerId: number): Promise<({
customer: {
id: number;
firstName: string;
lastName: string;
customerNumber: string;
type: import(".prisma/client").$Enums.CustomerType;
companyName: string | null;
};
} & {
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
notes: string | null;
representativeId: number;
})[]>;
export declare function getRepresentedByList(customerId: number): Promise<({
representative: {
id: number;
firstName: string;
lastName: string;
customerNumber: string;
type: import(".prisma/client").$Enums.CustomerType;
companyName: string | null;
};
} & {
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
notes: string | null;
representativeId: number;
})[]>;
export declare function addRepresentative(customerId: number, // Der Kunde, dessen Verträge eingesehen werden dürfen
representativeId: number, // Der Kunde, der einsehen darf
notes?: string): Promise<{
representative: {
id: number;
firstName: string;
lastName: string;
customerNumber: string;
type: import(".prisma/client").$Enums.CustomerType;
companyName: string | null;
};
} & {
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
notes: string | null;
representativeId: number;
}>;
export declare function removeRepresentative(customerId: number, representativeId: number): Promise<{
id: number;
customerId: number;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
notes: string | null;
representativeId: number;
}>;
export declare function searchCustomersForRepresentative(search: string, excludeCustomerId: number): Promise<{
id: number;
firstName: string;
lastName: string;
customerNumber: string;
type: import(".prisma/client").$Enums.CustomerType;
companyName: string | null;
}[]>;
//# sourceMappingURL=customer.service.d.ts.map