From 321d13d8f27ca04f0aa41aaecd5634398141b24c Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Tue, 14 Nov 2023 21:21:19 +0100 Subject: [PATCH 01/15] FEAT: created permanent delete methods in account.service.ts & auth.service.ts. --- apps/api/src/account/account.controller.ts | 2 +- apps/api/src/account/account.service.ts | 4 ++++ apps/api/src/auth/auth.service.ts | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/api/src/account/account.controller.ts b/apps/api/src/account/account.controller.ts index 14c7c07f7..99438fb51 100644 --- a/apps/api/src/account/account.controller.ts +++ b/apps/api/src/account/account.controller.ts @@ -71,7 +71,7 @@ export class AccountController { @Delete('me') async disableUser(@AuthenticatedUser() user: KeycloakTokenParsed) { try { - return await this.accountService.disableUser(user) + return await this.accountService.permanentDeleteUser(user) } catch (err) { Logger.error(`Failed to disable user with keycloakId ${user.sub}. Error is: ${err}`) throw err diff --git a/apps/api/src/account/account.service.ts b/apps/api/src/account/account.service.ts index 10f70d43a..c67ce585c 100644 --- a/apps/api/src/account/account.service.ts +++ b/apps/api/src/account/account.service.ts @@ -28,6 +28,10 @@ export class AccountService { return await this.authService.changeEnabledStatus(user.sub, false) } + async permanentDeleteUser(user: KeycloakTokenParsed){ + return await this.authService.permanentDeleteUser(user.sub) + } + async changeProfileActivationStatus(keycloakId: string, newStatus: boolean) { return await this.authService.changeEnabledStatus(keycloakId, newStatus) } diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index bdad5b727..c90512be1 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -426,4 +426,15 @@ export class AuthService { ) } } + + async permanentDeleteUser(keycloakId: string){ + await this.authenticateAdmin() + + return await Promise.all([ + this.admin.users.del({ id: keycloakId }), + this.prismaService.person.delete({ + where: {keycloakId} + }) + ]) + } } From 3027d0ca9476d95b86e60b242f9f59cb6a20d54f Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Tue, 14 Nov 2023 21:28:11 +0100 Subject: [PATCH 02/15] CHORE: DB entities --- .../affiliate/dto/connect-affiliate.dto.ts | 12 +- .../affiliate/dto/create-affiliate.dto.ts | 8 +- .../domain/generated/affiliate/dto/index.ts | 7 +- .../affiliate/dto/update-affiliate.dto.ts | 8 +- .../affiliate/entities/affiliate.entity.ts | 24 ++-- .../generated/affiliate/entities/index.ts | 3 +- .../dto/connect-bankAccount.dto.ts | 8 +- .../bankAccount/dto/create-bankAccount.dto.ts | 22 ++-- .../domain/generated/bankAccount/dto/index.ts | 7 +- .../bankAccount/dto/update-bankAccount.dto.ts | 22 ++-- .../entities/bankAccount.entity.ts | 28 ++-- .../generated/bankAccount/entities/index.ts | 3 +- .../dto/connect-bankTransaction.dto.ts | 8 +- .../dto/create-bankTransaction.dto.ts | 40 +++--- .../generated/bankTransaction/dto/index.ts | 7 +- .../dto/update-bankTransaction.dto.ts | 38 +++--- .../entities/bankTransaction.entity.ts | 36 +++--- .../bankTransaction/entities/index.ts | 3 +- .../dto/connect-bankTransactionsFile.dto.ts | 8 +- .../bankTransactionsFile/dto/index.ts | 7 +- .../entities/bankTransactionsFile.entity.ts | 16 ++- .../bankTransactionsFile/entities/index.ts | 3 +- .../benefactor/dto/connect-benefactor.dto.ts | 10 +- .../benefactor/dto/create-benefactor.dto.ts | 8 +- .../domain/generated/benefactor/dto/index.ts | 7 +- .../benefactor/dto/update-benefactor.dto.ts | 8 +- .../benefactor/entities/benefactor.entity.ts | 16 ++- .../generated/benefactor/entities/index.ts | 3 +- .../dto/connect-beneficiary.dto.ts | 8 +- .../beneficiary/dto/create-beneficiary.dto.ts | 28 ++-- .../domain/generated/beneficiary/dto/index.ts | 7 +- .../beneficiary/dto/update-beneficiary.dto.ts | 28 ++-- .../entities/beneficiary.entity.ts | 58 +++++---- .../generated/beneficiary/entities/index.ts | 3 +- .../campaign/dto/connect-campaign.dto.ts | 12 +- .../campaign/dto/create-campaign.dto.ts | 24 ++-- .../domain/generated/campaign/dto/index.ts | 7 +- .../campaign/dto/update-campaign.dto.ts | 24 ++-- .../campaign/entities/campaign.entity.ts | 108 ++++++++-------- .../generated/campaign/entities/index.ts | 3 +- .../dto/connect-campaignFile.dto.ts | 8 +- .../dto/create-campaignFile.dto.ts | 16 ++- .../generated/campaignFile/dto/index.ts | 7 +- .../dto/update-campaignFile.dto.ts | 16 ++- .../entities/campaignFile.entity.ts | 24 ++-- .../generated/campaignFile/entities/index.ts | 3 +- .../dto/connect-campaignNews.dto.ts | 10 +- .../dto/create-campaignNews.dto.ts | 20 ++- .../generated/campaignNews/dto/index.ts | 7 +- .../dto/update-campaignNews.dto.ts | 20 ++- .../entities/campaignNews.entity.ts | 40 +++--- .../generated/campaignNews/entities/index.ts | 3 +- .../dto/connect-campaignNewsFile.dto.ts | 8 +- .../dto/create-campaignNewsFile.dto.ts | 16 ++- .../generated/campaignNewsFile/dto/index.ts | 7 +- .../dto/update-campaignNewsFile.dto.ts | 16 ++- .../entities/campaignNewsFile.entity.ts | 24 ++-- .../campaignNewsFile/entities/index.ts | 3 +- .../dto/connect-campaignType.dto.ts | 10 +- .../dto/create-campaignType.dto.ts | 12 +- .../generated/campaignType/dto/index.ts | 7 +- .../dto/update-campaignType.dto.ts | 12 +- .../entities/campaignType.entity.ts | 24 ++-- .../generated/campaignType/entities/index.ts | 3 +- .../generated/city/dto/connect-city.dto.ts | 10 +- .../generated/city/dto/create-city.dto.ts | 10 +- .../src/domain/generated/city/dto/index.ts | 7 +- .../generated/city/dto/update-city.dto.ts | 10 +- .../generated/city/entities/city.entity.ts | 18 +-- .../domain/generated/city/entities/index.ts | 3 +- .../company/dto/connect-company.dto.ts | 12 +- .../company/dto/create-company.dto.ts | 18 ++- .../src/domain/generated/company/dto/index.ts | 7 +- .../company/dto/update-company.dto.ts | 18 ++- .../company/entities/company.entity.ts | 36 +++--- .../generated/company/entities/index.ts | 3 +- .../dto/connect-coordinator.dto.ts | 10 +- .../coordinator/dto/create-coordinator.dto.ts | 10 +- .../domain/generated/coordinator/dto/index.ts | 7 +- .../coordinator/dto/update-coordinator.dto.ts | 10 +- .../entities/coordinator.entity.ts | 22 ++-- .../generated/coordinator/entities/index.ts | 3 +- .../country/dto/connect-country.dto.ts | 10 +- .../country/dto/create-country.dto.ts | 10 +- .../src/domain/generated/country/dto/index.ts | 7 +- .../country/dto/update-country.dto.ts | 10 +- .../country/entities/country.entity.ts | 12 +- .../generated/country/entities/index.ts | 3 +- .../document/dto/connect-document.dto.ts | 8 +- .../document/dto/create-document.dto.ts | 22 ++-- .../domain/generated/document/dto/index.ts | 7 +- .../document/dto/update-document.dto.ts | 22 ++-- .../document/entities/document.entity.ts | 28 ++-- .../generated/document/entities/index.ts | 3 +- .../donation/dto/connect-donation.dto.ts | 10 +- .../donation/dto/create-donation.dto.ts | 22 ++-- .../domain/generated/donation/dto/index.ts | 7 +- .../donation/dto/update-donation.dto.ts | 22 ++-- .../donation/entities/donation.entity.ts | 58 +++++---- .../generated/donation/entities/index.ts | 3 +- .../dto/connect-donationMetadata.dto.ts | 8 +- .../dto/create-donationMetadata.dto.ts | 10 +- .../generated/donationMetadata/dto/index.ts | 7 +- .../dto/update-donationMetadata.dto.ts | 10 +- .../entities/donationMetadata.entity.ts | 16 ++- .../donationMetadata/entities/index.ts | 3 +- .../dto/connect-donationWish.dto.ts | 10 +- .../dto/create-donationWish.dto.ts | 8 +- .../generated/donationWish/dto/index.ts | 7 +- .../dto/update-donationWish.dto.ts | 8 +- .../entities/donationWish.entity.ts | 28 ++-- .../generated/donationWish/entities/index.ts | 3 +- .../dto/connect-emailSentRegistry.dto.ts | 8 +- .../dto/create-emailSentRegistry.dto.ts | 18 ++- .../generated/emailSentRegistry/dto/index.ts | 7 +- .../dto/update-emailSentRegistry.dto.ts | 18 ++- .../entities/emailSentRegistry.entity.ts | 14 +- .../emailSentRegistry/entities/index.ts | 3 +- .../expense/dto/connect-expense.dto.ts | 8 +- .../expense/dto/create-expense.dto.ts | 18 ++- .../src/domain/generated/expense/dto/index.ts | 7 +- .../expense/dto/update-expense.dto.ts | 18 ++- .../expense/entities/expense.entity.ts | 42 +++--- .../generated/expense/entities/index.ts | 3 +- .../dto/connect-expenseFile.dto.ts | 8 +- .../expenseFile/dto/create-expenseFile.dto.ts | 10 +- .../domain/generated/expenseFile/dto/index.ts | 7 +- .../expenseFile/dto/update-expenseFile.dto.ts | 10 +- .../entities/expenseFile.entity.ts | 20 +-- .../generated/expenseFile/entities/index.ts | 3 +- .../dto/connect-infoRequest.dto.ts | 8 +- .../infoRequest/dto/create-infoRequest.dto.ts | 10 +- .../domain/generated/infoRequest/dto/index.ts | 7 +- .../infoRequest/dto/update-infoRequest.dto.ts | 10 +- .../generated/infoRequest/entities/index.ts | 3 +- .../entities/infoRequest.entity.ts | 18 +-- .../dto/connect-irregularity.dto.ts | 8 +- .../dto/create-irregularity.dto.ts | 8 +- .../generated/irregularity/dto/index.ts | 7 +- .../dto/update-irregularity.dto.ts | 8 +- .../generated/irregularity/entities/index.ts | 3 +- .../entities/irregularity.entity.ts | 34 ++--- .../dto/connect-irregularityFile.dto.ts | 8 +- .../dto/create-irregularityFile.dto.ts | 10 +- .../generated/irregularityFile/dto/index.ts | 7 +- .../dto/update-irregularityFile.dto.ts | 10 +- .../irregularityFile/entities/index.ts | 3 +- .../entities/irregularityFile.entity.ts | 20 +-- .../dto/connect-marketingTemplates.dto.ts | 8 +- .../dto/create-marketingTemplates.dto.ts | 8 +- .../generated/marketingTemplates/dto/index.ts | 7 +- .../dto/update-marketingTemplates.dto.ts | 8 +- .../marketingTemplates/entities/index.ts | 3 +- .../entities/marketingTemplates.entity.ts | 8 +- .../dto/connect-notificationList.dto.ts | 8 +- .../dto/create-notificationList.dto.ts | 8 +- .../generated/notificationList/dto/index.ts | 7 +- .../dto/update-notificationList.dto.ts | 8 +- .../notificationList/entities/index.ts | 3 +- .../entities/notificationList.entity.ts | 12 +- .../organizer/dto/connect-organizer.dto.ts | 10 +- .../organizer/dto/create-organizer.dto.ts | 10 +- .../domain/generated/organizer/dto/index.ts | 7 +- .../organizer/dto/update-organizer.dto.ts | 10 +- .../generated/organizer/entities/index.ts | 3 +- .../organizer/entities/organizer.entity.ts | 22 ++-- .../person/dto/connect-person.dto.ts | 18 +-- .../generated/person/dto/create-person.dto.ts | 30 +++-- .../src/domain/generated/person/dto/index.ts | 7 +- .../generated/person/dto/update-person.dto.ts | 30 +++-- .../domain/generated/person/entities/index.ts | 3 +- .../person/entities/person.entity.ts | 120 +++++++++--------- .../dto/connect-recurringDonation.dto.ts | 8 +- .../dto/create-recurringDonation.dto.ts | 16 ++- .../generated/recurringDonation/dto/index.ts | 7 +- .../dto/update-recurringDonation.dto.ts | 16 ++- .../recurringDonation/entities/index.ts | 3 +- .../entities/recurringDonation.entity.ts | 32 ++--- .../supporter/dto/connect-supporter.dto.ts | 8 +- .../supporter/dto/create-supporter.dto.ts | 14 +- .../domain/generated/supporter/dto/index.ts | 7 +- .../supporter/dto/update-supporter.dto.ts | 14 +- .../generated/supporter/entities/index.ts | 3 +- .../supporter/entities/supporter.entity.ts | 66 +++++----- .../transfer/dto/connect-transfer.dto.ts | 8 +- .../transfer/dto/create-transfer.dto.ts | 18 ++- .../domain/generated/transfer/dto/index.ts | 7 +- .../transfer/dto/update-transfer.dto.ts | 18 ++- .../generated/transfer/entities/index.ts | 3 +- .../transfer/entities/transfer.entity.ts | 48 +++---- ...ect-unregisteredNotificationConsent.dto.ts | 10 +- ...ate-unregisteredNotificationConsent.dto.ts | 8 +- .../dto/index.ts | 7 +- ...ate-unregisteredNotificationConsent.dto.ts | 8 +- .../entities/index.ts | 3 +- .../unregisteredNotificationConsent.entity.ts | 10 +- .../generated/vault/dto/connect-vault.dto.ts | 8 +- .../generated/vault/dto/create-vault.dto.ts | 10 +- .../src/domain/generated/vault/dto/index.ts | 7 +- .../generated/vault/dto/update-vault.dto.ts | 10 +- .../domain/generated/vault/entities/index.ts | 3 +- .../generated/vault/entities/vault.entity.ts | 46 +++---- .../withdrawal/dto/connect-withdrawal.dto.ts | 8 +- .../withdrawal/dto/create-withdrawal.dto.ts | 18 ++- .../domain/generated/withdrawal/dto/index.ts | 7 +- .../withdrawal/dto/update-withdrawal.dto.ts | 18 ++- .../generated/withdrawal/entities/index.ts | 3 +- .../withdrawal/entities/withdrawal.entity.ts | 46 +++---- 208 files changed, 1731 insertions(+), 1149 deletions(-) diff --git a/apps/api/src/domain/generated/affiliate/dto/connect-affiliate.dto.ts b/apps/api/src/domain/generated/affiliate/dto/connect-affiliate.dto.ts index aca06cc2c..b69cf7398 100644 --- a/apps/api/src/domain/generated/affiliate/dto/connect-affiliate.dto.ts +++ b/apps/api/src/domain/generated/affiliate/dto/connect-affiliate.dto.ts @@ -1,5 +1,7 @@ -export class ConnectAffiliateDto { - id?: string - affiliateCode?: string - companyId?: string -} + + export class ConnectAffiliateDto { + id?: string; +affiliateCode?: string; +companyId?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/affiliate/dto/create-affiliate.dto.ts b/apps/api/src/domain/generated/affiliate/dto/create-affiliate.dto.ts index d76e0c938..066932149 100644 --- a/apps/api/src/domain/generated/affiliate/dto/create-affiliate.dto.ts +++ b/apps/api/src/domain/generated/affiliate/dto/create-affiliate.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class CreateAffiliateDto { - affiliateCode?: string + affiliateCode?: string; } diff --git a/apps/api/src/domain/generated/affiliate/dto/index.ts b/apps/api/src/domain/generated/affiliate/dto/index.ts index d3aea23c7..eecad5a60 100644 --- a/apps/api/src/domain/generated/affiliate/dto/index.ts +++ b/apps/api/src/domain/generated/affiliate/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-affiliate.dto' -export * from './create-affiliate.dto' -export * from './update-affiliate.dto' + +export * from './connect-affiliate.dto'; +export * from './create-affiliate.dto'; +export * from './update-affiliate.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/affiliate/dto/update-affiliate.dto.ts b/apps/api/src/domain/generated/affiliate/dto/update-affiliate.dto.ts index 51767a785..249e8598a 100644 --- a/apps/api/src/domain/generated/affiliate/dto/update-affiliate.dto.ts +++ b/apps/api/src/domain/generated/affiliate/dto/update-affiliate.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class UpdateAffiliateDto { - affiliateCode?: string + affiliateCode?: string; } diff --git a/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts b/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts index 3672e5d40..6f2930a9f 100644 --- a/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts +++ b/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts @@ -1,14 +1,16 @@ -import { AffiliateStatus } from '@prisma/client' -import { Company } from '../../company/entities/company.entity' -import { Donation } from '../../donation/entities/donation.entity' + +import {AffiliateStatus} from '@prisma/client' +import {Company} from '../../company/entities/company.entity' +import {Donation} from '../../donation/entities/donation.entity' + export class Affiliate { - id: string - status: AffiliateStatus - affiliateCode: string | null - companyId: string - createdAt: Date - updatedAt: Date | null - company?: Company - donations?: Donation[] + id: string ; +status: AffiliateStatus ; +affiliateCode: string | null; +companyId: string ; +createdAt: Date ; +updatedAt: Date | null; +company?: Company ; +donations?: Donation[] ; } diff --git a/apps/api/src/domain/generated/affiliate/entities/index.ts b/apps/api/src/domain/generated/affiliate/entities/index.ts index e07a7eb43..159cc623d 100644 --- a/apps/api/src/domain/generated/affiliate/entities/index.ts +++ b/apps/api/src/domain/generated/affiliate/entities/index.ts @@ -1 +1,2 @@ -export * from './affiliate.entity' + +export * from './affiliate.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/bankAccount/dto/connect-bankAccount.dto.ts b/apps/api/src/domain/generated/bankAccount/dto/connect-bankAccount.dto.ts index 3fd44a13f..0b746491b 100644 --- a/apps/api/src/domain/generated/bankAccount/dto/connect-bankAccount.dto.ts +++ b/apps/api/src/domain/generated/bankAccount/dto/connect-bankAccount.dto.ts @@ -1,3 +1,5 @@ -export class ConnectBankAccountDto { - id: string -} + + export class ConnectBankAccountDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/bankAccount/dto/create-bankAccount.dto.ts b/apps/api/src/domain/generated/bankAccount/dto/create-bankAccount.dto.ts index 47be199e5..b81ea593f 100644 --- a/apps/api/src/domain/generated/bankAccount/dto/create-bankAccount.dto.ts +++ b/apps/api/src/domain/generated/bankAccount/dto/create-bankAccount.dto.ts @@ -1,12 +1,16 @@ -import { AccountHolderType } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {AccountHolderType} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateBankAccountDto { - ibanNumber: string - accountHolderName: string - @ApiProperty({ enum: AccountHolderType }) - accountHolderType: AccountHolderType - bankName?: string - bankIdCode?: string - fingerprint?: string + ibanNumber: string; +accountHolderName: string; +@ApiProperty({ enum: AccountHolderType}) +accountHolderType: AccountHolderType; +bankName?: string; +bankIdCode?: string; +fingerprint?: string; } diff --git a/apps/api/src/domain/generated/bankAccount/dto/index.ts b/apps/api/src/domain/generated/bankAccount/dto/index.ts index 7d1b2b955..0e27b08bb 100644 --- a/apps/api/src/domain/generated/bankAccount/dto/index.ts +++ b/apps/api/src/domain/generated/bankAccount/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-bankAccount.dto' -export * from './create-bankAccount.dto' -export * from './update-bankAccount.dto' + +export * from './connect-bankAccount.dto'; +export * from './create-bankAccount.dto'; +export * from './update-bankAccount.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/bankAccount/dto/update-bankAccount.dto.ts b/apps/api/src/domain/generated/bankAccount/dto/update-bankAccount.dto.ts index 96cf9bdb8..fef749490 100644 --- a/apps/api/src/domain/generated/bankAccount/dto/update-bankAccount.dto.ts +++ b/apps/api/src/domain/generated/bankAccount/dto/update-bankAccount.dto.ts @@ -1,12 +1,16 @@ -import { AccountHolderType } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {AccountHolderType} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateBankAccountDto { - ibanNumber?: string - accountHolderName?: string - @ApiProperty({ enum: AccountHolderType }) - accountHolderType?: AccountHolderType - bankName?: string - bankIdCode?: string - fingerprint?: string + ibanNumber?: string; +accountHolderName?: string; +@ApiProperty({ enum: AccountHolderType}) +accountHolderType?: AccountHolderType; +bankName?: string; +bankIdCode?: string; +fingerprint?: string; } diff --git a/apps/api/src/domain/generated/bankAccount/entities/bankAccount.entity.ts b/apps/api/src/domain/generated/bankAccount/entities/bankAccount.entity.ts index 59208cda9..a65172090 100644 --- a/apps/api/src/domain/generated/bankAccount/entities/bankAccount.entity.ts +++ b/apps/api/src/domain/generated/bankAccount/entities/bankAccount.entity.ts @@ -1,16 +1,18 @@ -import { BankAccountStatus, AccountHolderType } from '@prisma/client' -import { Withdrawal } from '../../withdrawal/entities/withdrawal.entity' + +import {BankAccountStatus,AccountHolderType} from '@prisma/client' +import {Withdrawal} from '../../withdrawal/entities/withdrawal.entity' + export class BankAccount { - id: string - status: BankAccountStatus - ibanNumber: string - accountHolderName: string - accountHolderType: AccountHolderType - bankName: string | null - bankIdCode: string | null - fingerprint: string | null - createdAt: Date - updatedAt: Date | null - withdraws?: Withdrawal[] + id: string ; +status: BankAccountStatus ; +ibanNumber: string ; +accountHolderName: string ; +accountHolderType: AccountHolderType ; +bankName: string | null; +bankIdCode: string | null; +fingerprint: string | null; +createdAt: Date ; +updatedAt: Date | null; +withdraws?: Withdrawal[] ; } diff --git a/apps/api/src/domain/generated/bankAccount/entities/index.ts b/apps/api/src/domain/generated/bankAccount/entities/index.ts index f1ae59edc..e5c0a3d53 100644 --- a/apps/api/src/domain/generated/bankAccount/entities/index.ts +++ b/apps/api/src/domain/generated/bankAccount/entities/index.ts @@ -1 +1,2 @@ -export * from './bankAccount.entity' + +export * from './bankAccount.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/bankTransaction/dto/connect-bankTransaction.dto.ts b/apps/api/src/domain/generated/bankTransaction/dto/connect-bankTransaction.dto.ts index 117f42bb9..9ed16b3d9 100644 --- a/apps/api/src/domain/generated/bankTransaction/dto/connect-bankTransaction.dto.ts +++ b/apps/api/src/domain/generated/bankTransaction/dto/connect-bankTransaction.dto.ts @@ -1,3 +1,5 @@ -export class ConnectBankTransactionDto { - id: string -} + + export class ConnectBankTransactionDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/bankTransaction/dto/create-bankTransaction.dto.ts b/apps/api/src/domain/generated/bankTransaction/dto/create-bankTransaction.dto.ts index 05096c122..6f33920ae 100644 --- a/apps/api/src/domain/generated/bankTransaction/dto/create-bankTransaction.dto.ts +++ b/apps/api/src/domain/generated/bankTransaction/dto/create-bankTransaction.dto.ts @@ -1,21 +1,25 @@ -import { BankTransactionType, BankDonationStatus } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {BankTransactionType,BankDonationStatus} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateBankTransactionDto { - id: string - ibanNumber: string - bankName: string - bankIdCode: string - transactionDate: Date - senderName?: string - recipientName?: string - senderIban?: string - recipientIban?: string - description: string - matchedRef?: string - @ApiProperty({ enum: BankTransactionType }) - type: BankTransactionType - @ApiProperty({ enum: BankDonationStatus }) - bankDonationStatus?: BankDonationStatus - notified?: boolean + id: string; +ibanNumber: string; +bankName: string; +bankIdCode: string; +transactionDate: Date; +senderName?: string; +recipientName?: string; +senderIban?: string; +recipientIban?: string; +description: string; +matchedRef?: string; +@ApiProperty({ enum: BankTransactionType}) +type: BankTransactionType; +@ApiProperty({ enum: BankDonationStatus}) +bankDonationStatus?: BankDonationStatus; +notified?: boolean; } diff --git a/apps/api/src/domain/generated/bankTransaction/dto/index.ts b/apps/api/src/domain/generated/bankTransaction/dto/index.ts index 33978daf6..785b5362d 100644 --- a/apps/api/src/domain/generated/bankTransaction/dto/index.ts +++ b/apps/api/src/domain/generated/bankTransaction/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-bankTransaction.dto' -export * from './create-bankTransaction.dto' -export * from './update-bankTransaction.dto' + +export * from './connect-bankTransaction.dto'; +export * from './create-bankTransaction.dto'; +export * from './update-bankTransaction.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/bankTransaction/dto/update-bankTransaction.dto.ts b/apps/api/src/domain/generated/bankTransaction/dto/update-bankTransaction.dto.ts index c01df91e4..467f65705 100644 --- a/apps/api/src/domain/generated/bankTransaction/dto/update-bankTransaction.dto.ts +++ b/apps/api/src/domain/generated/bankTransaction/dto/update-bankTransaction.dto.ts @@ -1,20 +1,24 @@ -import { BankTransactionType, BankDonationStatus } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {BankTransactionType,BankDonationStatus} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateBankTransactionDto { - ibanNumber?: string - bankName?: string - bankIdCode?: string - transactionDate?: Date - senderName?: string - recipientName?: string - senderIban?: string - recipientIban?: string - description?: string - matchedRef?: string - @ApiProperty({ enum: BankTransactionType }) - type?: BankTransactionType - @ApiProperty({ enum: BankDonationStatus }) - bankDonationStatus?: BankDonationStatus - notified?: boolean + ibanNumber?: string; +bankName?: string; +bankIdCode?: string; +transactionDate?: Date; +senderName?: string; +recipientName?: string; +senderIban?: string; +recipientIban?: string; +description?: string; +matchedRef?: string; +@ApiProperty({ enum: BankTransactionType}) +type?: BankTransactionType; +@ApiProperty({ enum: BankDonationStatus}) +bankDonationStatus?: BankDonationStatus; +notified?: boolean; } diff --git a/apps/api/src/domain/generated/bankTransaction/entities/bankTransaction.entity.ts b/apps/api/src/domain/generated/bankTransaction/entities/bankTransaction.entity.ts index 1aeb5e393..4dfdfadf0 100644 --- a/apps/api/src/domain/generated/bankTransaction/entities/bankTransaction.entity.ts +++ b/apps/api/src/domain/generated/bankTransaction/entities/bankTransaction.entity.ts @@ -1,20 +1,22 @@ -import { Currency, BankTransactionType, BankDonationStatus } from '@prisma/client' + +import {Currency,BankTransactionType,BankDonationStatus} from '@prisma/client' + export class BankTransaction { - id: string - ibanNumber: string - bankName: string - bankIdCode: string - transactionDate: Date - senderName: string | null - recipientName: string | null - senderIban: string | null - recipientIban: string | null - amount: number - currency: Currency - description: string - matchedRef: string | null - type: BankTransactionType - bankDonationStatus: BankDonationStatus | null - notified: boolean | null + id: string ; +ibanNumber: string ; +bankName: string ; +bankIdCode: string ; +transactionDate: Date ; +senderName: string | null; +recipientName: string | null; +senderIban: string | null; +recipientIban: string | null; +amount: number ; +currency: Currency ; +description: string ; +matchedRef: string | null; +type: BankTransactionType ; +bankDonationStatus: BankDonationStatus | null; +notified: boolean | null; } diff --git a/apps/api/src/domain/generated/bankTransaction/entities/index.ts b/apps/api/src/domain/generated/bankTransaction/entities/index.ts index e8b88ec1c..573d9ea09 100644 --- a/apps/api/src/domain/generated/bankTransaction/entities/index.ts +++ b/apps/api/src/domain/generated/bankTransaction/entities/index.ts @@ -1 +1,2 @@ -export * from './bankTransaction.entity' + +export * from './bankTransaction.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/bankTransactionsFile/dto/connect-bankTransactionsFile.dto.ts b/apps/api/src/domain/generated/bankTransactionsFile/dto/connect-bankTransactionsFile.dto.ts index 6cdf90627..c383807cf 100644 --- a/apps/api/src/domain/generated/bankTransactionsFile/dto/connect-bankTransactionsFile.dto.ts +++ b/apps/api/src/domain/generated/bankTransactionsFile/dto/connect-bankTransactionsFile.dto.ts @@ -1,3 +1,5 @@ -export class ConnectBankTransactionsFileDto { - id: string -} + + export class ConnectBankTransactionsFileDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/bankTransactionsFile/dto/index.ts b/apps/api/src/domain/generated/bankTransactionsFile/dto/index.ts index 20977448f..5b340a88a 100644 --- a/apps/api/src/domain/generated/bankTransactionsFile/dto/index.ts +++ b/apps/api/src/domain/generated/bankTransactionsFile/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-bankTransactionsFile.dto' -export * from './create-bankTransactionsFile.dto' -export * from './update-bankTransactionsFile.dto' + +export * from './connect-bankTransactionsFile.dto'; +export * from './create-bankTransactionsFile.dto'; +export * from './update-bankTransactionsFile.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/bankTransactionsFile/entities/bankTransactionsFile.entity.ts b/apps/api/src/domain/generated/bankTransactionsFile/entities/bankTransactionsFile.entity.ts index e77fd9cf1..527fd9fbb 100644 --- a/apps/api/src/domain/generated/bankTransactionsFile/entities/bankTransactionsFile.entity.ts +++ b/apps/api/src/domain/generated/bankTransactionsFile/entities/bankTransactionsFile.entity.ts @@ -1,10 +1,12 @@ -import { BankTransactionsFileType } from '@prisma/client' + +import {BankTransactionsFileType} from '@prisma/client' + export class BankTransactionsFile { - id: string - filename: string - mimetype: string - bankTransactionsFileId: string - type: BankTransactionsFileType - personId: string + id: string ; +filename: string ; +mimetype: string ; +bankTransactionsFileId: string ; +type: BankTransactionsFileType ; +personId: string ; } diff --git a/apps/api/src/domain/generated/bankTransactionsFile/entities/index.ts b/apps/api/src/domain/generated/bankTransactionsFile/entities/index.ts index f37c6f255..6ccda1bc5 100644 --- a/apps/api/src/domain/generated/bankTransactionsFile/entities/index.ts +++ b/apps/api/src/domain/generated/bankTransactionsFile/entities/index.ts @@ -1 +1,2 @@ -export * from './bankTransactionsFile.entity' + +export * from './bankTransactionsFile.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/benefactor/dto/connect-benefactor.dto.ts b/apps/api/src/domain/generated/benefactor/dto/connect-benefactor.dto.ts index 4fe025c7e..21f5ab163 100644 --- a/apps/api/src/domain/generated/benefactor/dto/connect-benefactor.dto.ts +++ b/apps/api/src/domain/generated/benefactor/dto/connect-benefactor.dto.ts @@ -1,4 +1,6 @@ -export class ConnectBenefactorDto { - id?: string - extCustomerId?: string -} + + export class ConnectBenefactorDto { + id?: string; +extCustomerId?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/benefactor/dto/create-benefactor.dto.ts b/apps/api/src/domain/generated/benefactor/dto/create-benefactor.dto.ts index 832716f11..612398342 100644 --- a/apps/api/src/domain/generated/benefactor/dto/create-benefactor.dto.ts +++ b/apps/api/src/domain/generated/benefactor/dto/create-benefactor.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class CreateBenefactorDto { - extCustomerId?: string + extCustomerId?: string; } diff --git a/apps/api/src/domain/generated/benefactor/dto/index.ts b/apps/api/src/domain/generated/benefactor/dto/index.ts index 7d1ae714d..38c4268e3 100644 --- a/apps/api/src/domain/generated/benefactor/dto/index.ts +++ b/apps/api/src/domain/generated/benefactor/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-benefactor.dto' -export * from './create-benefactor.dto' -export * from './update-benefactor.dto' + +export * from './connect-benefactor.dto'; +export * from './create-benefactor.dto'; +export * from './update-benefactor.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/benefactor/dto/update-benefactor.dto.ts b/apps/api/src/domain/generated/benefactor/dto/update-benefactor.dto.ts index 310f1f4c7..516ffc550 100644 --- a/apps/api/src/domain/generated/benefactor/dto/update-benefactor.dto.ts +++ b/apps/api/src/domain/generated/benefactor/dto/update-benefactor.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class UpdateBenefactorDto { - extCustomerId?: string + extCustomerId?: string; } diff --git a/apps/api/src/domain/generated/benefactor/entities/benefactor.entity.ts b/apps/api/src/domain/generated/benefactor/entities/benefactor.entity.ts index c5de54418..1272e85fa 100644 --- a/apps/api/src/domain/generated/benefactor/entities/benefactor.entity.ts +++ b/apps/api/src/domain/generated/benefactor/entities/benefactor.entity.ts @@ -1,10 +1,12 @@ -import { Person } from '../../person/entities/person.entity' + +import {Person} from '../../person/entities/person.entity' + export class Benefactor { - id: string - personId: string - extCustomerId: string | null - createdAt: Date - updatedAt: Date | null - person?: Person + id: string ; +personId: string ; +extCustomerId: string | null; +createdAt: Date ; +updatedAt: Date | null; +person?: Person ; } diff --git a/apps/api/src/domain/generated/benefactor/entities/index.ts b/apps/api/src/domain/generated/benefactor/entities/index.ts index a2fdda115..7eadc8a26 100644 --- a/apps/api/src/domain/generated/benefactor/entities/index.ts +++ b/apps/api/src/domain/generated/benefactor/entities/index.ts @@ -1 +1,2 @@ -export * from './benefactor.entity' + +export * from './benefactor.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/beneficiary/dto/connect-beneficiary.dto.ts b/apps/api/src/domain/generated/beneficiary/dto/connect-beneficiary.dto.ts index a860abb38..e172843c9 100644 --- a/apps/api/src/domain/generated/beneficiary/dto/connect-beneficiary.dto.ts +++ b/apps/api/src/domain/generated/beneficiary/dto/connect-beneficiary.dto.ts @@ -1,3 +1,5 @@ -export class ConnectBeneficiaryDto { - id: string -} + + export class ConnectBeneficiaryDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/beneficiary/dto/create-beneficiary.dto.ts b/apps/api/src/domain/generated/beneficiary/dto/create-beneficiary.dto.ts index 6cb1e49be..fc915ff5d 100644 --- a/apps/api/src/domain/generated/beneficiary/dto/create-beneficiary.dto.ts +++ b/apps/api/src/domain/generated/beneficiary/dto/create-beneficiary.dto.ts @@ -1,15 +1,19 @@ -import { Prisma, BeneficiaryType, PersonRelation } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {Prisma,BeneficiaryType,PersonRelation} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateBeneficiaryDto { - @ApiProperty({ enum: BeneficiaryType }) - type: BeneficiaryType - countryCode: string - @ApiProperty({ enum: PersonRelation }) - coordinatorRelation?: PersonRelation - description?: string - privateData?: Prisma.InputJsonValue - publicData?: Prisma.InputJsonValue - @ApiProperty({ enum: PersonRelation }) - organizerRelation?: PersonRelation + @ApiProperty({ enum: BeneficiaryType}) +type: BeneficiaryType; +countryCode: string; +@ApiProperty({ enum: PersonRelation}) +coordinatorRelation?: PersonRelation; +description?: string; +privateData?: Prisma.InputJsonValue; +publicData?: Prisma.InputJsonValue; +@ApiProperty({ enum: PersonRelation}) +organizerRelation?: PersonRelation; } diff --git a/apps/api/src/domain/generated/beneficiary/dto/index.ts b/apps/api/src/domain/generated/beneficiary/dto/index.ts index 53b54ab2d..5e7aa035a 100644 --- a/apps/api/src/domain/generated/beneficiary/dto/index.ts +++ b/apps/api/src/domain/generated/beneficiary/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-beneficiary.dto' -export * from './create-beneficiary.dto' -export * from './update-beneficiary.dto' + +export * from './connect-beneficiary.dto'; +export * from './create-beneficiary.dto'; +export * from './update-beneficiary.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/beneficiary/dto/update-beneficiary.dto.ts b/apps/api/src/domain/generated/beneficiary/dto/update-beneficiary.dto.ts index cb803cb07..764bc76a6 100644 --- a/apps/api/src/domain/generated/beneficiary/dto/update-beneficiary.dto.ts +++ b/apps/api/src/domain/generated/beneficiary/dto/update-beneficiary.dto.ts @@ -1,15 +1,19 @@ -import { Prisma, BeneficiaryType, PersonRelation } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {Prisma,BeneficiaryType,PersonRelation} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateBeneficiaryDto { - @ApiProperty({ enum: BeneficiaryType }) - type?: BeneficiaryType - countryCode?: string - @ApiProperty({ enum: PersonRelation }) - coordinatorRelation?: PersonRelation - description?: string - privateData?: Prisma.InputJsonValue - publicData?: Prisma.InputJsonValue - @ApiProperty({ enum: PersonRelation }) - organizerRelation?: PersonRelation + @ApiProperty({ enum: BeneficiaryType}) +type?: BeneficiaryType; +countryCode?: string; +@ApiProperty({ enum: PersonRelation}) +coordinatorRelation?: PersonRelation; +description?: string; +privateData?: Prisma.InputJsonValue; +publicData?: Prisma.InputJsonValue; +@ApiProperty({ enum: PersonRelation}) +organizerRelation?: PersonRelation; } diff --git a/apps/api/src/domain/generated/beneficiary/entities/beneficiary.entity.ts b/apps/api/src/domain/generated/beneficiary/entities/beneficiary.entity.ts index c4cf25c5a..cd16bbf53 100644 --- a/apps/api/src/domain/generated/beneficiary/entities/beneficiary.entity.ts +++ b/apps/api/src/domain/generated/beneficiary/entities/beneficiary.entity.ts @@ -1,31 +1,33 @@ -import { Prisma, BeneficiaryType, PersonRelation } from '@prisma/client' -import { City } from '../../city/entities/city.entity' -import { Company } from '../../company/entities/company.entity' -import { Coordinator } from '../../coordinator/entities/coordinator.entity' -import { Organizer } from '../../organizer/entities/organizer.entity' -import { Person } from '../../person/entities/person.entity' -import { Campaign } from '../../campaign/entities/campaign.entity' + +import {Prisma,BeneficiaryType,PersonRelation} from '@prisma/client' +import {City} from '../../city/entities/city.entity' +import {Company} from '../../company/entities/company.entity' +import {Coordinator} from '../../coordinator/entities/coordinator.entity' +import {Organizer} from '../../organizer/entities/organizer.entity' +import {Person} from '../../person/entities/person.entity' +import {Campaign} from '../../campaign/entities/campaign.entity' + export class Beneficiary { - id: string - type: BeneficiaryType - personId: string | null - coordinatorId: string | null - countryCode: string - cityId: string - createdAt: Date - updatedAt: Date | null - coordinatorRelation: PersonRelation | null - description: string | null - privateData: Prisma.JsonValue | null - publicData: Prisma.JsonValue | null - companyId: string | null - organizerId: string | null - organizerRelation: PersonRelation | null - city?: City - company?: Company | null - coordinator?: Coordinator | null - organizer?: Organizer | null - person?: Person | null - campaigns?: Campaign[] + id: string ; +type: BeneficiaryType ; +personId: string | null; +coordinatorId: string | null; +countryCode: string ; +cityId: string ; +createdAt: Date ; +updatedAt: Date | null; +coordinatorRelation: PersonRelation | null; +description: string | null; +privateData: Prisma.JsonValue | null; +publicData: Prisma.JsonValue | null; +companyId: string | null; +organizerId: string | null; +organizerRelation: PersonRelation | null; +city?: City ; +company?: Company | null; +coordinator?: Coordinator | null; +organizer?: Organizer | null; +person?: Person | null; +campaigns?: Campaign[] ; } diff --git a/apps/api/src/domain/generated/beneficiary/entities/index.ts b/apps/api/src/domain/generated/beneficiary/entities/index.ts index dfedc52a2..1c70ada2d 100644 --- a/apps/api/src/domain/generated/beneficiary/entities/index.ts +++ b/apps/api/src/domain/generated/beneficiary/entities/index.ts @@ -1 +1,2 @@ -export * from './beneficiary.entity' + +export * from './beneficiary.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaign/dto/connect-campaign.dto.ts b/apps/api/src/domain/generated/campaign/dto/connect-campaign.dto.ts index b1f28f448..8455213fc 100644 --- a/apps/api/src/domain/generated/campaign/dto/connect-campaign.dto.ts +++ b/apps/api/src/domain/generated/campaign/dto/connect-campaign.dto.ts @@ -1,5 +1,7 @@ -export class ConnectCampaignDto { - id?: string - slug?: string - paymentReference?: string -} + + export class ConnectCampaignDto { + id?: string; +slug?: string; +paymentReference?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaign/dto/create-campaign.dto.ts b/apps/api/src/domain/generated/campaign/dto/create-campaign.dto.ts index 20dd31506..ef04d2a86 100644 --- a/apps/api/src/domain/generated/campaign/dto/create-campaign.dto.ts +++ b/apps/api/src/domain/generated/campaign/dto/create-campaign.dto.ts @@ -1,11 +1,17 @@ + + + + + + export class CreateCampaignDto { - slug: string - title: string - essence: string - description?: string - targetAmount?: number - startDate?: Date - endDate?: Date - deletedAt?: Date - paymentReference: string + slug: string; +title: string; +essence: string; +description?: string; +targetAmount?: number; +startDate?: Date; +endDate?: Date; +deletedAt?: Date; +paymentReference: string; } diff --git a/apps/api/src/domain/generated/campaign/dto/index.ts b/apps/api/src/domain/generated/campaign/dto/index.ts index 867889df2..241d02034 100644 --- a/apps/api/src/domain/generated/campaign/dto/index.ts +++ b/apps/api/src/domain/generated/campaign/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-campaign.dto' -export * from './create-campaign.dto' -export * from './update-campaign.dto' + +export * from './connect-campaign.dto'; +export * from './create-campaign.dto'; +export * from './update-campaign.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaign/dto/update-campaign.dto.ts b/apps/api/src/domain/generated/campaign/dto/update-campaign.dto.ts index 299525728..c54f9040b 100644 --- a/apps/api/src/domain/generated/campaign/dto/update-campaign.dto.ts +++ b/apps/api/src/domain/generated/campaign/dto/update-campaign.dto.ts @@ -1,11 +1,17 @@ + + + + + + export class UpdateCampaignDto { - slug?: string - title?: string - essence?: string - description?: string - targetAmount?: number - startDate?: Date - endDate?: Date - deletedAt?: Date - paymentReference?: string + slug?: string; +title?: string; +essence?: string; +description?: string; +targetAmount?: number; +startDate?: Date; +endDate?: Date; +deletedAt?: Date; +paymentReference?: string; } diff --git a/apps/api/src/domain/generated/campaign/entities/campaign.entity.ts b/apps/api/src/domain/generated/campaign/entities/campaign.entity.ts index 3de7f1e63..0aabf3539 100644 --- a/apps/api/src/domain/generated/campaign/entities/campaign.entity.ts +++ b/apps/api/src/domain/generated/campaign/entities/campaign.entity.ts @@ -1,56 +1,58 @@ -import { CampaignState, Currency } from '@prisma/client' -import { Person } from '../../person/entities/person.entity' -import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' -import { CampaignType } from '../../campaignType/entities/campaignType.entity' -import { Coordinator } from '../../coordinator/entities/coordinator.entity' -import { Organizer } from '../../organizer/entities/organizer.entity' -import { Company } from '../../company/entities/company.entity' -import { CampaignFile } from '../../campaignFile/entities/campaignFile.entity' -import { DonationWish } from '../../donationWish/entities/donationWish.entity' -import { Irregularity } from '../../irregularity/entities/irregularity.entity' -import { Transfer } from '../../transfer/entities/transfer.entity' -import { Vault } from '../../vault/entities/vault.entity' -import { Withdrawal } from '../../withdrawal/entities/withdrawal.entity' -import { SlugArchive } from '../../slugArchive/entities/slugArchive.entity' -import { CampaignNews } from '../../campaignNews/entities/campaignNews.entity' -import { NotificationList } from '../../notificationList/entities/notificationList.entity' + +import {CampaignState,Currency} from '@prisma/client' +import {Person} from '../../person/entities/person.entity' +import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' +import {CampaignType} from '../../campaignType/entities/campaignType.entity' +import {Coordinator} from '../../coordinator/entities/coordinator.entity' +import {Organizer} from '../../organizer/entities/organizer.entity' +import {Company} from '../../company/entities/company.entity' +import {CampaignFile} from '../../campaignFile/entities/campaignFile.entity' +import {DonationWish} from '../../donationWish/entities/donationWish.entity' +import {Irregularity} from '../../irregularity/entities/irregularity.entity' +import {Transfer} from '../../transfer/entities/transfer.entity' +import {Vault} from '../../vault/entities/vault.entity' +import {Withdrawal} from '../../withdrawal/entities/withdrawal.entity' +import {SlugArchive} from '../../slugArchive/entities/slugArchive.entity' +import {CampaignNews} from '../../campaignNews/entities/campaignNews.entity' +import {NotificationList} from '../../notificationList/entities/notificationList.entity' + export class Campaign { - id: string - state: CampaignState - slug: string - title: string - essence: string - coordinatorId: string - beneficiaryId: string - campaignTypeId: string - description: string | null - targetAmount: number | null - startDate: Date | null - endDate: Date | null - createdAt: Date - updatedAt: Date | null - deletedAt: Date | null - approvedById: string | null - currency: Currency - allowDonationOnComplete: boolean - paymentReference: string - organizerId: string | null - companyId: string | null - approvedBy?: Person | null - beneficiary?: Beneficiary - campaignType?: CampaignType - coordinator?: Coordinator - organizer?: Organizer | null - company?: Company | null - campaignFiles?: CampaignFile[] - donationWish?: DonationWish[] - irregularities?: Irregularity[] - outgoingTransfers?: Transfer[] - incomingTransfers?: Transfer[] - vaults?: Vault[] - withdrawals?: Withdrawal[] - slugArchive?: SlugArchive[] - campaignNews?: CampaignNews[] - notificationLists?: NotificationList[] + id: string ; +state: CampaignState ; +slug: string ; +title: string ; +essence: string ; +coordinatorId: string ; +beneficiaryId: string ; +campaignTypeId: string ; +description: string | null; +targetAmount: number | null; +startDate: Date | null; +endDate: Date | null; +createdAt: Date ; +updatedAt: Date | null; +deletedAt: Date | null; +approvedById: string | null; +currency: Currency ; +allowDonationOnComplete: boolean ; +paymentReference: string ; +organizerId: string | null; +companyId: string | null; +approvedBy?: Person | null; +beneficiary?: Beneficiary ; +campaignType?: CampaignType ; +coordinator?: Coordinator ; +organizer?: Organizer | null; +company?: Company | null; +campaignFiles?: CampaignFile[] ; +donationWish?: DonationWish[] ; +irregularities?: Irregularity[] ; +outgoingTransfers?: Transfer[] ; +incomingTransfers?: Transfer[] ; +vaults?: Vault[] ; +withdrawals?: Withdrawal[] ; +slugArchive?: SlugArchive[] ; +campaignNews?: CampaignNews[] ; +notificationLists?: NotificationList[] ; } diff --git a/apps/api/src/domain/generated/campaign/entities/index.ts b/apps/api/src/domain/generated/campaign/entities/index.ts index 60f683cf0..1b36a8a95 100644 --- a/apps/api/src/domain/generated/campaign/entities/index.ts +++ b/apps/api/src/domain/generated/campaign/entities/index.ts @@ -1 +1,2 @@ -export * from './campaign.entity' + +export * from './campaign.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignFile/dto/connect-campaignFile.dto.ts b/apps/api/src/domain/generated/campaignFile/dto/connect-campaignFile.dto.ts index 6bc075ba1..cff9608ef 100644 --- a/apps/api/src/domain/generated/campaignFile/dto/connect-campaignFile.dto.ts +++ b/apps/api/src/domain/generated/campaignFile/dto/connect-campaignFile.dto.ts @@ -1,3 +1,5 @@ -export class ConnectCampaignFileDto { - id: string -} + + export class ConnectCampaignFileDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignFile/dto/create-campaignFile.dto.ts b/apps/api/src/domain/generated/campaignFile/dto/create-campaignFile.dto.ts index d95e8c8d1..4abc7c4fa 100644 --- a/apps/api/src/domain/generated/campaignFile/dto/create-campaignFile.dto.ts +++ b/apps/api/src/domain/generated/campaignFile/dto/create-campaignFile.dto.ts @@ -1,9 +1,13 @@ -import { CampaignFileRole } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {CampaignFileRole} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateCampaignFileDto { - filename: string - mimetype: string - @ApiProperty({ enum: CampaignFileRole }) - role: CampaignFileRole + filename: string; +mimetype: string; +@ApiProperty({ enum: CampaignFileRole}) +role: CampaignFileRole; } diff --git a/apps/api/src/domain/generated/campaignFile/dto/index.ts b/apps/api/src/domain/generated/campaignFile/dto/index.ts index 4aee57739..4783677d1 100644 --- a/apps/api/src/domain/generated/campaignFile/dto/index.ts +++ b/apps/api/src/domain/generated/campaignFile/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-campaignFile.dto' -export * from './create-campaignFile.dto' -export * from './update-campaignFile.dto' + +export * from './connect-campaignFile.dto'; +export * from './create-campaignFile.dto'; +export * from './update-campaignFile.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignFile/dto/update-campaignFile.dto.ts b/apps/api/src/domain/generated/campaignFile/dto/update-campaignFile.dto.ts index 91edf0627..518c2fb17 100644 --- a/apps/api/src/domain/generated/campaignFile/dto/update-campaignFile.dto.ts +++ b/apps/api/src/domain/generated/campaignFile/dto/update-campaignFile.dto.ts @@ -1,9 +1,13 @@ -import { CampaignFileRole } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {CampaignFileRole} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateCampaignFileDto { - filename?: string - mimetype?: string - @ApiProperty({ enum: CampaignFileRole }) - role?: CampaignFileRole + filename?: string; +mimetype?: string; +@ApiProperty({ enum: CampaignFileRole}) +role?: CampaignFileRole; } diff --git a/apps/api/src/domain/generated/campaignFile/entities/campaignFile.entity.ts b/apps/api/src/domain/generated/campaignFile/entities/campaignFile.entity.ts index 3d42e1747..a2121df59 100644 --- a/apps/api/src/domain/generated/campaignFile/entities/campaignFile.entity.ts +++ b/apps/api/src/domain/generated/campaignFile/entities/campaignFile.entity.ts @@ -1,14 +1,16 @@ -import { CampaignFileRole } from '@prisma/client' -import { Campaign } from '../../campaign/entities/campaign.entity' -import { Person } from '../../person/entities/person.entity' + +import {CampaignFileRole} from '@prisma/client' +import {Campaign} from '../../campaign/entities/campaign.entity' +import {Person} from '../../person/entities/person.entity' + export class CampaignFile { - id: string - filename: string - campaignId: string - personId: string - mimetype: string - role: CampaignFileRole - campaign?: Campaign - person?: Person + id: string ; +filename: string ; +campaignId: string ; +personId: string ; +mimetype: string ; +role: CampaignFileRole ; +campaign?: Campaign ; +person?: Person ; } diff --git a/apps/api/src/domain/generated/campaignFile/entities/index.ts b/apps/api/src/domain/generated/campaignFile/entities/index.ts index 1b4dd6ad3..1177918c9 100644 --- a/apps/api/src/domain/generated/campaignFile/entities/index.ts +++ b/apps/api/src/domain/generated/campaignFile/entities/index.ts @@ -1 +1,2 @@ -export * from './campaignFile.entity' + +export * from './campaignFile.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignNews/dto/connect-campaignNews.dto.ts b/apps/api/src/domain/generated/campaignNews/dto/connect-campaignNews.dto.ts index 399d0f96b..d2b369028 100644 --- a/apps/api/src/domain/generated/campaignNews/dto/connect-campaignNews.dto.ts +++ b/apps/api/src/domain/generated/campaignNews/dto/connect-campaignNews.dto.ts @@ -1,4 +1,6 @@ -export class ConnectCampaignNewsDto { - id?: string - slug?: string -} + + export class ConnectCampaignNewsDto { + id?: string; +slug?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignNews/dto/create-campaignNews.dto.ts b/apps/api/src/domain/generated/campaignNews/dto/create-campaignNews.dto.ts index b7acf5db8..c66e7e93d 100644 --- a/apps/api/src/domain/generated/campaignNews/dto/create-campaignNews.dto.ts +++ b/apps/api/src/domain/generated/campaignNews/dto/create-campaignNews.dto.ts @@ -1,9 +1,15 @@ + + + + + + export class CreateCampaignNewsDto { - slug: string - title: string - author: string - sourceLink?: string - publishedAt?: Date - editedAt?: Date - description: string + slug: string; +title: string; +author: string; +sourceLink?: string; +publishedAt?: Date; +editedAt?: Date; +description: string; } diff --git a/apps/api/src/domain/generated/campaignNews/dto/index.ts b/apps/api/src/domain/generated/campaignNews/dto/index.ts index b887f9b80..d8692302f 100644 --- a/apps/api/src/domain/generated/campaignNews/dto/index.ts +++ b/apps/api/src/domain/generated/campaignNews/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-campaignNews.dto' -export * from './create-campaignNews.dto' -export * from './update-campaignNews.dto' + +export * from './connect-campaignNews.dto'; +export * from './create-campaignNews.dto'; +export * from './update-campaignNews.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignNews/dto/update-campaignNews.dto.ts b/apps/api/src/domain/generated/campaignNews/dto/update-campaignNews.dto.ts index 82adf9710..b97165ede 100644 --- a/apps/api/src/domain/generated/campaignNews/dto/update-campaignNews.dto.ts +++ b/apps/api/src/domain/generated/campaignNews/dto/update-campaignNews.dto.ts @@ -1,9 +1,15 @@ + + + + + + export class UpdateCampaignNewsDto { - slug?: string - title?: string - author?: string - sourceLink?: string - publishedAt?: Date - editedAt?: Date - description?: string + slug?: string; +title?: string; +author?: string; +sourceLink?: string; +publishedAt?: Date; +editedAt?: Date; +description?: string; } diff --git a/apps/api/src/domain/generated/campaignNews/entities/campaignNews.entity.ts b/apps/api/src/domain/generated/campaignNews/entities/campaignNews.entity.ts index f046989d1..5fe575ab0 100644 --- a/apps/api/src/domain/generated/campaignNews/entities/campaignNews.entity.ts +++ b/apps/api/src/domain/generated/campaignNews/entities/campaignNews.entity.ts @@ -1,22 +1,24 @@ -import { CampaignNewsState } from '@prisma/client' -import { Campaign } from '../../campaign/entities/campaign.entity' -import { Person } from '../../person/entities/person.entity' -import { CampaignNewsFile } from '../../campaignNewsFile/entities/campaignNewsFile.entity' + +import {CampaignNewsState} from '@prisma/client' +import {Campaign} from '../../campaign/entities/campaign.entity' +import {Person} from '../../person/entities/person.entity' +import {CampaignNewsFile} from '../../campaignNewsFile/entities/campaignNewsFile.entity' + export class CampaignNews { - id: string - campaignId: string - publisherId: string - slug: string - title: string - author: string - sourceLink: string | null - state: CampaignNewsState - createdAt: Date - publishedAt: Date | null - editedAt: Date | null - description: string - campaign?: Campaign - publisher?: Person - newsFiles?: CampaignNewsFile[] + id: string ; +campaignId: string ; +publisherId: string ; +slug: string ; +title: string ; +author: string ; +sourceLink: string | null; +state: CampaignNewsState ; +createdAt: Date ; +publishedAt: Date | null; +editedAt: Date | null; +description: string ; +campaign?: Campaign ; +publisher?: Person ; +newsFiles?: CampaignNewsFile[] ; } diff --git a/apps/api/src/domain/generated/campaignNews/entities/index.ts b/apps/api/src/domain/generated/campaignNews/entities/index.ts index cb5d82606..a356a01d1 100644 --- a/apps/api/src/domain/generated/campaignNews/entities/index.ts +++ b/apps/api/src/domain/generated/campaignNews/entities/index.ts @@ -1 +1,2 @@ -export * from './campaignNews.entity' + +export * from './campaignNews.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignNewsFile/dto/connect-campaignNewsFile.dto.ts b/apps/api/src/domain/generated/campaignNewsFile/dto/connect-campaignNewsFile.dto.ts index 3292302a0..ab48dffbb 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/dto/connect-campaignNewsFile.dto.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/dto/connect-campaignNewsFile.dto.ts @@ -1,3 +1,5 @@ -export class ConnectCampaignNewsFileDto { - id: string -} + + export class ConnectCampaignNewsFileDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignNewsFile/dto/create-campaignNewsFile.dto.ts b/apps/api/src/domain/generated/campaignNewsFile/dto/create-campaignNewsFile.dto.ts index b99ca94c8..8615826f7 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/dto/create-campaignNewsFile.dto.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/dto/create-campaignNewsFile.dto.ts @@ -1,9 +1,13 @@ -import { CampaignFileRole } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {CampaignFileRole} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateCampaignNewsFileDto { - filename: string - mimetype: string - @ApiProperty({ enum: CampaignFileRole }) - role: CampaignFileRole + filename: string; +mimetype: string; +@ApiProperty({ enum: CampaignFileRole}) +role: CampaignFileRole; } diff --git a/apps/api/src/domain/generated/campaignNewsFile/dto/index.ts b/apps/api/src/domain/generated/campaignNewsFile/dto/index.ts index b2ce1b44c..f8d203eaa 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/dto/index.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-campaignNewsFile.dto' -export * from './create-campaignNewsFile.dto' -export * from './update-campaignNewsFile.dto' + +export * from './connect-campaignNewsFile.dto'; +export * from './create-campaignNewsFile.dto'; +export * from './update-campaignNewsFile.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignNewsFile/dto/update-campaignNewsFile.dto.ts b/apps/api/src/domain/generated/campaignNewsFile/dto/update-campaignNewsFile.dto.ts index dd638edca..cd6ef53f4 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/dto/update-campaignNewsFile.dto.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/dto/update-campaignNewsFile.dto.ts @@ -1,9 +1,13 @@ -import { CampaignFileRole } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {CampaignFileRole} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateCampaignNewsFileDto { - filename?: string - mimetype?: string - @ApiProperty({ enum: CampaignFileRole }) - role?: CampaignFileRole + filename?: string; +mimetype?: string; +@ApiProperty({ enum: CampaignFileRole}) +role?: CampaignFileRole; } diff --git a/apps/api/src/domain/generated/campaignNewsFile/entities/campaignNewsFile.entity.ts b/apps/api/src/domain/generated/campaignNewsFile/entities/campaignNewsFile.entity.ts index 18d32c0c9..9707618c1 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/entities/campaignNewsFile.entity.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/entities/campaignNewsFile.entity.ts @@ -1,14 +1,16 @@ -import { CampaignFileRole } from '@prisma/client' -import { CampaignNews } from '../../campaignNews/entities/campaignNews.entity' -import { Person } from '../../person/entities/person.entity' + +import {CampaignFileRole} from '@prisma/client' +import {CampaignNews} from '../../campaignNews/entities/campaignNews.entity' +import {Person} from '../../person/entities/person.entity' + export class CampaignNewsFile { - id: string - filename: string - newsId: string - personId: string - mimetype: string - role: CampaignFileRole - news?: CampaignNews - person?: Person + id: string ; +filename: string ; +newsId: string ; +personId: string ; +mimetype: string ; +role: CampaignFileRole ; +news?: CampaignNews ; +person?: Person ; } diff --git a/apps/api/src/domain/generated/campaignNewsFile/entities/index.ts b/apps/api/src/domain/generated/campaignNewsFile/entities/index.ts index 9c6fe2cab..d112cd6d7 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/entities/index.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/entities/index.ts @@ -1 +1,2 @@ -export * from './campaignNewsFile.entity' + +export * from './campaignNewsFile.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignType/dto/connect-campaignType.dto.ts b/apps/api/src/domain/generated/campaignType/dto/connect-campaignType.dto.ts index 7eb88de61..fa5c9ecf2 100644 --- a/apps/api/src/domain/generated/campaignType/dto/connect-campaignType.dto.ts +++ b/apps/api/src/domain/generated/campaignType/dto/connect-campaignType.dto.ts @@ -1,4 +1,6 @@ -export class ConnectCampaignTypeDto { - id?: string - slug?: string -} + + export class ConnectCampaignTypeDto { + id?: string; +slug?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignType/dto/create-campaignType.dto.ts b/apps/api/src/domain/generated/campaignType/dto/create-campaignType.dto.ts index 3e3c3a04c..588de0cad 100644 --- a/apps/api/src/domain/generated/campaignType/dto/create-campaignType.dto.ts +++ b/apps/api/src/domain/generated/campaignType/dto/create-campaignType.dto.ts @@ -1,5 +1,11 @@ + + + + + + export class CreateCampaignTypeDto { - name: string - slug: string - description?: string + name: string; +slug: string; +description?: string; } diff --git a/apps/api/src/domain/generated/campaignType/dto/index.ts b/apps/api/src/domain/generated/campaignType/dto/index.ts index a3d17f0f1..6ce9a2e56 100644 --- a/apps/api/src/domain/generated/campaignType/dto/index.ts +++ b/apps/api/src/domain/generated/campaignType/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-campaignType.dto' -export * from './create-campaignType.dto' -export * from './update-campaignType.dto' + +export * from './connect-campaignType.dto'; +export * from './create-campaignType.dto'; +export * from './update-campaignType.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/campaignType/dto/update-campaignType.dto.ts b/apps/api/src/domain/generated/campaignType/dto/update-campaignType.dto.ts index 42116f6ff..4ccebd4cd 100644 --- a/apps/api/src/domain/generated/campaignType/dto/update-campaignType.dto.ts +++ b/apps/api/src/domain/generated/campaignType/dto/update-campaignType.dto.ts @@ -1,5 +1,11 @@ + + + + + + export class UpdateCampaignTypeDto { - name?: string - slug?: string - description?: string + name?: string; +slug?: string; +description?: string; } diff --git a/apps/api/src/domain/generated/campaignType/entities/campaignType.entity.ts b/apps/api/src/domain/generated/campaignType/entities/campaignType.entity.ts index eedb6679e..d9ff4a1af 100644 --- a/apps/api/src/domain/generated/campaignType/entities/campaignType.entity.ts +++ b/apps/api/src/domain/generated/campaignType/entities/campaignType.entity.ts @@ -1,14 +1,16 @@ -import { CampaignTypeCategory } from '@prisma/client' -import { Campaign } from '../../campaign/entities/campaign.entity' + +import {CampaignTypeCategory} from '@prisma/client' +import {Campaign} from '../../campaign/entities/campaign.entity' + export class CampaignType { - id: string - name: string - slug: string - description: string | null - parentId: string | null - category: CampaignTypeCategory - parent?: CampaignType | null - children?: CampaignType[] - campaigns?: Campaign[] + id: string ; +name: string ; +slug: string ; +description: string | null; +parentId: string | null; +category: CampaignTypeCategory ; +parent?: CampaignType | null; +children?: CampaignType[] ; +campaigns?: Campaign[] ; } diff --git a/apps/api/src/domain/generated/campaignType/entities/index.ts b/apps/api/src/domain/generated/campaignType/entities/index.ts index 69de9cc0f..fd1c4c73c 100644 --- a/apps/api/src/domain/generated/campaignType/entities/index.ts +++ b/apps/api/src/domain/generated/campaignType/entities/index.ts @@ -1 +1,2 @@ -export * from './campaignType.entity' + +export * from './campaignType.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/city/dto/connect-city.dto.ts b/apps/api/src/domain/generated/city/dto/connect-city.dto.ts index f02778b3e..2c8ae2e64 100644 --- a/apps/api/src/domain/generated/city/dto/connect-city.dto.ts +++ b/apps/api/src/domain/generated/city/dto/connect-city.dto.ts @@ -1,4 +1,6 @@ -export class ConnectCityDto { - id?: string - postalCode?: string -} + + export class ConnectCityDto { + id?: string; +postalCode?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/city/dto/create-city.dto.ts b/apps/api/src/domain/generated/city/dto/create-city.dto.ts index 56f37e88c..68b2a51f6 100644 --- a/apps/api/src/domain/generated/city/dto/create-city.dto.ts +++ b/apps/api/src/domain/generated/city/dto/create-city.dto.ts @@ -1,4 +1,10 @@ + + + + + + export class CreateCityDto { - name: string - postalCode: string + name: string; +postalCode: string; } diff --git a/apps/api/src/domain/generated/city/dto/index.ts b/apps/api/src/domain/generated/city/dto/index.ts index b823bfd61..1b6315c72 100644 --- a/apps/api/src/domain/generated/city/dto/index.ts +++ b/apps/api/src/domain/generated/city/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-city.dto' -export * from './create-city.dto' -export * from './update-city.dto' + +export * from './connect-city.dto'; +export * from './create-city.dto'; +export * from './update-city.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/city/dto/update-city.dto.ts b/apps/api/src/domain/generated/city/dto/update-city.dto.ts index 0099660af..fc6630b75 100644 --- a/apps/api/src/domain/generated/city/dto/update-city.dto.ts +++ b/apps/api/src/domain/generated/city/dto/update-city.dto.ts @@ -1,4 +1,10 @@ + + + + + + export class UpdateCityDto { - name?: string - postalCode?: string + name?: string; +postalCode?: string; } diff --git a/apps/api/src/domain/generated/city/entities/city.entity.ts b/apps/api/src/domain/generated/city/entities/city.entity.ts index 99ef221ca..004ec33f2 100644 --- a/apps/api/src/domain/generated/city/entities/city.entity.ts +++ b/apps/api/src/domain/generated/city/entities/city.entity.ts @@ -1,11 +1,13 @@ -import { Country } from '../../country/entities/country.entity' -import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' + +import {Country} from '../../country/entities/country.entity' +import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' + export class City { - id: string - name: string - postalCode: string - countryId: string - countryCode?: Country - beneficiaries?: Beneficiary[] + id: string ; +name: string ; +postalCode: string ; +countryId: string ; +countryCode?: Country ; +beneficiaries?: Beneficiary[] ; } diff --git a/apps/api/src/domain/generated/city/entities/index.ts b/apps/api/src/domain/generated/city/entities/index.ts index ddeee0cf1..9e9cd504e 100644 --- a/apps/api/src/domain/generated/city/entities/index.ts +++ b/apps/api/src/domain/generated/city/entities/index.ts @@ -1 +1,2 @@ -export * from './city.entity' + +export * from './city.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/company/dto/connect-company.dto.ts b/apps/api/src/domain/generated/company/dto/connect-company.dto.ts index 5731c5a4c..40f1eb3c1 100644 --- a/apps/api/src/domain/generated/company/dto/connect-company.dto.ts +++ b/apps/api/src/domain/generated/company/dto/connect-company.dto.ts @@ -1,5 +1,7 @@ -export class ConnectCompanyDto { - id?: string - companyNumber?: string - personId?: string -} + + export class ConnectCompanyDto { + id?: string; +companyNumber?: string; +personId?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/company/dto/create-company.dto.ts b/apps/api/src/domain/generated/company/dto/create-company.dto.ts index 983a813b2..7a4ac3d62 100644 --- a/apps/api/src/domain/generated/company/dto/create-company.dto.ts +++ b/apps/api/src/domain/generated/company/dto/create-company.dto.ts @@ -1,8 +1,14 @@ + + + + + + export class CreateCompanyDto { - companyName: string - companyNumber: string - legalPersonName?: string - countryCode?: string - cityId?: string - personId?: string + companyName: string; +companyNumber: string; +legalPersonName?: string; +countryCode?: string; +cityId?: string; +personId?: string; } diff --git a/apps/api/src/domain/generated/company/dto/index.ts b/apps/api/src/domain/generated/company/dto/index.ts index 3ad34072c..5532e5f94 100644 --- a/apps/api/src/domain/generated/company/dto/index.ts +++ b/apps/api/src/domain/generated/company/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-company.dto' -export * from './create-company.dto' -export * from './update-company.dto' + +export * from './connect-company.dto'; +export * from './create-company.dto'; +export * from './update-company.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/company/dto/update-company.dto.ts b/apps/api/src/domain/generated/company/dto/update-company.dto.ts index adf9c0db7..8950f3284 100644 --- a/apps/api/src/domain/generated/company/dto/update-company.dto.ts +++ b/apps/api/src/domain/generated/company/dto/update-company.dto.ts @@ -1,8 +1,14 @@ + + + + + + export class UpdateCompanyDto { - companyName?: string - companyNumber?: string - legalPersonName?: string - countryCode?: string - cityId?: string - personId?: string + companyName?: string; +companyNumber?: string; +legalPersonName?: string; +countryCode?: string; +cityId?: string; +personId?: string; } diff --git a/apps/api/src/domain/generated/company/entities/company.entity.ts b/apps/api/src/domain/generated/company/entities/company.entity.ts index d577baea1..0c52549c0 100644 --- a/apps/api/src/domain/generated/company/entities/company.entity.ts +++ b/apps/api/src/domain/generated/company/entities/company.entity.ts @@ -1,20 +1,22 @@ -import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' -import { Campaign } from '../../campaign/entities/campaign.entity' -import { Person } from '../../person/entities/person.entity' -import { Affiliate } from '../../affiliate/entities/affiliate.entity' + +import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' +import {Campaign} from '../../campaign/entities/campaign.entity' +import {Person} from '../../person/entities/person.entity' +import {Affiliate} from '../../affiliate/entities/affiliate.entity' + export class Company { - id: string - companyName: string - companyNumber: string - legalPersonName: string | null - countryCode: string | null - cityId: string | null - personId: string | null - createdAt: Date - updatedAt: Date | null - beneficiaries?: Beneficiary[] - Campaign?: Campaign[] - person?: Person | null - affiliate?: Affiliate | null + id: string ; +companyName: string ; +companyNumber: string ; +legalPersonName: string | null; +countryCode: string | null; +cityId: string | null; +personId: string | null; +createdAt: Date ; +updatedAt: Date | null; +beneficiaries?: Beneficiary[] ; +Campaign?: Campaign[] ; +person?: Person | null; +affiliate?: Affiliate | null; } diff --git a/apps/api/src/domain/generated/company/entities/index.ts b/apps/api/src/domain/generated/company/entities/index.ts index 9c8b84bf6..7635c0271 100644 --- a/apps/api/src/domain/generated/company/entities/index.ts +++ b/apps/api/src/domain/generated/company/entities/index.ts @@ -1 +1,2 @@ -export * from './company.entity' + +export * from './company.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/coordinator/dto/connect-coordinator.dto.ts b/apps/api/src/domain/generated/coordinator/dto/connect-coordinator.dto.ts index dd9430f4e..10f4bcbf0 100644 --- a/apps/api/src/domain/generated/coordinator/dto/connect-coordinator.dto.ts +++ b/apps/api/src/domain/generated/coordinator/dto/connect-coordinator.dto.ts @@ -1,4 +1,6 @@ -export class ConnectCoordinatorDto { - id?: string - personId?: string -} + + export class ConnectCoordinatorDto { + id?: string; +personId?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/coordinator/dto/create-coordinator.dto.ts b/apps/api/src/domain/generated/coordinator/dto/create-coordinator.dto.ts index bfb4f7a4f..f45f8e364 100644 --- a/apps/api/src/domain/generated/coordinator/dto/create-coordinator.dto.ts +++ b/apps/api/src/domain/generated/coordinator/dto/create-coordinator.dto.ts @@ -1 +1,9 @@ -export class CreateCoordinatorDto {} + + + + + + +export class CreateCoordinatorDto { + +} diff --git a/apps/api/src/domain/generated/coordinator/dto/index.ts b/apps/api/src/domain/generated/coordinator/dto/index.ts index e52a4a99f..912f2a219 100644 --- a/apps/api/src/domain/generated/coordinator/dto/index.ts +++ b/apps/api/src/domain/generated/coordinator/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-coordinator.dto' -export * from './create-coordinator.dto' -export * from './update-coordinator.dto' + +export * from './connect-coordinator.dto'; +export * from './create-coordinator.dto'; +export * from './update-coordinator.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/coordinator/dto/update-coordinator.dto.ts b/apps/api/src/domain/generated/coordinator/dto/update-coordinator.dto.ts index 6824eaff4..87b6a5c64 100644 --- a/apps/api/src/domain/generated/coordinator/dto/update-coordinator.dto.ts +++ b/apps/api/src/domain/generated/coordinator/dto/update-coordinator.dto.ts @@ -1 +1,9 @@ -export class UpdateCoordinatorDto {} + + + + + + +export class UpdateCoordinatorDto { + +} diff --git a/apps/api/src/domain/generated/coordinator/entities/coordinator.entity.ts b/apps/api/src/domain/generated/coordinator/entities/coordinator.entity.ts index 1cc86fdc1..deeb9fa2c 100644 --- a/apps/api/src/domain/generated/coordinator/entities/coordinator.entity.ts +++ b/apps/api/src/domain/generated/coordinator/entities/coordinator.entity.ts @@ -1,13 +1,15 @@ -import { Person } from '../../person/entities/person.entity' -import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' -import { Campaign } from '../../campaign/entities/campaign.entity' + +import {Person} from '../../person/entities/person.entity' +import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' +import {Campaign} from '../../campaign/entities/campaign.entity' + export class Coordinator { - id: string - personId: string - createdAt: Date - updatedAt: Date | null - person?: Person - beneficiaries?: Beneficiary[] - campaigns?: Campaign[] + id: string ; +personId: string ; +createdAt: Date ; +updatedAt: Date | null; +person?: Person ; +beneficiaries?: Beneficiary[] ; +campaigns?: Campaign[] ; } diff --git a/apps/api/src/domain/generated/coordinator/entities/index.ts b/apps/api/src/domain/generated/coordinator/entities/index.ts index c0710e67a..49b128a1a 100644 --- a/apps/api/src/domain/generated/coordinator/entities/index.ts +++ b/apps/api/src/domain/generated/coordinator/entities/index.ts @@ -1 +1,2 @@ -export * from './coordinator.entity' + +export * from './coordinator.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/country/dto/connect-country.dto.ts b/apps/api/src/domain/generated/country/dto/connect-country.dto.ts index 7f793b9f6..7fdcf366f 100644 --- a/apps/api/src/domain/generated/country/dto/connect-country.dto.ts +++ b/apps/api/src/domain/generated/country/dto/connect-country.dto.ts @@ -1,4 +1,6 @@ -export class ConnectCountryDto { - id?: string - countryCode?: string -} + + export class ConnectCountryDto { + id?: string; +countryCode?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/country/dto/create-country.dto.ts b/apps/api/src/domain/generated/country/dto/create-country.dto.ts index 0e823c597..b16cd9dbc 100644 --- a/apps/api/src/domain/generated/country/dto/create-country.dto.ts +++ b/apps/api/src/domain/generated/country/dto/create-country.dto.ts @@ -1,4 +1,10 @@ + + + + + + export class CreateCountryDto { - name: string - countryCode: string + name: string; +countryCode: string; } diff --git a/apps/api/src/domain/generated/country/dto/index.ts b/apps/api/src/domain/generated/country/dto/index.ts index 9284b8275..22d45c644 100644 --- a/apps/api/src/domain/generated/country/dto/index.ts +++ b/apps/api/src/domain/generated/country/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-country.dto' -export * from './create-country.dto' -export * from './update-country.dto' + +export * from './connect-country.dto'; +export * from './create-country.dto'; +export * from './update-country.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/country/dto/update-country.dto.ts b/apps/api/src/domain/generated/country/dto/update-country.dto.ts index b3406fd6c..f502eb44b 100644 --- a/apps/api/src/domain/generated/country/dto/update-country.dto.ts +++ b/apps/api/src/domain/generated/country/dto/update-country.dto.ts @@ -1,4 +1,10 @@ + + + + + + export class UpdateCountryDto { - name?: string - countryCode?: string + name?: string; +countryCode?: string; } diff --git a/apps/api/src/domain/generated/country/entities/country.entity.ts b/apps/api/src/domain/generated/country/entities/country.entity.ts index 4b45fd1fa..b71be4438 100644 --- a/apps/api/src/domain/generated/country/entities/country.entity.ts +++ b/apps/api/src/domain/generated/country/entities/country.entity.ts @@ -1,8 +1,10 @@ -import { City } from '../../city/entities/city.entity' + +import {City} from '../../city/entities/city.entity' + export class Country { - id: string - name: string - countryCode: string - cities?: City[] + id: string ; +name: string ; +countryCode: string ; +cities?: City[] ; } diff --git a/apps/api/src/domain/generated/country/entities/index.ts b/apps/api/src/domain/generated/country/entities/index.ts index 1e3b72c86..d160a811d 100644 --- a/apps/api/src/domain/generated/country/entities/index.ts +++ b/apps/api/src/domain/generated/country/entities/index.ts @@ -1 +1,2 @@ -export * from './country.entity' + +export * from './country.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/document/dto/connect-document.dto.ts b/apps/api/src/domain/generated/document/dto/connect-document.dto.ts index 3a84611a9..a03a5c496 100644 --- a/apps/api/src/domain/generated/document/dto/connect-document.dto.ts +++ b/apps/api/src/domain/generated/document/dto/connect-document.dto.ts @@ -1,3 +1,5 @@ -export class ConnectDocumentDto { - id: string -} + + export class ConnectDocumentDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/document/dto/create-document.dto.ts b/apps/api/src/domain/generated/document/dto/create-document.dto.ts index 3a627f38c..4e9aadf14 100644 --- a/apps/api/src/domain/generated/document/dto/create-document.dto.ts +++ b/apps/api/src/domain/generated/document/dto/create-document.dto.ts @@ -1,12 +1,16 @@ -import { DocumentType } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {DocumentType} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateDocumentDto { - @ApiProperty({ enum: DocumentType }) - type: DocumentType - name: string - filename: string - filetype?: string - description?: string - sourceUrl: string + @ApiProperty({ enum: DocumentType}) +type: DocumentType; +name: string; +filename: string; +filetype?: string; +description?: string; +sourceUrl: string; } diff --git a/apps/api/src/domain/generated/document/dto/index.ts b/apps/api/src/domain/generated/document/dto/index.ts index 5bc2bdf4a..23dc27179 100644 --- a/apps/api/src/domain/generated/document/dto/index.ts +++ b/apps/api/src/domain/generated/document/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-document.dto' -export * from './create-document.dto' -export * from './update-document.dto' + +export * from './connect-document.dto'; +export * from './create-document.dto'; +export * from './update-document.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/document/dto/update-document.dto.ts b/apps/api/src/domain/generated/document/dto/update-document.dto.ts index 71d92c7ea..5af3aa1b0 100644 --- a/apps/api/src/domain/generated/document/dto/update-document.dto.ts +++ b/apps/api/src/domain/generated/document/dto/update-document.dto.ts @@ -1,12 +1,16 @@ -import { DocumentType } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {DocumentType} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateDocumentDto { - @ApiProperty({ enum: DocumentType }) - type?: DocumentType - name?: string - filename?: string - filetype?: string - description?: string - sourceUrl?: string + @ApiProperty({ enum: DocumentType}) +type?: DocumentType; +name?: string; +filename?: string; +filetype?: string; +description?: string; +sourceUrl?: string; } diff --git a/apps/api/src/domain/generated/document/entities/document.entity.ts b/apps/api/src/domain/generated/document/entities/document.entity.ts index 460b25233..7dc06e018 100644 --- a/apps/api/src/domain/generated/document/entities/document.entity.ts +++ b/apps/api/src/domain/generated/document/entities/document.entity.ts @@ -1,16 +1,18 @@ -import { DocumentType } from '@prisma/client' -import { Person } from '../../person/entities/person.entity' -import { Expense } from '../../expense/entities/expense.entity' + +import {DocumentType} from '@prisma/client' +import {Person} from '../../person/entities/person.entity' +import {Expense} from '../../expense/entities/expense.entity' + export class Document { - id: string - type: DocumentType - name: string - filename: string - filetype: string | null - description: string | null - sourceUrl: string - ownerId: string - owner?: Person - expenses?: Expense[] + id: string ; +type: DocumentType ; +name: string ; +filename: string ; +filetype: string | null; +description: string | null; +sourceUrl: string ; +ownerId: string ; +owner?: Person ; +expenses?: Expense[] ; } diff --git a/apps/api/src/domain/generated/document/entities/index.ts b/apps/api/src/domain/generated/document/entities/index.ts index 5170971ae..e56503c0c 100644 --- a/apps/api/src/domain/generated/document/entities/index.ts +++ b/apps/api/src/domain/generated/document/entities/index.ts @@ -1 +1,2 @@ -export * from './document.entity' + +export * from './document.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/donation/dto/connect-donation.dto.ts b/apps/api/src/domain/generated/donation/dto/connect-donation.dto.ts index a5015856d..36fcb2358 100644 --- a/apps/api/src/domain/generated/donation/dto/connect-donation.dto.ts +++ b/apps/api/src/domain/generated/donation/dto/connect-donation.dto.ts @@ -1,4 +1,6 @@ -export class ConnectDonationDto { - id?: string - extPaymentIntentId?: string -} + + export class ConnectDonationDto { + id?: string; +extPaymentIntentId?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/donation/dto/create-donation.dto.ts b/apps/api/src/domain/generated/donation/dto/create-donation.dto.ts index e447208dc..3d93f8af7 100644 --- a/apps/api/src/domain/generated/donation/dto/create-donation.dto.ts +++ b/apps/api/src/domain/generated/donation/dto/create-donation.dto.ts @@ -1,12 +1,16 @@ -import { DonationType } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {DonationType} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateDonationDto { - @ApiProperty({ enum: DonationType }) - type: DonationType - extCustomerId: string - extPaymentIntentId: string - extPaymentMethodId: string - billingEmail?: string - billingName?: string + @ApiProperty({ enum: DonationType}) +type: DonationType; +extCustomerId: string; +extPaymentIntentId: string; +extPaymentMethodId: string; +billingEmail?: string; +billingName?: string; } diff --git a/apps/api/src/domain/generated/donation/dto/index.ts b/apps/api/src/domain/generated/donation/dto/index.ts index 4c9722733..b0e424478 100644 --- a/apps/api/src/domain/generated/donation/dto/index.ts +++ b/apps/api/src/domain/generated/donation/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-donation.dto' -export * from './create-donation.dto' -export * from './update-donation.dto' + +export * from './connect-donation.dto'; +export * from './create-donation.dto'; +export * from './update-donation.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/donation/dto/update-donation.dto.ts b/apps/api/src/domain/generated/donation/dto/update-donation.dto.ts index c88603166..7caea543d 100644 --- a/apps/api/src/domain/generated/donation/dto/update-donation.dto.ts +++ b/apps/api/src/domain/generated/donation/dto/update-donation.dto.ts @@ -1,12 +1,16 @@ -import { DonationType } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {DonationType} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateDonationDto { - @ApiProperty({ enum: DonationType }) - type?: DonationType - extCustomerId?: string - extPaymentIntentId?: string - extPaymentMethodId?: string - billingEmail?: string - billingName?: string + @ApiProperty({ enum: DonationType}) +type?: DonationType; +extCustomerId?: string; +extPaymentIntentId?: string; +extPaymentMethodId?: string; +billingEmail?: string; +billingName?: string; } diff --git a/apps/api/src/domain/generated/donation/entities/donation.entity.ts b/apps/api/src/domain/generated/donation/entities/donation.entity.ts index 57fc0ce8b..003899405 100644 --- a/apps/api/src/domain/generated/donation/entities/donation.entity.ts +++ b/apps/api/src/domain/generated/donation/entities/donation.entity.ts @@ -1,31 +1,33 @@ -import { DonationType, DonationStatus, PaymentProvider, Currency } from '@prisma/client' -import { Person } from '../../person/entities/person.entity' -import { Vault } from '../../vault/entities/vault.entity' -import { Affiliate } from '../../affiliate/entities/affiliate.entity' -import { DonationWish } from '../../donationWish/entities/donationWish.entity' -import { DonationMetadata } from '../../donationMetadata/entities/donationMetadata.entity' + +import {DonationType,DonationStatus,PaymentProvider,Currency} from '@prisma/client' +import {Person} from '../../person/entities/person.entity' +import {Vault} from '../../vault/entities/vault.entity' +import {Affiliate} from '../../affiliate/entities/affiliate.entity' +import {DonationWish} from '../../donationWish/entities/donationWish.entity' +import {DonationMetadata} from '../../donationMetadata/entities/donationMetadata.entity' + export class Donation { - id: string - type: DonationType - status: DonationStatus - provider: PaymentProvider - targetVaultId: string - extCustomerId: string - extPaymentIntentId: string - extPaymentMethodId: string - createdAt: Date - updatedAt: Date | null - amount: number - currency: Currency - affiliateId: string | null - personId: string | null - billingEmail: string | null - billingName: string | null - chargedAmount: number - person?: Person | null - targetVault?: Vault - affiliate?: Affiliate | null - DonationWish?: DonationWish | null - metadata?: DonationMetadata | null + id: string ; +type: DonationType ; +status: DonationStatus ; +provider: PaymentProvider ; +targetVaultId: string ; +extCustomerId: string ; +extPaymentIntentId: string ; +extPaymentMethodId: string ; +createdAt: Date ; +updatedAt: Date | null; +amount: number ; +currency: Currency ; +affiliateId: string | null; +personId: string | null; +billingEmail: string | null; +billingName: string | null; +chargedAmount: number ; +person?: Person | null; +targetVault?: Vault ; +affiliate?: Affiliate | null; +DonationWish?: DonationWish | null; +metadata?: DonationMetadata | null; } diff --git a/apps/api/src/domain/generated/donation/entities/index.ts b/apps/api/src/domain/generated/donation/entities/index.ts index f1cd626f7..19345a833 100644 --- a/apps/api/src/domain/generated/donation/entities/index.ts +++ b/apps/api/src/domain/generated/donation/entities/index.ts @@ -1 +1,2 @@ -export * from './donation.entity' + +export * from './donation.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/donationMetadata/dto/connect-donationMetadata.dto.ts b/apps/api/src/domain/generated/donationMetadata/dto/connect-donationMetadata.dto.ts index 9875d62d7..04146d7f7 100644 --- a/apps/api/src/domain/generated/donationMetadata/dto/connect-donationMetadata.dto.ts +++ b/apps/api/src/domain/generated/donationMetadata/dto/connect-donationMetadata.dto.ts @@ -1,3 +1,5 @@ -export class ConnectDonationMetadataDto { - donationId: string -} + + export class ConnectDonationMetadataDto { + donationId: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/donationMetadata/dto/create-donationMetadata.dto.ts b/apps/api/src/domain/generated/donationMetadata/dto/create-donationMetadata.dto.ts index fc3917bb7..ff1cd5857 100644 --- a/apps/api/src/domain/generated/donationMetadata/dto/create-donationMetadata.dto.ts +++ b/apps/api/src/domain/generated/donationMetadata/dto/create-donationMetadata.dto.ts @@ -1,6 +1,10 @@ -import { Prisma } from '@prisma/client' + +import {Prisma} from '@prisma/client' + + + export class CreateDonationMetadataDto { - name?: string - extraData?: Prisma.InputJsonValue + name?: string; +extraData?: Prisma.InputJsonValue; } diff --git a/apps/api/src/domain/generated/donationMetadata/dto/index.ts b/apps/api/src/domain/generated/donationMetadata/dto/index.ts index f313f5d13..00ba311f1 100644 --- a/apps/api/src/domain/generated/donationMetadata/dto/index.ts +++ b/apps/api/src/domain/generated/donationMetadata/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-donationMetadata.dto' -export * from './create-donationMetadata.dto' -export * from './update-donationMetadata.dto' + +export * from './connect-donationMetadata.dto'; +export * from './create-donationMetadata.dto'; +export * from './update-donationMetadata.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/donationMetadata/dto/update-donationMetadata.dto.ts b/apps/api/src/domain/generated/donationMetadata/dto/update-donationMetadata.dto.ts index e2382d4b5..d972a6431 100644 --- a/apps/api/src/domain/generated/donationMetadata/dto/update-donationMetadata.dto.ts +++ b/apps/api/src/domain/generated/donationMetadata/dto/update-donationMetadata.dto.ts @@ -1,6 +1,10 @@ -import { Prisma } from '@prisma/client' + +import {Prisma} from '@prisma/client' + + + export class UpdateDonationMetadataDto { - name?: string - extraData?: Prisma.InputJsonValue + name?: string; +extraData?: Prisma.InputJsonValue; } diff --git a/apps/api/src/domain/generated/donationMetadata/entities/donationMetadata.entity.ts b/apps/api/src/domain/generated/donationMetadata/entities/donationMetadata.entity.ts index 59e23cdb4..8f79eae96 100644 --- a/apps/api/src/domain/generated/donationMetadata/entities/donationMetadata.entity.ts +++ b/apps/api/src/domain/generated/donationMetadata/entities/donationMetadata.entity.ts @@ -1,10 +1,12 @@ -import { Prisma } from '@prisma/client' -import { Donation } from '../../donation/entities/donation.entity' + +import {Prisma} from '@prisma/client' +import {Donation} from '../../donation/entities/donation.entity' + export class DonationMetadata { - donationId: string - name: string | null - createdAt: Date - extraData: Prisma.JsonValue | null - donation?: Donation + donationId: string ; +name: string | null; +createdAt: Date ; +extraData: Prisma.JsonValue | null; +donation?: Donation ; } diff --git a/apps/api/src/domain/generated/donationMetadata/entities/index.ts b/apps/api/src/domain/generated/donationMetadata/entities/index.ts index c995d374a..3b0ebdaaa 100644 --- a/apps/api/src/domain/generated/donationMetadata/entities/index.ts +++ b/apps/api/src/domain/generated/donationMetadata/entities/index.ts @@ -1 +1,2 @@ -export * from './donationMetadata.entity' + +export * from './donationMetadata.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/donationWish/dto/connect-donationWish.dto.ts b/apps/api/src/domain/generated/donationWish/dto/connect-donationWish.dto.ts index 1db39f218..0a22fdacb 100644 --- a/apps/api/src/domain/generated/donationWish/dto/connect-donationWish.dto.ts +++ b/apps/api/src/domain/generated/donationWish/dto/connect-donationWish.dto.ts @@ -1,4 +1,6 @@ -export class ConnectDonationWishDto { - id?: string - donationId?: string -} + + export class ConnectDonationWishDto { + id?: string; +donationId?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/donationWish/dto/create-donationWish.dto.ts b/apps/api/src/domain/generated/donationWish/dto/create-donationWish.dto.ts index bb78bc42d..f3fb7a217 100644 --- a/apps/api/src/domain/generated/donationWish/dto/create-donationWish.dto.ts +++ b/apps/api/src/domain/generated/donationWish/dto/create-donationWish.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class CreateDonationWishDto { - message: string + message: string; } diff --git a/apps/api/src/domain/generated/donationWish/dto/index.ts b/apps/api/src/domain/generated/donationWish/dto/index.ts index 5e71d99de..4f6533391 100644 --- a/apps/api/src/domain/generated/donationWish/dto/index.ts +++ b/apps/api/src/domain/generated/donationWish/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-donationWish.dto' -export * from './create-donationWish.dto' -export * from './update-donationWish.dto' + +export * from './connect-donationWish.dto'; +export * from './create-donationWish.dto'; +export * from './update-donationWish.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/donationWish/dto/update-donationWish.dto.ts b/apps/api/src/domain/generated/donationWish/dto/update-donationWish.dto.ts index ece50305f..e133cbbd2 100644 --- a/apps/api/src/domain/generated/donationWish/dto/update-donationWish.dto.ts +++ b/apps/api/src/domain/generated/donationWish/dto/update-donationWish.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class UpdateDonationWishDto { - message?: string + message?: string; } diff --git a/apps/api/src/domain/generated/donationWish/entities/donationWish.entity.ts b/apps/api/src/domain/generated/donationWish/entities/donationWish.entity.ts index 731ac8a43..4eec6c75c 100644 --- a/apps/api/src/domain/generated/donationWish/entities/donationWish.entity.ts +++ b/apps/api/src/domain/generated/donationWish/entities/donationWish.entity.ts @@ -1,16 +1,18 @@ -import { Campaign } from '../../campaign/entities/campaign.entity' -import { Person } from '../../person/entities/person.entity' -import { Donation } from '../../donation/entities/donation.entity' + +import {Campaign} from '../../campaign/entities/campaign.entity' +import {Person} from '../../person/entities/person.entity' +import {Donation} from '../../donation/entities/donation.entity' + export class DonationWish { - id: string - message: string - campaignId: string - personId: string | null - donationId: string | null - createdAt: Date - updatedAt: Date | null - campaign?: Campaign - person?: Person | null - donation?: Donation | null + id: string ; +message: string ; +campaignId: string ; +personId: string | null; +donationId: string | null; +createdAt: Date ; +updatedAt: Date | null; +campaign?: Campaign ; +person?: Person | null; +donation?: Donation | null; } diff --git a/apps/api/src/domain/generated/donationWish/entities/index.ts b/apps/api/src/domain/generated/donationWish/entities/index.ts index 3603a8ab3..fb2d563dd 100644 --- a/apps/api/src/domain/generated/donationWish/entities/index.ts +++ b/apps/api/src/domain/generated/donationWish/entities/index.ts @@ -1 +1,2 @@ -export * from './donationWish.entity' + +export * from './donationWish.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/emailSentRegistry/dto/connect-emailSentRegistry.dto.ts b/apps/api/src/domain/generated/emailSentRegistry/dto/connect-emailSentRegistry.dto.ts index 72f1ce6c6..1d7870fc8 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/dto/connect-emailSentRegistry.dto.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/dto/connect-emailSentRegistry.dto.ts @@ -1,3 +1,5 @@ -export class ConnectEmailSentRegistryDto { - id: string -} + + export class ConnectEmailSentRegistryDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/emailSentRegistry/dto/create-emailSentRegistry.dto.ts b/apps/api/src/domain/generated/emailSentRegistry/dto/create-emailSentRegistry.dto.ts index 2d33b5baa..b4f5dd42b 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/dto/create-emailSentRegistry.dto.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/dto/create-emailSentRegistry.dto.ts @@ -1,10 +1,14 @@ -import { EmailType } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {EmailType} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateEmailSentRegistryDto { - email: string - dateSent: Date - campaignId?: string - @ApiProperty({ enum: EmailType }) - type: EmailType + email: string; +dateSent: Date; +campaignId?: string; +@ApiProperty({ enum: EmailType}) +type: EmailType; } diff --git a/apps/api/src/domain/generated/emailSentRegistry/dto/index.ts b/apps/api/src/domain/generated/emailSentRegistry/dto/index.ts index c743ad0b8..8fe532c07 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/dto/index.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-emailSentRegistry.dto' -export * from './create-emailSentRegistry.dto' -export * from './update-emailSentRegistry.dto' + +export * from './connect-emailSentRegistry.dto'; +export * from './create-emailSentRegistry.dto'; +export * from './update-emailSentRegistry.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/emailSentRegistry/dto/update-emailSentRegistry.dto.ts b/apps/api/src/domain/generated/emailSentRegistry/dto/update-emailSentRegistry.dto.ts index 744d93257..773e9209f 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/dto/update-emailSentRegistry.dto.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/dto/update-emailSentRegistry.dto.ts @@ -1,10 +1,14 @@ -import { EmailType } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {EmailType} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateEmailSentRegistryDto { - email?: string - dateSent?: Date - campaignId?: string - @ApiProperty({ enum: EmailType }) - type?: EmailType + email?: string; +dateSent?: Date; +campaignId?: string; +@ApiProperty({ enum: EmailType}) +type?: EmailType; } diff --git a/apps/api/src/domain/generated/emailSentRegistry/entities/emailSentRegistry.entity.ts b/apps/api/src/domain/generated/emailSentRegistry/entities/emailSentRegistry.entity.ts index c936a22ec..7881993d7 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/entities/emailSentRegistry.entity.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/entities/emailSentRegistry.entity.ts @@ -1,9 +1,11 @@ -import { EmailType } from '@prisma/client' + +import {EmailType} from '@prisma/client' + export class EmailSentRegistry { - id: string - email: string - dateSent: Date - campaignId: string | null - type: EmailType + id: string ; +email: string ; +dateSent: Date ; +campaignId: string | null; +type: EmailType ; } diff --git a/apps/api/src/domain/generated/emailSentRegistry/entities/index.ts b/apps/api/src/domain/generated/emailSentRegistry/entities/index.ts index 99aa635b9..69bf03d76 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/entities/index.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/entities/index.ts @@ -1 +1,2 @@ -export * from './emailSentRegistry.entity' + +export * from './emailSentRegistry.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/expense/dto/connect-expense.dto.ts b/apps/api/src/domain/generated/expense/dto/connect-expense.dto.ts index 232d459d5..765441b8b 100644 --- a/apps/api/src/domain/generated/expense/dto/connect-expense.dto.ts +++ b/apps/api/src/domain/generated/expense/dto/connect-expense.dto.ts @@ -1,3 +1,5 @@ -export class ConnectExpenseDto { - id: string -} + + export class ConnectExpenseDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/expense/dto/create-expense.dto.ts b/apps/api/src/domain/generated/expense/dto/create-expense.dto.ts index f5dbe6346..44a9d9fbd 100644 --- a/apps/api/src/domain/generated/expense/dto/create-expense.dto.ts +++ b/apps/api/src/domain/generated/expense/dto/create-expense.dto.ts @@ -1,10 +1,14 @@ -import { ExpenseType, ExpenseStatus } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {ExpenseType,ExpenseStatus} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateExpenseDto { - @ApiProperty({ enum: ExpenseType }) - type: ExpenseType - description?: string - @ApiProperty({ enum: ExpenseStatus }) - status: ExpenseStatus + @ApiProperty({ enum: ExpenseType}) +type: ExpenseType; +description?: string; +@ApiProperty({ enum: ExpenseStatus}) +status: ExpenseStatus; } diff --git a/apps/api/src/domain/generated/expense/dto/index.ts b/apps/api/src/domain/generated/expense/dto/index.ts index a83042912..6271ca029 100644 --- a/apps/api/src/domain/generated/expense/dto/index.ts +++ b/apps/api/src/domain/generated/expense/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-expense.dto' -export * from './create-expense.dto' -export * from './update-expense.dto' + +export * from './connect-expense.dto'; +export * from './create-expense.dto'; +export * from './update-expense.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/expense/dto/update-expense.dto.ts b/apps/api/src/domain/generated/expense/dto/update-expense.dto.ts index 0cb9cfdcb..48031311e 100644 --- a/apps/api/src/domain/generated/expense/dto/update-expense.dto.ts +++ b/apps/api/src/domain/generated/expense/dto/update-expense.dto.ts @@ -1,10 +1,14 @@ -import { ExpenseType, ExpenseStatus } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {ExpenseType,ExpenseStatus} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateExpenseDto { - @ApiProperty({ enum: ExpenseType }) - type?: ExpenseType - description?: string - @ApiProperty({ enum: ExpenseStatus }) - status?: ExpenseStatus + @ApiProperty({ enum: ExpenseType}) +type?: ExpenseType; +description?: string; +@ApiProperty({ enum: ExpenseStatus}) +status?: ExpenseStatus; } diff --git a/apps/api/src/domain/generated/expense/entities/expense.entity.ts b/apps/api/src/domain/generated/expense/entities/expense.entity.ts index 26750219b..984046039 100644 --- a/apps/api/src/domain/generated/expense/entities/expense.entity.ts +++ b/apps/api/src/domain/generated/expense/entities/expense.entity.ts @@ -1,23 +1,25 @@ -import { ExpenseType, Currency, ExpenseStatus } from '@prisma/client' -import { Person } from '../../person/entities/person.entity' -import { Document } from '../../document/entities/document.entity' -import { Vault } from '../../vault/entities/vault.entity' -import { ExpenseFile } from '../../expenseFile/entities/expenseFile.entity' + +import {ExpenseType,Currency,ExpenseStatus} from '@prisma/client' +import {Person} from '../../person/entities/person.entity' +import {Document} from '../../document/entities/document.entity' +import {Vault} from '../../vault/entities/vault.entity' +import {ExpenseFile} from '../../expenseFile/entities/expenseFile.entity' + export class Expense { - id: string - type: ExpenseType - description: string | null - vaultId: string - documentId: string | null - approvedById: string | null - amount: number - currency: Currency - status: ExpenseStatus - deleted: boolean - approvedBy?: Person | null - document?: Document | null - vault?: Vault - spentAt: Date - expenseFiles?: ExpenseFile[] + id: string ; +type: ExpenseType ; +description: string | null; +vaultId: string ; +documentId: string | null; +approvedById: string | null; +amount: number ; +currency: Currency ; +status: ExpenseStatus ; +deleted: boolean ; +approvedBy?: Person | null; +document?: Document | null; +vault?: Vault ; +spentAt: Date ; +expenseFiles?: ExpenseFile[] ; } diff --git a/apps/api/src/domain/generated/expense/entities/index.ts b/apps/api/src/domain/generated/expense/entities/index.ts index 92a38afcb..3ff675058 100644 --- a/apps/api/src/domain/generated/expense/entities/index.ts +++ b/apps/api/src/domain/generated/expense/entities/index.ts @@ -1 +1,2 @@ -export * from './expense.entity' + +export * from './expense.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/expenseFile/dto/connect-expenseFile.dto.ts b/apps/api/src/domain/generated/expenseFile/dto/connect-expenseFile.dto.ts index 87147ce4c..fca306f4f 100644 --- a/apps/api/src/domain/generated/expenseFile/dto/connect-expenseFile.dto.ts +++ b/apps/api/src/domain/generated/expenseFile/dto/connect-expenseFile.dto.ts @@ -1,3 +1,5 @@ -export class ConnectExpenseFileDto { - id: string -} + + export class ConnectExpenseFileDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/expenseFile/dto/create-expenseFile.dto.ts b/apps/api/src/domain/generated/expenseFile/dto/create-expenseFile.dto.ts index d9dd8ba14..ad2ab5fc1 100644 --- a/apps/api/src/domain/generated/expenseFile/dto/create-expenseFile.dto.ts +++ b/apps/api/src/domain/generated/expenseFile/dto/create-expenseFile.dto.ts @@ -1,4 +1,10 @@ + + + + + + export class CreateExpenseFileDto { - filename: string - mimetype: string + filename: string; +mimetype: string; } diff --git a/apps/api/src/domain/generated/expenseFile/dto/index.ts b/apps/api/src/domain/generated/expenseFile/dto/index.ts index 7020f5a00..2ad77b2a2 100644 --- a/apps/api/src/domain/generated/expenseFile/dto/index.ts +++ b/apps/api/src/domain/generated/expenseFile/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-expenseFile.dto' -export * from './create-expenseFile.dto' -export * from './update-expenseFile.dto' + +export * from './connect-expenseFile.dto'; +export * from './create-expenseFile.dto'; +export * from './update-expenseFile.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/expenseFile/dto/update-expenseFile.dto.ts b/apps/api/src/domain/generated/expenseFile/dto/update-expenseFile.dto.ts index 5d6db6363..f85781276 100644 --- a/apps/api/src/domain/generated/expenseFile/dto/update-expenseFile.dto.ts +++ b/apps/api/src/domain/generated/expenseFile/dto/update-expenseFile.dto.ts @@ -1,4 +1,10 @@ + + + + + + export class UpdateExpenseFileDto { - filename?: string - mimetype?: string + filename?: string; +mimetype?: string; } diff --git a/apps/api/src/domain/generated/expenseFile/entities/expenseFile.entity.ts b/apps/api/src/domain/generated/expenseFile/entities/expenseFile.entity.ts index 325054eb7..822a1c151 100644 --- a/apps/api/src/domain/generated/expenseFile/entities/expenseFile.entity.ts +++ b/apps/api/src/domain/generated/expenseFile/entities/expenseFile.entity.ts @@ -1,12 +1,14 @@ -import { Expense } from '../../expense/entities/expense.entity' -import { Person } from '../../person/entities/person.entity' + +import {Expense} from '../../expense/entities/expense.entity' +import {Person} from '../../person/entities/person.entity' + export class ExpenseFile { - id: string - filename: string - mimetype: string - expenseId: string - uploaderId: string - expense?: Expense - uploadedBy?: Person + id: string ; +filename: string ; +mimetype: string ; +expenseId: string ; +uploaderId: string ; +expense?: Expense ; +uploadedBy?: Person ; } diff --git a/apps/api/src/domain/generated/expenseFile/entities/index.ts b/apps/api/src/domain/generated/expenseFile/entities/index.ts index 61115da08..e86acc0e4 100644 --- a/apps/api/src/domain/generated/expenseFile/entities/index.ts +++ b/apps/api/src/domain/generated/expenseFile/entities/index.ts @@ -1 +1,2 @@ -export * from './expenseFile.entity' + +export * from './expenseFile.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/infoRequest/dto/connect-infoRequest.dto.ts b/apps/api/src/domain/generated/infoRequest/dto/connect-infoRequest.dto.ts index 6f64361bf..b0f67d810 100644 --- a/apps/api/src/domain/generated/infoRequest/dto/connect-infoRequest.dto.ts +++ b/apps/api/src/domain/generated/infoRequest/dto/connect-infoRequest.dto.ts @@ -1,3 +1,5 @@ -export class ConnectInfoRequestDto { - id: string -} + + export class ConnectInfoRequestDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/infoRequest/dto/create-infoRequest.dto.ts b/apps/api/src/domain/generated/infoRequest/dto/create-infoRequest.dto.ts index 0fb8b87ae..36ea6f3ca 100644 --- a/apps/api/src/domain/generated/infoRequest/dto/create-infoRequest.dto.ts +++ b/apps/api/src/domain/generated/infoRequest/dto/create-infoRequest.dto.ts @@ -1,4 +1,10 @@ + + + + + + export class CreateInfoRequestDto { - message: string - deletedAt?: Date + message: string; +deletedAt?: Date; } diff --git a/apps/api/src/domain/generated/infoRequest/dto/index.ts b/apps/api/src/domain/generated/infoRequest/dto/index.ts index 5ed53ece6..f51868edf 100644 --- a/apps/api/src/domain/generated/infoRequest/dto/index.ts +++ b/apps/api/src/domain/generated/infoRequest/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-infoRequest.dto' -export * from './create-infoRequest.dto' -export * from './update-infoRequest.dto' + +export * from './connect-infoRequest.dto'; +export * from './create-infoRequest.dto'; +export * from './update-infoRequest.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/infoRequest/dto/update-infoRequest.dto.ts b/apps/api/src/domain/generated/infoRequest/dto/update-infoRequest.dto.ts index 591f3cfb9..3e3bafbd5 100644 --- a/apps/api/src/domain/generated/infoRequest/dto/update-infoRequest.dto.ts +++ b/apps/api/src/domain/generated/infoRequest/dto/update-infoRequest.dto.ts @@ -1,4 +1,10 @@ + + + + + + export class UpdateInfoRequestDto { - message?: string - deletedAt?: Date + message?: string; +deletedAt?: Date; } diff --git a/apps/api/src/domain/generated/infoRequest/entities/index.ts b/apps/api/src/domain/generated/infoRequest/entities/index.ts index 86407b245..ed02c039a 100644 --- a/apps/api/src/domain/generated/infoRequest/entities/index.ts +++ b/apps/api/src/domain/generated/infoRequest/entities/index.ts @@ -1 +1,2 @@ -export * from './infoRequest.entity' + +export * from './infoRequest.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/infoRequest/entities/infoRequest.entity.ts b/apps/api/src/domain/generated/infoRequest/entities/infoRequest.entity.ts index 310939146..a4bf957dd 100644 --- a/apps/api/src/domain/generated/infoRequest/entities/infoRequest.entity.ts +++ b/apps/api/src/domain/generated/infoRequest/entities/infoRequest.entity.ts @@ -1,11 +1,13 @@ -import { Person } from '../../person/entities/person.entity' + +import {Person} from '../../person/entities/person.entity' + export class InfoRequest { - id: string - personId: string - message: string - createdAt: Date - updatedAt: Date | null - deletedAt: Date | null - person?: Person + id: string ; +personId: string ; +message: string ; +createdAt: Date ; +updatedAt: Date | null; +deletedAt: Date | null; +person?: Person ; } diff --git a/apps/api/src/domain/generated/irregularity/dto/connect-irregularity.dto.ts b/apps/api/src/domain/generated/irregularity/dto/connect-irregularity.dto.ts index 2de4c0e8b..6d38ef2fb 100644 --- a/apps/api/src/domain/generated/irregularity/dto/connect-irregularity.dto.ts +++ b/apps/api/src/domain/generated/irregularity/dto/connect-irregularity.dto.ts @@ -1,3 +1,5 @@ -export class ConnectIrregularityDto { - id: string -} + + export class ConnectIrregularityDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/irregularity/dto/create-irregularity.dto.ts b/apps/api/src/domain/generated/irregularity/dto/create-irregularity.dto.ts index 08f2f775f..3d4740615 100644 --- a/apps/api/src/domain/generated/irregularity/dto/create-irregularity.dto.ts +++ b/apps/api/src/domain/generated/irregularity/dto/create-irregularity.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class CreateIrregularityDto { - description: string + description: string; } diff --git a/apps/api/src/domain/generated/irregularity/dto/index.ts b/apps/api/src/domain/generated/irregularity/dto/index.ts index b8b329e0e..4e164346b 100644 --- a/apps/api/src/domain/generated/irregularity/dto/index.ts +++ b/apps/api/src/domain/generated/irregularity/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-irregularity.dto' -export * from './create-irregularity.dto' -export * from './update-irregularity.dto' + +export * from './connect-irregularity.dto'; +export * from './create-irregularity.dto'; +export * from './update-irregularity.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/irregularity/dto/update-irregularity.dto.ts b/apps/api/src/domain/generated/irregularity/dto/update-irregularity.dto.ts index fbc3856e1..078567749 100644 --- a/apps/api/src/domain/generated/irregularity/dto/update-irregularity.dto.ts +++ b/apps/api/src/domain/generated/irregularity/dto/update-irregularity.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class UpdateIrregularityDto { - description?: string + description?: string; } diff --git a/apps/api/src/domain/generated/irregularity/entities/index.ts b/apps/api/src/domain/generated/irregularity/entities/index.ts index 0a00f6ec4..27e5f7ffa 100644 --- a/apps/api/src/domain/generated/irregularity/entities/index.ts +++ b/apps/api/src/domain/generated/irregularity/entities/index.ts @@ -1 +1,2 @@ -export * from './irregularity.entity' + +export * from './irregularity.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/irregularity/entities/irregularity.entity.ts b/apps/api/src/domain/generated/irregularity/entities/irregularity.entity.ts index f08e89a79..816a28d3f 100644 --- a/apps/api/src/domain/generated/irregularity/entities/irregularity.entity.ts +++ b/apps/api/src/domain/generated/irregularity/entities/irregularity.entity.ts @@ -1,19 +1,21 @@ -import { IrregularityStatus, IrregularityReason, NotifierType } from '@prisma/client' -import { Campaign } from '../../campaign/entities/campaign.entity' -import { Person } from '../../person/entities/person.entity' -import { IrregularityFile } from '../../irregularityFile/entities/irregularityFile.entity' + +import {IrregularityStatus,IrregularityReason,NotifierType} from '@prisma/client' +import {Campaign} from '../../campaign/entities/campaign.entity' +import {Person} from '../../person/entities/person.entity' +import {IrregularityFile} from '../../irregularityFile/entities/irregularityFile.entity' + export class Irregularity { - id: string - campaignId: string - personId: string - createdAt: Date - updatedAt: Date | null - status: IrregularityStatus - reason: IrregularityReason - description: string - notifierType: NotifierType - campaign?: Campaign - person?: Person - files?: IrregularityFile[] + id: string ; +campaignId: string ; +personId: string ; +createdAt: Date ; +updatedAt: Date | null; +status: IrregularityStatus ; +reason: IrregularityReason ; +description: string ; +notifierType: NotifierType ; +campaign?: Campaign ; +person?: Person ; +files?: IrregularityFile[] ; } diff --git a/apps/api/src/domain/generated/irregularityFile/dto/connect-irregularityFile.dto.ts b/apps/api/src/domain/generated/irregularityFile/dto/connect-irregularityFile.dto.ts index cb3ce82fc..7204df495 100644 --- a/apps/api/src/domain/generated/irregularityFile/dto/connect-irregularityFile.dto.ts +++ b/apps/api/src/domain/generated/irregularityFile/dto/connect-irregularityFile.dto.ts @@ -1,3 +1,5 @@ -export class ConnectIrregularityFileDto { - id: string -} + + export class ConnectIrregularityFileDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/irregularityFile/dto/create-irregularityFile.dto.ts b/apps/api/src/domain/generated/irregularityFile/dto/create-irregularityFile.dto.ts index c14303b3f..ca6f20e8e 100644 --- a/apps/api/src/domain/generated/irregularityFile/dto/create-irregularityFile.dto.ts +++ b/apps/api/src/domain/generated/irregularityFile/dto/create-irregularityFile.dto.ts @@ -1,4 +1,10 @@ + + + + + + export class CreateIrregularityFileDto { - filename: string - mimetype: string + filename: string; +mimetype: string; } diff --git a/apps/api/src/domain/generated/irregularityFile/dto/index.ts b/apps/api/src/domain/generated/irregularityFile/dto/index.ts index b45d1392e..c001d3b5b 100644 --- a/apps/api/src/domain/generated/irregularityFile/dto/index.ts +++ b/apps/api/src/domain/generated/irregularityFile/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-irregularityFile.dto' -export * from './create-irregularityFile.dto' -export * from './update-irregularityFile.dto' + +export * from './connect-irregularityFile.dto'; +export * from './create-irregularityFile.dto'; +export * from './update-irregularityFile.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/irregularityFile/dto/update-irregularityFile.dto.ts b/apps/api/src/domain/generated/irregularityFile/dto/update-irregularityFile.dto.ts index 22d768766..e43884a7d 100644 --- a/apps/api/src/domain/generated/irregularityFile/dto/update-irregularityFile.dto.ts +++ b/apps/api/src/domain/generated/irregularityFile/dto/update-irregularityFile.dto.ts @@ -1,4 +1,10 @@ + + + + + + export class UpdateIrregularityFileDto { - filename?: string - mimetype?: string + filename?: string; +mimetype?: string; } diff --git a/apps/api/src/domain/generated/irregularityFile/entities/index.ts b/apps/api/src/domain/generated/irregularityFile/entities/index.ts index 9bba8bd90..95ce5229f 100644 --- a/apps/api/src/domain/generated/irregularityFile/entities/index.ts +++ b/apps/api/src/domain/generated/irregularityFile/entities/index.ts @@ -1 +1,2 @@ -export * from './irregularityFile.entity' + +export * from './irregularityFile.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/irregularityFile/entities/irregularityFile.entity.ts b/apps/api/src/domain/generated/irregularityFile/entities/irregularityFile.entity.ts index 27eca21f7..58cc1e972 100644 --- a/apps/api/src/domain/generated/irregularityFile/entities/irregularityFile.entity.ts +++ b/apps/api/src/domain/generated/irregularityFile/entities/irregularityFile.entity.ts @@ -1,12 +1,14 @@ -import { Irregularity } from '../../irregularity/entities/irregularity.entity' -import { Person } from '../../person/entities/person.entity' + +import {Irregularity} from '../../irregularity/entities/irregularity.entity' +import {Person} from '../../person/entities/person.entity' + export class IrregularityFile { - id: string - filename: string - mimetype: string - irregularityId: string - uploaderId: string - irregularity?: Irregularity - uploadedBy?: Person + id: string ; +filename: string ; +mimetype: string ; +irregularityId: string ; +uploaderId: string ; +irregularity?: Irregularity ; +uploadedBy?: Person ; } diff --git a/apps/api/src/domain/generated/marketingTemplates/dto/connect-marketingTemplates.dto.ts b/apps/api/src/domain/generated/marketingTemplates/dto/connect-marketingTemplates.dto.ts index bcc941c0c..910b6c9a5 100644 --- a/apps/api/src/domain/generated/marketingTemplates/dto/connect-marketingTemplates.dto.ts +++ b/apps/api/src/domain/generated/marketingTemplates/dto/connect-marketingTemplates.dto.ts @@ -1,3 +1,5 @@ -export class ConnectMarketingTemplatesDto { - id: string -} + + export class ConnectMarketingTemplatesDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/marketingTemplates/dto/create-marketingTemplates.dto.ts b/apps/api/src/domain/generated/marketingTemplates/dto/create-marketingTemplates.dto.ts index 8310e9b1b..5767a4657 100644 --- a/apps/api/src/domain/generated/marketingTemplates/dto/create-marketingTemplates.dto.ts +++ b/apps/api/src/domain/generated/marketingTemplates/dto/create-marketingTemplates.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class CreateMarketingTemplatesDto { - name?: string + name?: string; } diff --git a/apps/api/src/domain/generated/marketingTemplates/dto/index.ts b/apps/api/src/domain/generated/marketingTemplates/dto/index.ts index 621f172cb..af827e5fb 100644 --- a/apps/api/src/domain/generated/marketingTemplates/dto/index.ts +++ b/apps/api/src/domain/generated/marketingTemplates/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-marketingTemplates.dto' -export * from './create-marketingTemplates.dto' -export * from './update-marketingTemplates.dto' + +export * from './connect-marketingTemplates.dto'; +export * from './create-marketingTemplates.dto'; +export * from './update-marketingTemplates.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/marketingTemplates/dto/update-marketingTemplates.dto.ts b/apps/api/src/domain/generated/marketingTemplates/dto/update-marketingTemplates.dto.ts index fa84f793f..4a6b8b140 100644 --- a/apps/api/src/domain/generated/marketingTemplates/dto/update-marketingTemplates.dto.ts +++ b/apps/api/src/domain/generated/marketingTemplates/dto/update-marketingTemplates.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class UpdateMarketingTemplatesDto { - name?: string + name?: string; } diff --git a/apps/api/src/domain/generated/marketingTemplates/entities/index.ts b/apps/api/src/domain/generated/marketingTemplates/entities/index.ts index a9bdf5ee6..58b078804 100644 --- a/apps/api/src/domain/generated/marketingTemplates/entities/index.ts +++ b/apps/api/src/domain/generated/marketingTemplates/entities/index.ts @@ -1 +1,2 @@ -export * from './marketingTemplates.entity' + +export * from './marketingTemplates.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/marketingTemplates/entities/marketingTemplates.entity.ts b/apps/api/src/domain/generated/marketingTemplates/entities/marketingTemplates.entity.ts index 4d7dbad23..7372d7851 100644 --- a/apps/api/src/domain/generated/marketingTemplates/entities/marketingTemplates.entity.ts +++ b/apps/api/src/domain/generated/marketingTemplates/entities/marketingTemplates.entity.ts @@ -1,4 +1,8 @@ + + + + export class MarketingTemplates { - id: string - name: string | null + id: string ; +name: string | null; } diff --git a/apps/api/src/domain/generated/notificationList/dto/connect-notificationList.dto.ts b/apps/api/src/domain/generated/notificationList/dto/connect-notificationList.dto.ts index f20cfc90e..29dd92148 100644 --- a/apps/api/src/domain/generated/notificationList/dto/connect-notificationList.dto.ts +++ b/apps/api/src/domain/generated/notificationList/dto/connect-notificationList.dto.ts @@ -1,3 +1,5 @@ -export class ConnectNotificationListDto { - id: string -} + + export class ConnectNotificationListDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/notificationList/dto/create-notificationList.dto.ts b/apps/api/src/domain/generated/notificationList/dto/create-notificationList.dto.ts index 9cb19eed4..565dff201 100644 --- a/apps/api/src/domain/generated/notificationList/dto/create-notificationList.dto.ts +++ b/apps/api/src/domain/generated/notificationList/dto/create-notificationList.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class CreateNotificationListDto { - name?: string + name?: string; } diff --git a/apps/api/src/domain/generated/notificationList/dto/index.ts b/apps/api/src/domain/generated/notificationList/dto/index.ts index 4e5cb6306..234cf6bf8 100644 --- a/apps/api/src/domain/generated/notificationList/dto/index.ts +++ b/apps/api/src/domain/generated/notificationList/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-notificationList.dto' -export * from './create-notificationList.dto' -export * from './update-notificationList.dto' + +export * from './connect-notificationList.dto'; +export * from './create-notificationList.dto'; +export * from './update-notificationList.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/notificationList/dto/update-notificationList.dto.ts b/apps/api/src/domain/generated/notificationList/dto/update-notificationList.dto.ts index b77c0d362..b795511ce 100644 --- a/apps/api/src/domain/generated/notificationList/dto/update-notificationList.dto.ts +++ b/apps/api/src/domain/generated/notificationList/dto/update-notificationList.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class UpdateNotificationListDto { - name?: string + name?: string; } diff --git a/apps/api/src/domain/generated/notificationList/entities/index.ts b/apps/api/src/domain/generated/notificationList/entities/index.ts index 44f8d2805..f0a6fba3e 100644 --- a/apps/api/src/domain/generated/notificationList/entities/index.ts +++ b/apps/api/src/domain/generated/notificationList/entities/index.ts @@ -1 +1,2 @@ -export * from './notificationList.entity' + +export * from './notificationList.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/notificationList/entities/notificationList.entity.ts b/apps/api/src/domain/generated/notificationList/entities/notificationList.entity.ts index 4164094a5..01c02af0d 100644 --- a/apps/api/src/domain/generated/notificationList/entities/notificationList.entity.ts +++ b/apps/api/src/domain/generated/notificationList/entities/notificationList.entity.ts @@ -1,8 +1,10 @@ -import { Campaign } from '../../campaign/entities/campaign.entity' + +import {Campaign} from '../../campaign/entities/campaign.entity' + export class NotificationList { - id: string - campaignId: string - name: string | null - campaign?: Campaign + id: string ; +campaignId: string ; +name: string | null; +campaign?: Campaign ; } diff --git a/apps/api/src/domain/generated/organizer/dto/connect-organizer.dto.ts b/apps/api/src/domain/generated/organizer/dto/connect-organizer.dto.ts index 0912ea81b..e76265e8d 100644 --- a/apps/api/src/domain/generated/organizer/dto/connect-organizer.dto.ts +++ b/apps/api/src/domain/generated/organizer/dto/connect-organizer.dto.ts @@ -1,4 +1,6 @@ -export class ConnectOrganizerDto { - id?: string - personId?: string -} + + export class ConnectOrganizerDto { + id?: string; +personId?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/organizer/dto/create-organizer.dto.ts b/apps/api/src/domain/generated/organizer/dto/create-organizer.dto.ts index a64aa07d6..c73a10796 100644 --- a/apps/api/src/domain/generated/organizer/dto/create-organizer.dto.ts +++ b/apps/api/src/domain/generated/organizer/dto/create-organizer.dto.ts @@ -1 +1,9 @@ -export class CreateOrganizerDto {} + + + + + + +export class CreateOrganizerDto { + +} diff --git a/apps/api/src/domain/generated/organizer/dto/index.ts b/apps/api/src/domain/generated/organizer/dto/index.ts index 488fe3a2f..9d5057716 100644 --- a/apps/api/src/domain/generated/organizer/dto/index.ts +++ b/apps/api/src/domain/generated/organizer/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-organizer.dto' -export * from './create-organizer.dto' -export * from './update-organizer.dto' + +export * from './connect-organizer.dto'; +export * from './create-organizer.dto'; +export * from './update-organizer.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/organizer/dto/update-organizer.dto.ts b/apps/api/src/domain/generated/organizer/dto/update-organizer.dto.ts index b334c4f2f..db8e6fa3f 100644 --- a/apps/api/src/domain/generated/organizer/dto/update-organizer.dto.ts +++ b/apps/api/src/domain/generated/organizer/dto/update-organizer.dto.ts @@ -1 +1,9 @@ -export class UpdateOrganizerDto {} + + + + + + +export class UpdateOrganizerDto { + +} diff --git a/apps/api/src/domain/generated/organizer/entities/index.ts b/apps/api/src/domain/generated/organizer/entities/index.ts index 4df8a09c3..38cb2c301 100644 --- a/apps/api/src/domain/generated/organizer/entities/index.ts +++ b/apps/api/src/domain/generated/organizer/entities/index.ts @@ -1 +1,2 @@ -export * from './organizer.entity' + +export * from './organizer.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts b/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts index 0380fd930..c9aa03e4e 100644 --- a/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts +++ b/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts @@ -1,13 +1,15 @@ -import { Person } from '../../person/entities/person.entity' -import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' -import { Campaign } from '../../campaign/entities/campaign.entity' + +import {Person} from '../../person/entities/person.entity' +import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' +import {Campaign} from '../../campaign/entities/campaign.entity' + export class Organizer { - id: string - personId: string - createdAt: Date - updatedAt: Date | null - person?: Person - beneficiaries?: Beneficiary[] - campaigns?: Campaign[] + id: string ; +personId: string ; +createdAt: Date ; +updatedAt: Date | null; +person?: Person ; +beneficiaries?: Beneficiary[] ; +campaigns?: Campaign[] ; } diff --git a/apps/api/src/domain/generated/person/dto/connect-person.dto.ts b/apps/api/src/domain/generated/person/dto/connect-person.dto.ts index cf8af9224..ed4bd668e 100644 --- a/apps/api/src/domain/generated/person/dto/connect-person.dto.ts +++ b/apps/api/src/domain/generated/person/dto/connect-person.dto.ts @@ -1,8 +1,10 @@ -export class ConnectPersonDto { - id?: string - email?: string - personalNumber?: string - companyId?: string - keycloakId?: string - stripeCustomerId?: string -} + + export class ConnectPersonDto { + id?: string; +email?: string; +personalNumber?: string; +companyId?: string; +keycloakId?: string; +stripeCustomerId?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/person/dto/create-person.dto.ts b/apps/api/src/domain/generated/person/dto/create-person.dto.ts index d96ba291e..ab6a7ef8c 100644 --- a/apps/api/src/domain/generated/person/dto/create-person.dto.ts +++ b/apps/api/src/domain/generated/person/dto/create-person.dto.ts @@ -1,14 +1,20 @@ + + + + + + export class CreatePersonDto { - firstName: string - lastName: string - email?: string - phone?: string - newsletter?: boolean - address?: string - birthday?: Date - emailConfirmed?: boolean - personalNumber?: string - keycloakId?: string - stripeCustomerId?: string - picture?: string + firstName: string; +lastName: string; +email?: string; +phone?: string; +newsletter?: boolean; +address?: string; +birthday?: Date; +emailConfirmed?: boolean; +personalNumber?: string; +keycloakId?: string; +stripeCustomerId?: string; +picture?: string; } diff --git a/apps/api/src/domain/generated/person/dto/index.ts b/apps/api/src/domain/generated/person/dto/index.ts index bfa27bbeb..7dba19b87 100644 --- a/apps/api/src/domain/generated/person/dto/index.ts +++ b/apps/api/src/domain/generated/person/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-person.dto' -export * from './create-person.dto' -export * from './update-person.dto' + +export * from './connect-person.dto'; +export * from './create-person.dto'; +export * from './update-person.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/person/dto/update-person.dto.ts b/apps/api/src/domain/generated/person/dto/update-person.dto.ts index b171e7db8..32a5db863 100644 --- a/apps/api/src/domain/generated/person/dto/update-person.dto.ts +++ b/apps/api/src/domain/generated/person/dto/update-person.dto.ts @@ -1,14 +1,20 @@ + + + + + + export class UpdatePersonDto { - firstName?: string - lastName?: string - email?: string - phone?: string - newsletter?: boolean - address?: string - birthday?: Date - emailConfirmed?: boolean - personalNumber?: string - keycloakId?: string - stripeCustomerId?: string - picture?: string + firstName?: string; +lastName?: string; +email?: string; +phone?: string; +newsletter?: boolean; +address?: string; +birthday?: Date; +emailConfirmed?: boolean; +personalNumber?: string; +keycloakId?: string; +stripeCustomerId?: string; +picture?: string; } diff --git a/apps/api/src/domain/generated/person/entities/index.ts b/apps/api/src/domain/generated/person/entities/index.ts index 5b9ca3f82..ec47361d3 100644 --- a/apps/api/src/domain/generated/person/entities/index.ts +++ b/apps/api/src/domain/generated/person/entities/index.ts @@ -1 +1,2 @@ -export * from './person.entity' + +export * from './person.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/person/entities/person.entity.ts b/apps/api/src/domain/generated/person/entities/person.entity.ts index fa0e3872a..1a1d2149d 100644 --- a/apps/api/src/domain/generated/person/entities/person.entity.ts +++ b/apps/api/src/domain/generated/person/entities/person.entity.ts @@ -1,62 +1,64 @@ -import { Benefactor } from '../../benefactor/entities/benefactor.entity' -import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' -import { CampaignFile } from '../../campaignFile/entities/campaignFile.entity' -import { Campaign } from '../../campaign/entities/campaign.entity' -import { Coordinator } from '../../coordinator/entities/coordinator.entity' -import { Document } from '../../document/entities/document.entity' -import { DonationWish } from '../../donationWish/entities/donationWish.entity' -import { Donation } from '../../donation/entities/donation.entity' -import { Expense } from '../../expense/entities/expense.entity' -import { InfoRequest } from '../../infoRequest/entities/infoRequest.entity' -import { Irregularity } from '../../irregularity/entities/irregularity.entity' -import { IrregularityFile } from '../../irregularityFile/entities/irregularityFile.entity' -import { ExpenseFile } from '../../expenseFile/entities/expenseFile.entity' -import { Organizer } from '../../organizer/entities/organizer.entity' -import { RecurringDonation } from '../../recurringDonation/entities/recurringDonation.entity' -import { Supporter } from '../../supporter/entities/supporter.entity' -import { Transfer } from '../../transfer/entities/transfer.entity' -import { Withdrawal } from '../../withdrawal/entities/withdrawal.entity' -import { CampaignNews } from '../../campaignNews/entities/campaignNews.entity' -import { CampaignNewsFile } from '../../campaignNewsFile/entities/campaignNewsFile.entity' -import { Company } from '../../company/entities/company.entity' + +import {Benefactor} from '../../benefactor/entities/benefactor.entity' +import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' +import {CampaignFile} from '../../campaignFile/entities/campaignFile.entity' +import {Campaign} from '../../campaign/entities/campaign.entity' +import {Coordinator} from '../../coordinator/entities/coordinator.entity' +import {Document} from '../../document/entities/document.entity' +import {DonationWish} from '../../donationWish/entities/donationWish.entity' +import {Donation} from '../../donation/entities/donation.entity' +import {Expense} from '../../expense/entities/expense.entity' +import {InfoRequest} from '../../infoRequest/entities/infoRequest.entity' +import {Irregularity} from '../../irregularity/entities/irregularity.entity' +import {IrregularityFile} from '../../irregularityFile/entities/irregularityFile.entity' +import {ExpenseFile} from '../../expenseFile/entities/expenseFile.entity' +import {Organizer} from '../../organizer/entities/organizer.entity' +import {RecurringDonation} from '../../recurringDonation/entities/recurringDonation.entity' +import {Supporter} from '../../supporter/entities/supporter.entity' +import {Transfer} from '../../transfer/entities/transfer.entity' +import {Withdrawal} from '../../withdrawal/entities/withdrawal.entity' +import {CampaignNews} from '../../campaignNews/entities/campaignNews.entity' +import {CampaignNewsFile} from '../../campaignNewsFile/entities/campaignNewsFile.entity' +import {Company} from '../../company/entities/company.entity' + export class Person { - id: string - firstName: string - lastName: string - email: string | null - phone: string | null - createdAt: Date - updatedAt: Date | null - newsletter: boolean | null - address: string | null - birthday: Date | null - emailConfirmed: boolean | null - personalNumber: string | null - companyId: string | null - keycloakId: string | null - stripeCustomerId: string | null - picture: string | null - profileEnabled: boolean - benefactors?: Benefactor[] - beneficiaries?: Beneficiary[] - campaignFiles?: CampaignFile[] - campaigns?: Campaign[] - coordinators?: Coordinator | null - documents?: Document[] - donationWish?: DonationWish[] - Donation?: Donation[] - expenses?: Expense[] - infoRequests?: InfoRequest[] - irregularities?: Irregularity[] - irregularityFiles?: IrregularityFile[] - expenseFiles?: ExpenseFile[] - organizer?: Organizer | null - recurringDonations?: RecurringDonation[] - supporters?: Supporter[] - transfers?: Transfer[] - withdrawals?: Withdrawal[] - publishedNews?: CampaignNews[] - newsFiles?: CampaignNewsFile[] - company?: Company | null + id: string ; +firstName: string ; +lastName: string ; +email: string | null; +phone: string | null; +createdAt: Date ; +updatedAt: Date | null; +newsletter: boolean | null; +address: string | null; +birthday: Date | null; +emailConfirmed: boolean | null; +personalNumber: string | null; +companyId: string | null; +keycloakId: string | null; +stripeCustomerId: string | null; +picture: string | null; +profileEnabled: boolean ; +benefactors?: Benefactor[] ; +beneficiaries?: Beneficiary[] ; +campaignFiles?: CampaignFile[] ; +campaigns?: Campaign[] ; +coordinators?: Coordinator | null; +documents?: Document[] ; +donationWish?: DonationWish[] ; +Donation?: Donation[] ; +expenses?: Expense[] ; +infoRequests?: InfoRequest[] ; +irregularities?: Irregularity[] ; +irregularityFiles?: IrregularityFile[] ; +expenseFiles?: ExpenseFile[] ; +organizer?: Organizer | null; +recurringDonations?: RecurringDonation[] ; +supporters?: Supporter[] ; +transfers?: Transfer[] ; +withdrawals?: Withdrawal[] ; +publishedNews?: CampaignNews[] ; +newsFiles?: CampaignNewsFile[] ; +company?: Company | null; } diff --git a/apps/api/src/domain/generated/recurringDonation/dto/connect-recurringDonation.dto.ts b/apps/api/src/domain/generated/recurringDonation/dto/connect-recurringDonation.dto.ts index e7c8b1ee2..c8381e96b 100644 --- a/apps/api/src/domain/generated/recurringDonation/dto/connect-recurringDonation.dto.ts +++ b/apps/api/src/domain/generated/recurringDonation/dto/connect-recurringDonation.dto.ts @@ -1,3 +1,5 @@ -export class ConnectRecurringDonationDto { - id: string -} + + export class ConnectRecurringDonationDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/recurringDonation/dto/create-recurringDonation.dto.ts b/apps/api/src/domain/generated/recurringDonation/dto/create-recurringDonation.dto.ts index 38f5fb77e..9fb01dee4 100644 --- a/apps/api/src/domain/generated/recurringDonation/dto/create-recurringDonation.dto.ts +++ b/apps/api/src/domain/generated/recurringDonation/dto/create-recurringDonation.dto.ts @@ -1,9 +1,13 @@ -import { RecurringDonationStatus } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {RecurringDonationStatus} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateRecurringDonationDto { - @ApiProperty({ enum: RecurringDonationStatus }) - status: RecurringDonationStatus - extSubscriptionId: string - extCustomerId?: string + @ApiProperty({ enum: RecurringDonationStatus}) +status: RecurringDonationStatus; +extSubscriptionId: string; +extCustomerId?: string; } diff --git a/apps/api/src/domain/generated/recurringDonation/dto/index.ts b/apps/api/src/domain/generated/recurringDonation/dto/index.ts index cef88b511..06d6c41cb 100644 --- a/apps/api/src/domain/generated/recurringDonation/dto/index.ts +++ b/apps/api/src/domain/generated/recurringDonation/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-recurringDonation.dto' -export * from './create-recurringDonation.dto' -export * from './update-recurringDonation.dto' + +export * from './connect-recurringDonation.dto'; +export * from './create-recurringDonation.dto'; +export * from './update-recurringDonation.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/recurringDonation/dto/update-recurringDonation.dto.ts b/apps/api/src/domain/generated/recurringDonation/dto/update-recurringDonation.dto.ts index 32b6b324a..dc833d941 100644 --- a/apps/api/src/domain/generated/recurringDonation/dto/update-recurringDonation.dto.ts +++ b/apps/api/src/domain/generated/recurringDonation/dto/update-recurringDonation.dto.ts @@ -1,9 +1,13 @@ -import { RecurringDonationStatus } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {RecurringDonationStatus} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateRecurringDonationDto { - @ApiProperty({ enum: RecurringDonationStatus }) - status?: RecurringDonationStatus - extSubscriptionId?: string - extCustomerId?: string + @ApiProperty({ enum: RecurringDonationStatus}) +status?: RecurringDonationStatus; +extSubscriptionId?: string; +extCustomerId?: string; } diff --git a/apps/api/src/domain/generated/recurringDonation/entities/index.ts b/apps/api/src/domain/generated/recurringDonation/entities/index.ts index 1c3896c43..758fcb4c3 100644 --- a/apps/api/src/domain/generated/recurringDonation/entities/index.ts +++ b/apps/api/src/domain/generated/recurringDonation/entities/index.ts @@ -1 +1,2 @@ -export * from './recurringDonation.entity' + +export * from './recurringDonation.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/recurringDonation/entities/recurringDonation.entity.ts b/apps/api/src/domain/generated/recurringDonation/entities/recurringDonation.entity.ts index efe07a4cf..f4ab5c6f2 100644 --- a/apps/api/src/domain/generated/recurringDonation/entities/recurringDonation.entity.ts +++ b/apps/api/src/domain/generated/recurringDonation/entities/recurringDonation.entity.ts @@ -1,18 +1,20 @@ -import { RecurringDonationStatus, Currency } from '@prisma/client' -import { Person } from '../../person/entities/person.entity' -import { Vault } from '../../vault/entities/vault.entity' + +import {RecurringDonationStatus,Currency} from '@prisma/client' +import {Person} from '../../person/entities/person.entity' +import {Vault} from '../../vault/entities/vault.entity' + export class RecurringDonation { - id: string - status: RecurringDonationStatus - vaultId: string - personId: string - extSubscriptionId: string - extCustomerId: string | null - createdAt: Date - updatedAt: Date | null - amount: number - currency: Currency - person?: Person - sourceVault?: Vault + id: string ; +status: RecurringDonationStatus ; +vaultId: string ; +personId: string ; +extSubscriptionId: string ; +extCustomerId: string | null; +createdAt: Date ; +updatedAt: Date | null; +amount: number ; +currency: Currency ; +person?: Person ; +sourceVault?: Vault ; } diff --git a/apps/api/src/domain/generated/supporter/dto/connect-supporter.dto.ts b/apps/api/src/domain/generated/supporter/dto/connect-supporter.dto.ts index d31620c7f..38ad6fc21 100644 --- a/apps/api/src/domain/generated/supporter/dto/connect-supporter.dto.ts +++ b/apps/api/src/domain/generated/supporter/dto/connect-supporter.dto.ts @@ -1,3 +1,5 @@ -export class ConnectSupporterDto { - id: string -} + + export class ConnectSupporterDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/supporter/dto/create-supporter.dto.ts b/apps/api/src/domain/generated/supporter/dto/create-supporter.dto.ts index d7f05942d..75ad30ffc 100644 --- a/apps/api/src/domain/generated/supporter/dto/create-supporter.dto.ts +++ b/apps/api/src/domain/generated/supporter/dto/create-supporter.dto.ts @@ -1,6 +1,12 @@ + + + + + + export class CreateSupporterDto { - deletedAt?: Date - comment?: string - companyOtherText?: string - partnerOtherText?: string + deletedAt?: Date; +comment?: string; +companyOtherText?: string; +partnerOtherText?: string; } diff --git a/apps/api/src/domain/generated/supporter/dto/index.ts b/apps/api/src/domain/generated/supporter/dto/index.ts index 172086739..66a26f281 100644 --- a/apps/api/src/domain/generated/supporter/dto/index.ts +++ b/apps/api/src/domain/generated/supporter/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-supporter.dto' -export * from './create-supporter.dto' -export * from './update-supporter.dto' + +export * from './connect-supporter.dto'; +export * from './create-supporter.dto'; +export * from './update-supporter.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/supporter/dto/update-supporter.dto.ts b/apps/api/src/domain/generated/supporter/dto/update-supporter.dto.ts index decdb280d..490949427 100644 --- a/apps/api/src/domain/generated/supporter/dto/update-supporter.dto.ts +++ b/apps/api/src/domain/generated/supporter/dto/update-supporter.dto.ts @@ -1,6 +1,12 @@ + + + + + + export class UpdateSupporterDto { - deletedAt?: Date - comment?: string - companyOtherText?: string - partnerOtherText?: string + deletedAt?: Date; +comment?: string; +companyOtherText?: string; +partnerOtherText?: string; } diff --git a/apps/api/src/domain/generated/supporter/entities/index.ts b/apps/api/src/domain/generated/supporter/entities/index.ts index bc0137560..96ec7848b 100644 --- a/apps/api/src/domain/generated/supporter/entities/index.ts +++ b/apps/api/src/domain/generated/supporter/entities/index.ts @@ -1 +1,2 @@ -export * from './supporter.entity' + +export * from './supporter.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/supporter/entities/supporter.entity.ts b/apps/api/src/domain/generated/supporter/entities/supporter.entity.ts index 7d56bd057..cea9df0f1 100644 --- a/apps/api/src/domain/generated/supporter/entities/supporter.entity.ts +++ b/apps/api/src/domain/generated/supporter/entities/supporter.entity.ts @@ -1,35 +1,37 @@ -import { Person } from '../../person/entities/person.entity' + +import {Person} from '../../person/entities/person.entity' + export class Supporter { - id: string - personId: string - createdAt: Date - updatedAt: Date | null - deletedAt: Date | null - comment: string | null - associationMember: boolean - benefactorCampaign: boolean - benefactorPlatform: boolean - companyOtherText: string | null - companySponsor: boolean - companyVolunteer: boolean - partnerBussiness: boolean - partnerNpo: boolean - partnerOtherText: string | null - roleAssociationMember: boolean - roleBenefactor: boolean - roleCompany: boolean - rolePartner: boolean - roleVolunteer: boolean - volunteerBackend: boolean - volunteerDesigner: boolean - volunteerDevOps: boolean - volunteerFinancesAndAccounts: boolean - volunteerFrontend: boolean - volunteerLawyer: boolean - volunteerMarketing: boolean - volunteerProjectManager: boolean - volunteerQa: boolean - volunteerSecurity: boolean - person?: Person + id: string ; +personId: string ; +createdAt: Date ; +updatedAt: Date | null; +deletedAt: Date | null; +comment: string | null; +associationMember: boolean ; +benefactorCampaign: boolean ; +benefactorPlatform: boolean ; +companyOtherText: string | null; +companySponsor: boolean ; +companyVolunteer: boolean ; +partnerBussiness: boolean ; +partnerNpo: boolean ; +partnerOtherText: string | null; +roleAssociationMember: boolean ; +roleBenefactor: boolean ; +roleCompany: boolean ; +rolePartner: boolean ; +roleVolunteer: boolean ; +volunteerBackend: boolean ; +volunteerDesigner: boolean ; +volunteerDevOps: boolean ; +volunteerFinancesAndAccounts: boolean ; +volunteerFrontend: boolean ; +volunteerLawyer: boolean ; +volunteerMarketing: boolean ; +volunteerProjectManager: boolean ; +volunteerQa: boolean ; +volunteerSecurity: boolean ; +person?: Person ; } diff --git a/apps/api/src/domain/generated/transfer/dto/connect-transfer.dto.ts b/apps/api/src/domain/generated/transfer/dto/connect-transfer.dto.ts index 72390a1a1..25ed941d6 100644 --- a/apps/api/src/domain/generated/transfer/dto/connect-transfer.dto.ts +++ b/apps/api/src/domain/generated/transfer/dto/connect-transfer.dto.ts @@ -1,3 +1,5 @@ -export class ConnectTransferDto { - id: string -} + + export class ConnectTransferDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/transfer/dto/create-transfer.dto.ts b/apps/api/src/domain/generated/transfer/dto/create-transfer.dto.ts index 31205e070..4e2e5e94b 100644 --- a/apps/api/src/domain/generated/transfer/dto/create-transfer.dto.ts +++ b/apps/api/src/domain/generated/transfer/dto/create-transfer.dto.ts @@ -1,10 +1,14 @@ -import { Currency } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {Currency} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateTransferDto { - @ApiProperty({ enum: Currency }) - currency: Currency - reason: string - documentId?: string - targetDate?: Date + @ApiProperty({ enum: Currency}) +currency: Currency; +reason: string; +documentId?: string; +targetDate?: Date; } diff --git a/apps/api/src/domain/generated/transfer/dto/index.ts b/apps/api/src/domain/generated/transfer/dto/index.ts index a63c3138d..2b6eeb644 100644 --- a/apps/api/src/domain/generated/transfer/dto/index.ts +++ b/apps/api/src/domain/generated/transfer/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-transfer.dto' -export * from './create-transfer.dto' -export * from './update-transfer.dto' + +export * from './connect-transfer.dto'; +export * from './create-transfer.dto'; +export * from './update-transfer.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/transfer/dto/update-transfer.dto.ts b/apps/api/src/domain/generated/transfer/dto/update-transfer.dto.ts index 254083e1c..899e35287 100644 --- a/apps/api/src/domain/generated/transfer/dto/update-transfer.dto.ts +++ b/apps/api/src/domain/generated/transfer/dto/update-transfer.dto.ts @@ -1,10 +1,14 @@ -import { Currency } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {Currency} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateTransferDto { - @ApiProperty({ enum: Currency }) - currency?: Currency - reason?: string - documentId?: string - targetDate?: Date + @ApiProperty({ enum: Currency}) +currency?: Currency; +reason?: string; +documentId?: string; +targetDate?: Date; } diff --git a/apps/api/src/domain/generated/transfer/entities/index.ts b/apps/api/src/domain/generated/transfer/entities/index.ts index 350bb7593..96b88004b 100644 --- a/apps/api/src/domain/generated/transfer/entities/index.ts +++ b/apps/api/src/domain/generated/transfer/entities/index.ts @@ -1 +1,2 @@ -export * from './transfer.entity' + +export * from './transfer.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/transfer/entities/transfer.entity.ts b/apps/api/src/domain/generated/transfer/entities/transfer.entity.ts index 060e116ec..67c1f2503 100644 --- a/apps/api/src/domain/generated/transfer/entities/transfer.entity.ts +++ b/apps/api/src/domain/generated/transfer/entities/transfer.entity.ts @@ -1,26 +1,28 @@ -import { TransferStatus, Currency } from '@prisma/client' -import { Person } from '../../person/entities/person.entity' -import { Campaign } from '../../campaign/entities/campaign.entity' -import { Vault } from '../../vault/entities/vault.entity' + +import {TransferStatus,Currency} from '@prisma/client' +import {Person} from '../../person/entities/person.entity' +import {Campaign} from '../../campaign/entities/campaign.entity' +import {Vault} from '../../vault/entities/vault.entity' + export class Transfer { - id: string - status: TransferStatus - currency: Currency - amount: number - reason: string - sourceVaultId: string - sourceCampaignId: string - targetVaultId: string - targetCampaignId: string - approvedById: string | null - documentId: string | null - targetDate: Date | null - createdAt: Date - updatedAt: Date | null - approvedBy?: Person | null - sourceCampaign?: Campaign - sourceVault?: Vault - targetCampaign?: Campaign - targetVault?: Vault + id: string ; +status: TransferStatus ; +currency: Currency ; +amount: number ; +reason: string ; +sourceVaultId: string ; +sourceCampaignId: string ; +targetVaultId: string ; +targetCampaignId: string ; +approvedById: string | null; +documentId: string | null; +targetDate: Date | null; +createdAt: Date ; +updatedAt: Date | null; +approvedBy?: Person | null; +sourceCampaign?: Campaign ; +sourceVault?: Vault ; +targetCampaign?: Campaign ; +targetVault?: Vault ; } diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/connect-unregisteredNotificationConsent.dto.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/connect-unregisteredNotificationConsent.dto.ts index a8394c60e..ea932916e 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/connect-unregisteredNotificationConsent.dto.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/connect-unregisteredNotificationConsent.dto.ts @@ -1,4 +1,6 @@ -export class ConnectUnregisteredNotificationConsentDto { - id?: string - email?: string -} + + export class ConnectUnregisteredNotificationConsentDto { + id?: string; +email?: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/create-unregisteredNotificationConsent.dto.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/create-unregisteredNotificationConsent.dto.ts index e98f8c99a..6d3de41d1 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/create-unregisteredNotificationConsent.dto.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/create-unregisteredNotificationConsent.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class CreateUnregisteredNotificationConsentDto { - email: string + email: string; } diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/index.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/index.ts index 30a4e73e3..8a9b1be22 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/index.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-unregisteredNotificationConsent.dto' -export * from './create-unregisteredNotificationConsent.dto' -export * from './update-unregisteredNotificationConsent.dto' + +export * from './connect-unregisteredNotificationConsent.dto'; +export * from './create-unregisteredNotificationConsent.dto'; +export * from './update-unregisteredNotificationConsent.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/update-unregisteredNotificationConsent.dto.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/update-unregisteredNotificationConsent.dto.ts index 05e37e79f..db882d048 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/update-unregisteredNotificationConsent.dto.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/update-unregisteredNotificationConsent.dto.ts @@ -1,3 +1,9 @@ + + + + + + export class UpdateUnregisteredNotificationConsentDto { - email?: string + email?: string; } diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/index.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/index.ts index 4c26022e8..2282fb8e6 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/index.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/index.ts @@ -1 +1,2 @@ -export * from './unregisteredNotificationConsent.entity' + +export * from './unregisteredNotificationConsent.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/unregisteredNotificationConsent.entity.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/unregisteredNotificationConsent.entity.ts index 173955999..c8244d67b 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/unregisteredNotificationConsent.entity.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/unregisteredNotificationConsent.entity.ts @@ -1,5 +1,9 @@ + + + + export class UnregisteredNotificationConsent { - id: string - email: string - consent: boolean + id: string ; +email: string ; +consent: boolean ; } diff --git a/apps/api/src/domain/generated/vault/dto/connect-vault.dto.ts b/apps/api/src/domain/generated/vault/dto/connect-vault.dto.ts index 73327627b..4e4502295 100644 --- a/apps/api/src/domain/generated/vault/dto/connect-vault.dto.ts +++ b/apps/api/src/domain/generated/vault/dto/connect-vault.dto.ts @@ -1,3 +1,5 @@ -export class ConnectVaultDto { - id: string -} + + export class ConnectVaultDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/vault/dto/create-vault.dto.ts b/apps/api/src/domain/generated/vault/dto/create-vault.dto.ts index 48b2ddb78..403b00ac8 100644 --- a/apps/api/src/domain/generated/vault/dto/create-vault.dto.ts +++ b/apps/api/src/domain/generated/vault/dto/create-vault.dto.ts @@ -1 +1,9 @@ -export class CreateVaultDto {} + + + + + + +export class CreateVaultDto { + +} diff --git a/apps/api/src/domain/generated/vault/dto/index.ts b/apps/api/src/domain/generated/vault/dto/index.ts index 8a655273b..47c6d1100 100644 --- a/apps/api/src/domain/generated/vault/dto/index.ts +++ b/apps/api/src/domain/generated/vault/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-vault.dto' -export * from './create-vault.dto' -export * from './update-vault.dto' + +export * from './connect-vault.dto'; +export * from './create-vault.dto'; +export * from './update-vault.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/vault/dto/update-vault.dto.ts b/apps/api/src/domain/generated/vault/dto/update-vault.dto.ts index 0110a3058..dd8a83a83 100644 --- a/apps/api/src/domain/generated/vault/dto/update-vault.dto.ts +++ b/apps/api/src/domain/generated/vault/dto/update-vault.dto.ts @@ -1 +1,9 @@ -export class UpdateVaultDto {} + + + + + + +export class UpdateVaultDto { + +} diff --git a/apps/api/src/domain/generated/vault/entities/index.ts b/apps/api/src/domain/generated/vault/entities/index.ts index 6b947cc5e..10628d9cd 100644 --- a/apps/api/src/domain/generated/vault/entities/index.ts +++ b/apps/api/src/domain/generated/vault/entities/index.ts @@ -1 +1,2 @@ -export * from './vault.entity' + +export * from './vault.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/vault/entities/vault.entity.ts b/apps/api/src/domain/generated/vault/entities/vault.entity.ts index 83d9b3692..4af8a1991 100644 --- a/apps/api/src/domain/generated/vault/entities/vault.entity.ts +++ b/apps/api/src/domain/generated/vault/entities/vault.entity.ts @@ -1,25 +1,27 @@ -import { Currency } from '@prisma/client' -import { Campaign } from '../../campaign/entities/campaign.entity' -import { Donation } from '../../donation/entities/donation.entity' -import { Expense } from '../../expense/entities/expense.entity' -import { RecurringDonation } from '../../recurringDonation/entities/recurringDonation.entity' -import { Transfer } from '../../transfer/entities/transfer.entity' -import { Withdrawal } from '../../withdrawal/entities/withdrawal.entity' + +import {Currency} from '@prisma/client' +import {Campaign} from '../../campaign/entities/campaign.entity' +import {Donation} from '../../donation/entities/donation.entity' +import {Expense} from '../../expense/entities/expense.entity' +import {RecurringDonation} from '../../recurringDonation/entities/recurringDonation.entity' +import {Transfer} from '../../transfer/entities/transfer.entity' +import {Withdrawal} from '../../withdrawal/entities/withdrawal.entity' + export class Vault { - id: string - currency: Currency - amount: number - campaignId: string - createdAt: Date - updatedAt: Date | null - name: string - blockedAmount: number - campaign?: Campaign - donations?: Donation[] - expenses?: Expense[] - recurringDonations?: RecurringDonation[] - sourceTransfers?: Transfer[] - targetTransfers?: Transfer[] - withdraws?: Withdrawal[] + id: string ; +currency: Currency ; +amount: number ; +campaignId: string ; +createdAt: Date ; +updatedAt: Date | null; +name: string ; +blockedAmount: number ; +campaign?: Campaign ; +donations?: Donation[] ; +expenses?: Expense[] ; +recurringDonations?: RecurringDonation[] ; +sourceTransfers?: Transfer[] ; +targetTransfers?: Transfer[] ; +withdraws?: Withdrawal[] ; } diff --git a/apps/api/src/domain/generated/withdrawal/dto/connect-withdrawal.dto.ts b/apps/api/src/domain/generated/withdrawal/dto/connect-withdrawal.dto.ts index 0076282d6..701535cb9 100644 --- a/apps/api/src/domain/generated/withdrawal/dto/connect-withdrawal.dto.ts +++ b/apps/api/src/domain/generated/withdrawal/dto/connect-withdrawal.dto.ts @@ -1,3 +1,5 @@ -export class ConnectWithdrawalDto { - id: string -} + + export class ConnectWithdrawalDto { + id: string; + } + \ No newline at end of file diff --git a/apps/api/src/domain/generated/withdrawal/dto/create-withdrawal.dto.ts b/apps/api/src/domain/generated/withdrawal/dto/create-withdrawal.dto.ts index 45972ac91..872db5eb6 100644 --- a/apps/api/src/domain/generated/withdrawal/dto/create-withdrawal.dto.ts +++ b/apps/api/src/domain/generated/withdrawal/dto/create-withdrawal.dto.ts @@ -1,10 +1,14 @@ -import { Currency } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {Currency} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class CreateWithdrawalDto { - @ApiProperty({ enum: Currency }) - currency: Currency - reason: string - documentId?: string - targetDate?: Date + @ApiProperty({ enum: Currency}) +currency: Currency; +reason: string; +documentId?: string; +targetDate?: Date; } diff --git a/apps/api/src/domain/generated/withdrawal/dto/index.ts b/apps/api/src/domain/generated/withdrawal/dto/index.ts index 09efa0678..0850f1280 100644 --- a/apps/api/src/domain/generated/withdrawal/dto/index.ts +++ b/apps/api/src/domain/generated/withdrawal/dto/index.ts @@ -1,3 +1,4 @@ -export * from './connect-withdrawal.dto' -export * from './create-withdrawal.dto' -export * from './update-withdrawal.dto' + +export * from './connect-withdrawal.dto'; +export * from './create-withdrawal.dto'; +export * from './update-withdrawal.dto'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/withdrawal/dto/update-withdrawal.dto.ts b/apps/api/src/domain/generated/withdrawal/dto/update-withdrawal.dto.ts index d74c388fe..32d048ab3 100644 --- a/apps/api/src/domain/generated/withdrawal/dto/update-withdrawal.dto.ts +++ b/apps/api/src/domain/generated/withdrawal/dto/update-withdrawal.dto.ts @@ -1,10 +1,14 @@ -import { Currency } from '@prisma/client' -import { ApiProperty } from '@nestjs/swagger' + +import {Currency} from '@prisma/client' +import {ApiProperty} from '@nestjs/swagger' + + + export class UpdateWithdrawalDto { - @ApiProperty({ enum: Currency }) - currency?: Currency - reason?: string - documentId?: string - targetDate?: Date + @ApiProperty({ enum: Currency}) +currency?: Currency; +reason?: string; +documentId?: string; +targetDate?: Date; } diff --git a/apps/api/src/domain/generated/withdrawal/entities/index.ts b/apps/api/src/domain/generated/withdrawal/entities/index.ts index a167ff4f9..f9504dcee 100644 --- a/apps/api/src/domain/generated/withdrawal/entities/index.ts +++ b/apps/api/src/domain/generated/withdrawal/entities/index.ts @@ -1 +1,2 @@ -export * from './withdrawal.entity' + +export * from './withdrawal.entity'; \ No newline at end of file diff --git a/apps/api/src/domain/generated/withdrawal/entities/withdrawal.entity.ts b/apps/api/src/domain/generated/withdrawal/entities/withdrawal.entity.ts index eeb74f327..26d3b50e2 100644 --- a/apps/api/src/domain/generated/withdrawal/entities/withdrawal.entity.ts +++ b/apps/api/src/domain/generated/withdrawal/entities/withdrawal.entity.ts @@ -1,25 +1,27 @@ -import { WithdrawStatus, Currency } from '@prisma/client' -import { Person } from '../../person/entities/person.entity' -import { BankAccount } from '../../bankAccount/entities/bankAccount.entity' -import { Campaign } from '../../campaign/entities/campaign.entity' -import { Vault } from '../../vault/entities/vault.entity' + +import {WithdrawStatus,Currency} from '@prisma/client' +import {Person} from '../../person/entities/person.entity' +import {BankAccount} from '../../bankAccount/entities/bankAccount.entity' +import {Campaign} from '../../campaign/entities/campaign.entity' +import {Vault} from '../../vault/entities/vault.entity' + export class Withdrawal { - id: string - status: WithdrawStatus - currency: Currency - amount: number - reason: string - sourceVaultId: string - sourceCampaignId: string - bankAccountId: string - documentId: string | null - approvedById: string | null - targetDate: Date | null - createdAt: Date - updatedAt: Date | null - approvedBy?: Person | null - bankAccount?: BankAccount - sourceCampaign?: Campaign - sourceVault?: Vault + id: string ; +status: WithdrawStatus ; +currency: Currency ; +amount: number ; +reason: string ; +sourceVaultId: string ; +sourceCampaignId: string ; +bankAccountId: string ; +documentId: string | null; +approvedById: string | null; +targetDate: Date | null; +createdAt: Date ; +updatedAt: Date | null; +approvedBy?: Person | null; +bankAccount?: BankAccount ; +sourceCampaign?: Campaign ; +sourceVault?: Vault ; } From 2c481647edff7efd22844edd05e1f7b33da5b0ca Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Tue, 14 Nov 2023 22:21:59 +0100 Subject: [PATCH 03/15] FEAT: refactor permanentDeleteUser. Add exception handling. --- apps/api/src/account/account.controller.ts | 4 +- apps/api/src/auth/auth.service.ts | 102 +++++++++++---------- 2 files changed, 55 insertions(+), 51 deletions(-) diff --git a/apps/api/src/account/account.controller.ts b/apps/api/src/account/account.controller.ts index 99438fb51..01571974e 100644 --- a/apps/api/src/account/account.controller.ts +++ b/apps/api/src/account/account.controller.ts @@ -69,11 +69,11 @@ export class AccountController { } @Delete('me') - async disableUser(@AuthenticatedUser() user: KeycloakTokenParsed) { + async permanentDeleteUser(@AuthenticatedUser() user: KeycloakTokenParsed) { try { return await this.accountService.permanentDeleteUser(user) } catch (err) { - Logger.error(`Failed to disable user with keycloakId ${user.sub}. Error is: ${err}`) + Logger.error(`Failed to delete user with keycloakId ${user.sub}. Error is: ${err}`) throw err } } diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index c90512be1..a7782233b 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -8,30 +8,30 @@ import { NotFoundException, UnauthorizedException, } from '@nestjs/common' -import { HttpService } from '@nestjs/axios' -import { catchError, firstValueFrom, map, Observable } from 'rxjs' +import {HttpService} from '@nestjs/axios' +import {catchError, firstValueFrom, map, Observable} from 'rxjs' import KeycloakConnect from 'keycloak-connect' -import { ConfigService } from '@nestjs/config' -import { KEYCLOAK_INSTANCE } from 'nest-keycloak-connect' +import {ConfigService} from '@nestjs/config' +import {KEYCLOAK_INSTANCE} from 'nest-keycloak-connect' import KeycloakAdminClient from '@keycloak/keycloak-admin-client' -import { RequiredActionAlias } from '@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation' -import { AxiosResponse } from '@nestjs/terminus/dist/health-indicator/http/axios.interfaces' -import { TokenResponseRaw } from '@keycloak/keycloak-admin-client/lib/utils/auth' +import {RequiredActionAlias} from '@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation' +import {AxiosResponse} from '@nestjs/terminus/dist/health-indicator/http/axios.interfaces' +import {TokenResponseRaw} from '@keycloak/keycloak-admin-client/lib/utils/auth' -import { Company, Person } from '@prisma/client' -import { PrismaService } from '../prisma/prisma.service' -import { LoginDto } from './dto/login.dto' -import { ProfileType, RegisterDto } from './dto/register.dto' -import { RefreshDto } from './dto/refresh.dto' -import { KeycloakTokenParsed } from './keycloak' -import { ProviderDto } from './dto/provider.dto' -import { UpdatePersonDto } from '../person/dto/update-person.dto' -import { ForgottenPasswordEmailDto } from './dto/forgot-password.dto' -import { JwtService } from '@nestjs/jwt' -import { EmailService } from '../email/email.service' -import { ForgottenPasswordMailDto } from '../email/template.interface' -import { NewPasswordDto } from './dto/recovery-password.dto' -import { MarketingNotificationsService } from '../notifications/notifications.service' +import {Company, Person} from '@prisma/client' +import {PrismaService} from '../prisma/prisma.service' +import {LoginDto} from './dto/login.dto' +import {ProfileType, RegisterDto} from './dto/register.dto' +import {RefreshDto} from './dto/refresh.dto' +import {KeycloakTokenParsed} from './keycloak' +import {ProviderDto} from './dto/provider.dto' +import {UpdatePersonDto} from '../person/dto/update-person.dto' +import {ForgottenPasswordEmailDto} from './dto/forgot-password.dto' +import {JwtService} from '@nestjs/jwt' +import {EmailService} from '../email/email.service' +import {ForgottenPasswordMailDto} from '../email/template.interface' +import {NewPasswordDto} from './dto/recovery-password.dto' +import {MarketingNotificationsService} from '../notifications/notifications.service' type ErrorResponse = { error: string; data: unknown } type KeycloakErrorResponse = { error: string; error_description: string } @@ -63,7 +63,8 @@ export class AuthService { private sendEmail: EmailService, @Inject(KEYCLOAK_INSTANCE) private keycloak: KeycloakConnect.Keycloak, private readonly marketingNotificationsService: MarketingNotificationsService, - ) {} + ) { + } async issueGrant(email: string, password: string): Promise { return this.keycloak.grantManager.obtainDirectly(email, password) @@ -84,7 +85,7 @@ export class AuthService { accessToken: res.data.access_token, expires: res.data.expires_in, })), - catchError(({ response }: { response: AxiosResponse }) => { + catchError(({response}: { response: AxiosResponse }) => { const error = response.data Logger.error("Couldn't get authentication from keycloak. Error: " + JSON.stringify(error)) @@ -121,8 +122,8 @@ export class AuthService { keycloakId: userInfo.sub, }, // Store keycloakId to the person with same email - update: { keycloakId: userInfo.sub }, - where: { email: userInfo.email }, + update: {keycloakId: userInfo.sub}, + where: {email: userInfo.email}, }) return tokenObs$ } @@ -151,11 +152,11 @@ export class AuthService { const user = await this.keycloak.grantManager.userInfo( grant.access_token.token as string, ) - const person = await this.prismaService.person.findUnique({ where: { email: user.email } }) + const person = await this.prismaService.person.findUnique({where: {email: user.email}}) if (!person || person.keycloakId !== user.sub) { Logger.warn('No person found for the current keycloak user. Creating new one...') await this.authenticateAdmin() - const userData = await this.admin.users.findOne({ id: user.sub }) + const userData = await this.admin.users.findOne({id: user.sub}) const registerDto: RegisterDto = { type: ProfileType.INDIVIDUAL, email: userData?.email ?? '', @@ -250,7 +251,7 @@ export class AuthService { emailVerified: true, groups: [], requiredActions: verifyEmail ? [RequiredActionAlias.VERIFY_EMAIL] : [], - attributes: { selfReg: true }, + attributes: {selfReg: true}, credentials: [ { type: 'password', @@ -293,8 +294,8 @@ export class AuthService { profileEnabled: companyId ? false : true, }, // Store keycloakId to the person with same email - update: { keycloakId }, - where: { email: registerDto.email }, + update: {keycloakId}, + where: {email: registerDto.email}, }) } @@ -316,7 +317,7 @@ export class AuthService { async updateUser(keycloakId: string, updateDto: UpdatePersonDto) { await this.authenticateAdmin() await this.admin.users.update( - { id: keycloakId }, + {id: keycloakId}, { username: updateDto.email, email: updateDto.email, @@ -328,7 +329,7 @@ export class AuthService { }, ) return await this.prismaService.person.update({ - where: { keycloakId }, + where: {keycloakId}, data: { firstName: updateDto.firstName, lastName: updateDto.lastName, @@ -354,7 +355,7 @@ export class AuthService { async changeEnabledStatus(keycloakId: string, enabled: boolean) { await this.authenticateAdmin() // check if user is admin before attempting to activate/deactivate - const userGroups = await this.admin.users.listRoleMappings({ id: keycloakId }) + const userGroups = await this.admin.users.listRoleMappings({id: keycloakId}) const isAdmin = userGroups.realmMappings?.some( (obj) => obj.name === 'team-support' || @@ -365,28 +366,28 @@ export class AuthService { throw new ForbiddenException("Admin profiles can't be deactivated") } await this.admin.users.update( - { id: keycloakId }, + {id: keycloakId}, { enabled, }, ) return await this.prismaService.person.update({ - where: { keycloakId }, - data: { profileEnabled: enabled }, + where: {keycloakId}, + data: {profileEnabled: enabled}, }) } async sendMailForPasswordChange(forgotPasswordDto: ForgottenPasswordEmailDto) { const stage = this.config.get('APP_ENV') === 'development' ? 'APP_URL_LOCAL' : 'APP_URL' const person = await this.prismaService.person.findFirst({ - where: { email: forgotPasswordDto.email }, + where: {email: forgotPasswordDto.email}, }) if (!person || !person.email) { throw new NotFoundException('Invalid email') } - const payload = { username: person.email, sub: person.keycloakId } + const payload = {username: person.email, sub: person.keycloakId} const jtwSecret = process.env.JWT_SECRET_KEY const access_token = this.jwtService.sign(payload, { secret: jtwSecret, @@ -400,17 +401,17 @@ export class AuthService { lastName: person.lastName, link: link, } - const userEmail = { to: [person.email] } + const userEmail = {to: [person.email]} const mail = new ForgottenPasswordMailDto(profile) await this.sendEmail.sendFromTemplate(mail, userEmail, { //Allow users to receive the mail, regardles of unsubscribes - bypassUnsubscribeManagement: { enable: true }, + bypassUnsubscribeManagement: {enable: true}, }) } async updateForgottenPassword(recoveryPasswordDto: NewPasswordDto) { try { - const { sub: keycloakId } = this.jwtService.verify(recoveryPasswordDto.token, { + const {sub: keycloakId} = this.jwtService.verify(recoveryPasswordDto.token, { secret: process.env.JWT_SECRET_KEY, }) return await this.updateUserPassword(keycloakId, recoveryPasswordDto) @@ -422,19 +423,22 @@ export class AuthService { throw response.data ? new NotFoundException(response.data) : new BadRequestException( - 'The forgotten password link has expired, request a new link and try again!', - ) + 'The forgotten password link has expired, request a new link and try again!', + ) } } - async permanentDeleteUser(keycloakId: string){ + async permanentDeleteUser(keycloakId: string) { await this.authenticateAdmin() - return await Promise.all([ - this.admin.users.del({ id: keycloakId }), - this.prismaService.person.delete({ - where: {keycloakId} + return this.admin.users.del({id: keycloakId}) + .then(() => this.prismaService.person.delete({ + where: {keycloakId} + }) + ).catch(err => { + const msg = `Deleting user in fails with reason ${err.message ?? 'server error'}` + Logger.error(msg) + throw new InternalServerErrorException(msg) }) - ]) } } From 4649ce374a3002e073fafbae479016219d617dc0 Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Thu, 16 Nov 2023 20:50:11 +0100 Subject: [PATCH 04/15] FEAT: change permanentDeleteUser in auth.service.ts logic so when the promise returned from the keycloak client is rejected, the prisma service will not be called to delete the user in the db. Also, some reformatting the code as per prettier conf. --- apps/api/src/account/account.service.ts | 2 +- apps/api/src/auth/auth.service.ts | 97 ++++++++++++------------- 2 files changed, 49 insertions(+), 50 deletions(-) diff --git a/apps/api/src/account/account.service.ts b/apps/api/src/account/account.service.ts index c67ce585c..4f92298d9 100644 --- a/apps/api/src/account/account.service.ts +++ b/apps/api/src/account/account.service.ts @@ -28,7 +28,7 @@ export class AccountService { return await this.authService.changeEnabledStatus(user.sub, false) } - async permanentDeleteUser(user: KeycloakTokenParsed){ + async permanentDeleteUser(user: KeycloakTokenParsed) { return await this.authService.permanentDeleteUser(user.sub) } diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index a7782233b..eaa1dc55f 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -8,30 +8,30 @@ import { NotFoundException, UnauthorizedException, } from '@nestjs/common' -import {HttpService} from '@nestjs/axios' -import {catchError, firstValueFrom, map, Observable} from 'rxjs' +import { HttpService } from '@nestjs/axios' +import { catchError, firstValueFrom, map, Observable } from 'rxjs' import KeycloakConnect from 'keycloak-connect' -import {ConfigService} from '@nestjs/config' -import {KEYCLOAK_INSTANCE} from 'nest-keycloak-connect' +import { ConfigService } from '@nestjs/config' +import { KEYCLOAK_INSTANCE } from 'nest-keycloak-connect' import KeycloakAdminClient from '@keycloak/keycloak-admin-client' -import {RequiredActionAlias} from '@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation' -import {AxiosResponse} from '@nestjs/terminus/dist/health-indicator/http/axios.interfaces' -import {TokenResponseRaw} from '@keycloak/keycloak-admin-client/lib/utils/auth' +import { RequiredActionAlias } from '@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation' +import { AxiosResponse } from '@nestjs/terminus/dist/health-indicator/http/axios.interfaces' +import { TokenResponseRaw } from '@keycloak/keycloak-admin-client/lib/utils/auth' -import {Company, Person} from '@prisma/client' -import {PrismaService} from '../prisma/prisma.service' -import {LoginDto} from './dto/login.dto' -import {ProfileType, RegisterDto} from './dto/register.dto' -import {RefreshDto} from './dto/refresh.dto' -import {KeycloakTokenParsed} from './keycloak' -import {ProviderDto} from './dto/provider.dto' -import {UpdatePersonDto} from '../person/dto/update-person.dto' -import {ForgottenPasswordEmailDto} from './dto/forgot-password.dto' -import {JwtService} from '@nestjs/jwt' -import {EmailService} from '../email/email.service' -import {ForgottenPasswordMailDto} from '../email/template.interface' -import {NewPasswordDto} from './dto/recovery-password.dto' -import {MarketingNotificationsService} from '../notifications/notifications.service' +import { Company, Person } from '@prisma/client' +import { PrismaService } from '../prisma/prisma.service' +import { LoginDto } from './dto/login.dto' +import { ProfileType, RegisterDto } from './dto/register.dto' +import { RefreshDto } from './dto/refresh.dto' +import { KeycloakTokenParsed } from './keycloak' +import { ProviderDto } from './dto/provider.dto' +import { UpdatePersonDto } from '../person/dto/update-person.dto' +import { ForgottenPasswordEmailDto } from './dto/forgot-password.dto' +import { JwtService } from '@nestjs/jwt' +import { EmailService } from '../email/email.service' +import { ForgottenPasswordMailDto } from '../email/template.interface' +import { NewPasswordDto } from './dto/recovery-password.dto' +import { MarketingNotificationsService } from '../notifications/notifications.service' type ErrorResponse = { error: string; data: unknown } type KeycloakErrorResponse = { error: string; error_description: string } @@ -63,8 +63,7 @@ export class AuthService { private sendEmail: EmailService, @Inject(KEYCLOAK_INSTANCE) private keycloak: KeycloakConnect.Keycloak, private readonly marketingNotificationsService: MarketingNotificationsService, - ) { - } + ) {} async issueGrant(email: string, password: string): Promise { return this.keycloak.grantManager.obtainDirectly(email, password) @@ -85,7 +84,7 @@ export class AuthService { accessToken: res.data.access_token, expires: res.data.expires_in, })), - catchError(({response}: { response: AxiosResponse }) => { + catchError(({ response }: { response: AxiosResponse }) => { const error = response.data Logger.error("Couldn't get authentication from keycloak. Error: " + JSON.stringify(error)) @@ -122,8 +121,8 @@ export class AuthService { keycloakId: userInfo.sub, }, // Store keycloakId to the person with same email - update: {keycloakId: userInfo.sub}, - where: {email: userInfo.email}, + update: { keycloakId: userInfo.sub }, + where: { email: userInfo.email }, }) return tokenObs$ } @@ -152,11 +151,11 @@ export class AuthService { const user = await this.keycloak.grantManager.userInfo( grant.access_token.token as string, ) - const person = await this.prismaService.person.findUnique({where: {email: user.email}}) + const person = await this.prismaService.person.findUnique({ where: { email: user.email } }) if (!person || person.keycloakId !== user.sub) { Logger.warn('No person found for the current keycloak user. Creating new one...') await this.authenticateAdmin() - const userData = await this.admin.users.findOne({id: user.sub}) + const userData = await this.admin.users.findOne({ id: user.sub }) const registerDto: RegisterDto = { type: ProfileType.INDIVIDUAL, email: userData?.email ?? '', @@ -251,7 +250,7 @@ export class AuthService { emailVerified: true, groups: [], requiredActions: verifyEmail ? [RequiredActionAlias.VERIFY_EMAIL] : [], - attributes: {selfReg: true}, + attributes: { selfReg: true }, credentials: [ { type: 'password', @@ -294,8 +293,8 @@ export class AuthService { profileEnabled: companyId ? false : true, }, // Store keycloakId to the person with same email - update: {keycloakId}, - where: {email: registerDto.email}, + update: { keycloakId }, + where: { email: registerDto.email }, }) } @@ -317,7 +316,7 @@ export class AuthService { async updateUser(keycloakId: string, updateDto: UpdatePersonDto) { await this.authenticateAdmin() await this.admin.users.update( - {id: keycloakId}, + { id: keycloakId }, { username: updateDto.email, email: updateDto.email, @@ -329,7 +328,7 @@ export class AuthService { }, ) return await this.prismaService.person.update({ - where: {keycloakId}, + where: { keycloakId }, data: { firstName: updateDto.firstName, lastName: updateDto.lastName, @@ -355,7 +354,7 @@ export class AuthService { async changeEnabledStatus(keycloakId: string, enabled: boolean) { await this.authenticateAdmin() // check if user is admin before attempting to activate/deactivate - const userGroups = await this.admin.users.listRoleMappings({id: keycloakId}) + const userGroups = await this.admin.users.listRoleMappings({ id: keycloakId }) const isAdmin = userGroups.realmMappings?.some( (obj) => obj.name === 'team-support' || @@ -366,28 +365,28 @@ export class AuthService { throw new ForbiddenException("Admin profiles can't be deactivated") } await this.admin.users.update( - {id: keycloakId}, + { id: keycloakId }, { enabled, }, ) return await this.prismaService.person.update({ - where: {keycloakId}, - data: {profileEnabled: enabled}, + where: { keycloakId }, + data: { profileEnabled: enabled }, }) } async sendMailForPasswordChange(forgotPasswordDto: ForgottenPasswordEmailDto) { const stage = this.config.get('APP_ENV') === 'development' ? 'APP_URL_LOCAL' : 'APP_URL' const person = await this.prismaService.person.findFirst({ - where: {email: forgotPasswordDto.email}, + where: { email: forgotPasswordDto.email }, }) if (!person || !person.email) { throw new NotFoundException('Invalid email') } - const payload = {username: person.email, sub: person.keycloakId} + const payload = { username: person.email, sub: person.keycloakId } const jtwSecret = process.env.JWT_SECRET_KEY const access_token = this.jwtService.sign(payload, { secret: jtwSecret, @@ -401,17 +400,17 @@ export class AuthService { lastName: person.lastName, link: link, } - const userEmail = {to: [person.email]} + const userEmail = { to: [person.email] } const mail = new ForgottenPasswordMailDto(profile) await this.sendEmail.sendFromTemplate(mail, userEmail, { //Allow users to receive the mail, regardles of unsubscribes - bypassUnsubscribeManagement: {enable: true}, + bypassUnsubscribeManagement: { enable: true }, }) } async updateForgottenPassword(recoveryPasswordDto: NewPasswordDto) { try { - const {sub: keycloakId} = this.jwtService.verify(recoveryPasswordDto.token, { + const { sub: keycloakId } = this.jwtService.verify(recoveryPasswordDto.token, { secret: process.env.JWT_SECRET_KEY, }) return await this.updateUserPassword(keycloakId, recoveryPasswordDto) @@ -423,20 +422,20 @@ export class AuthService { throw response.data ? new NotFoundException(response.data) : new BadRequestException( - 'The forgotten password link has expired, request a new link and try again!', - ) + 'The forgotten password link has expired, request a new link and try again!', + ) } } async permanentDeleteUser(keycloakId: string) { await this.authenticateAdmin() - return this.admin.users.del({id: keycloakId}) + return this.admin.users.del({ id: keycloakId }) .then(() => this.prismaService.person.delete({ - where: {keycloakId} - }) - ).catch(err => { - const msg = `Deleting user in fails with reason ${err.message ?? 'server error'}` + where: { keycloakId }, + }).then(() => Logger.log(`User with keycloak id ${keycloakId} was successfully deleted!`)), + ).catch((err) => { + const msg = `Deleting user in fails with reason ${err.message ?? 'server error!'}` Logger.error(msg) throw new InternalServerErrorException(msg) }) From 2a94f5d48b01aba7a845dde1a8a3a1ea3f281287 Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Thu, 16 Nov 2023 22:42:21 +0100 Subject: [PATCH 05/15] FEAT: improved the permanentDeleteUser promise chain and write some tests --- apps/api/src/auth/auth.service.spec.ts | 50 ++++++++++++++++++++++++-- apps/api/src/auth/auth.service.ts | 22 ++++++------ 2 files changed, 59 insertions(+), 13 deletions(-) diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index 5474f3239..a312c6a31 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -4,7 +4,7 @@ import { ConfigService } from '@nestjs/config' import { HttpService } from '@nestjs/axios' import { plainToClass } from 'class-transformer' import { Test, TestingModule } from '@nestjs/testing' -import { Logger, UnauthorizedException } from '@nestjs/common' +import {InternalServerErrorException, Logger, UnauthorizedException} from '@nestjs/common' import KeycloakConnect, { Grant } from 'keycloak-connect' import { KEYCLOAK_INSTANCE } from 'nest-keycloak-connect' import KeycloakAdminClient from '@keycloak/keycloak-admin-client' @@ -501,4 +501,50 @@ describe('AuthService', () => { expect(marketingSpy).not.toHaveBeenCalled() }) }) -}) + + + describe('permanentDeleteUser', () => { + it('should delete user successfully', async () => { + const keycloakId = '123'; + const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); + const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce(); + const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockResolvedValueOnce(person); + const loggerLogSpy = jest.spyOn(Logger, 'log'); + + await expect(service.permanentDeleteUser(keycloakId)).resolves.not.toThrow(); + + expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); + expect(adminDeleteSpy).toHaveBeenCalledWith({ id: keycloakId }); + expect(prismaDeleteSpy).toHaveBeenCalledWith({ where: { keycloakId } }); + expect(loggerLogSpy).toHaveBeenCalledWith(`User with keycloak id ${keycloakId} was successfully deleted!`); + }); + + it('should handle admin client rejection', async () => { + const keycloakId = '123'; + const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); + const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockRejectedValueOnce(new Error('Admin Client Rejection!')); + const loggerLogSpy = jest.spyOn(Logger, 'error'); + + await expect(service.permanentDeleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); + + expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); + expect(adminDeleteSpy).toHaveBeenCalledWith({ id: keycloakId }); + expect(loggerLogSpy).toHaveBeenCalledWith(`Deleting user fails with reason: Admin Client Rejection!`); + }); + + it('should handle Prisma rejection', async () => { + const keycloakId = '123'; + const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); + const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce(); + const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockRejectedValueOnce(new Error('Prisma Rejection!')); + const loggerLogSpy = jest.spyOn(Logger, 'error'); + + await expect(service.permanentDeleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); + + expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); + expect(adminDeleteSpy).toHaveBeenCalledWith({ id: keycloakId }); + expect(prismaDeleteSpy).toHaveBeenCalledWith({ where: { keycloakId } }); + expect(loggerLogSpy).toHaveBeenCalledWith(`Deleting user fails with reason: Prisma Rejection!`); + }); + }); +}); diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index eaa1dc55f..567758433 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -428,16 +428,16 @@ export class AuthService { } async permanentDeleteUser(keycloakId: string) { - await this.authenticateAdmin() - - return this.admin.users.del({ id: keycloakId }) - .then(() => this.prismaService.person.delete({ - where: { keycloakId }, - }).then(() => Logger.log(`User with keycloak id ${keycloakId} was successfully deleted!`)), - ).catch((err) => { - const msg = `Deleting user in fails with reason ${err.message ?? 'server error!'}` - Logger.error(msg) - throw new InternalServerErrorException(msg) - }) + return this.authenticateAdmin() + .then(() => this.admin.users.del({ id: keycloakId })) + .then(() => this.prismaService.person.delete({ where: { keycloakId } })) + .then(() => { + Logger.log(`User with keycloak id ${keycloakId} was successfully deleted!`); + }) + .catch((err) => { + const errorMessage = `Deleting user fails with reason: ${err.message ?? 'server error!'}`; + Logger.error(errorMessage); + throw new InternalServerErrorException(errorMessage); + }); } } From 9b63befa64ec1f2f4804ecf8205b359eeaa05104 Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Mon, 20 Nov 2023 22:21:52 +0100 Subject: [PATCH 06/15] FEAT: added safeguard to ensure that the deleted person is not corporate. Also, the tests ware updated. --- .env | 14 +- apps/api/src/auth/auth.service.spec.ts | 1106 +++++++++-------- apps/api/src/auth/auth.service.ts | 122 +- .../organizer/entities/organizer.entity.ts | 15 +- apps/api/src/person/person.service.ts | 64 +- 5 files changed, 701 insertions(+), 620 deletions(-) diff --git a/.env b/.env index d690cde6f..73b871f31 100644 --- a/.env +++ b/.env @@ -43,7 +43,6 @@ S3_ENDPOINT=https://cdn-dev.podkrepi.bg S3_ACCESS_KEY=s3-access-key S3_SECRET_ACCESS_KEY=s3-secret-access-key - ## Keycloak ## ############## KEYCLOAK_URL=http://localhost:8180/auth @@ -70,11 +69,15 @@ SENDGRID_API_KEY=sendgrid-key SENDGRID_SENDER_EMAIL=info@podkrepi.bg SENDGRID_INTERNAL_EMAIL=dev@podkrepi.bg SENDGRID_CONTACTS_URL=/v3/marketing/contacts +MARKETING_LIST_ID=6add1a52-f74e-4c14-af56-ec7e1d2318f0 +SENDGRID_SENDER_ID= +## if marketing notifications should be active --> true/false -> defaults to false +SEND_MARKETING_NOTIFICATIONS= ## Stripe ## ############ -STRIPE_SECRET_KEY=stripe-secret-key -STRIPE_WEBHOOK_SECRET=stripe-webhook-secret +STRIPE_SECRET_KEY=sk_test_51ODujOLWrhoGdioppagrcK4On9mXInu0Vf2ynbcHzjy4z42XWz0J9bW1kUTkqXKTmk1DI8OsF6VUhb9mOd05zi9S00ZQn3C6Jy +STRIPE_WEBHOOK_SECRET=whsec_1cd689f0f67df888042ac95950d2a448bb416aff6c0b5d1683ac87c73fcff4fd ## Paypal ## ############ @@ -95,10 +98,11 @@ IRIS_USER_HASH= BANK_BIC=UNCRBGSF PLATFORM_IBAN= IMPORT_TRX_TASK_INTERVAL_MINUTES=60 +#which hour of the day to run the check for consent CHECK_IRIS_CONSENT_TASK_HOUR=10 BILLING_ADMIN_MAIL=billing_admin@podkrepi.bg -CAMPAIGN_ADMIN_MAIL= +CAMPAIGN_ADMIN_MAIL=responsible for campaign management ## Cache ## ############## -CACHE_TTL=60000 +CACHE_TTL=30000 diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index a312c6a31..1225ef11b 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -1,550 +1,608 @@ -import { Person } from '@prisma/client' -import { mockDeep } from 'jest-mock-extended' -import { ConfigService } from '@nestjs/config' -import { HttpService } from '@nestjs/axios' -import { plainToClass } from 'class-transformer' -import { Test, TestingModule } from '@nestjs/testing' +import {Beneficiary, Person} from '@prisma/client' +import {mockDeep} from 'jest-mock-extended' +import {ConfigService} from '@nestjs/config' +import {HttpService} from '@nestjs/axios' +import {plainToClass} from 'class-transformer' +import {Test, TestingModule} from '@nestjs/testing' import {InternalServerErrorException, Logger, UnauthorizedException} from '@nestjs/common' -import KeycloakConnect, { Grant } from 'keycloak-connect' -import { KEYCLOAK_INSTANCE } from 'nest-keycloak-connect' +import KeycloakConnect, {Grant} from 'keycloak-connect' +import {KEYCLOAK_INSTANCE} from 'nest-keycloak-connect' import KeycloakAdminClient from '@keycloak/keycloak-admin-client' -import { LoginDto } from './dto/login.dto' -import { AuthService } from './auth.service' -import { RegisterDto } from './dto/register.dto' -import { MockPrismaService, prismaMock } from '../prisma/prisma-client.mock' -import { RefreshDto } from './dto/refresh.dto' -import { firstValueFrom, Observable } from 'rxjs' -import { ProviderDto } from './dto/provider.dto' -import { EmailService } from '../email/email.service' -import { JwtService } from '@nestjs/jwt' -import { TemplateService } from '../email/template.service' - -import { SendGridNotificationsProvider } from '../notifications/providers/notifications.sendgrid.provider' -import { NotificationsProviderInterface } from '../notifications/providers/notifications.interface.providers' -import { MarketingNotificationsModule } from '../notifications/notifications.module' +import {LoginDto} from './dto/login.dto' +import {AuthService} from './auth.service' +import {RegisterDto} from './dto/register.dto' +import {MockPrismaService, prismaMock} from '../prisma/prisma-client.mock' +import {RefreshDto} from './dto/refresh.dto' +import {firstValueFrom, Observable} from 'rxjs' +import {ProviderDto} from './dto/provider.dto' +import {EmailService} from '../email/email.service' +import {JwtService} from '@nestjs/jwt' +import {TemplateService} from '../email/template.service' + +import {SendGridNotificationsProvider} from '../notifications/providers/notifications.sendgrid.provider' +import {NotificationsProviderInterface} from '../notifications/providers/notifications.interface.providers' +import {MarketingNotificationsModule} from '../notifications/notifications.module' +import {Organizer} from "../domain/generated/organizer/entities"; +import {PersonService} from "../person/person.service"; jest.mock('@keycloak/keycloak-admin-client') describe('AuthService', () => { - let service: AuthService - let config: ConfigService - let admin: KeycloakAdminClient - let keycloak: KeycloakConnect.Keycloak - let marketing: NotificationsProviderInterface - - const person: Person = { - id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', - firstName: 'Admin', - lastName: 'Dev', - companyId: null, - keycloakId: '123', - email: 'test@podkrepi.bg', - emailConfirmed: false, - phone: null, - picture: null, - createdAt: new Date('2021-10-07T13:38:11.097Z'), - updatedAt: new Date('2021-10-07T13:38:11.097Z'), - newsletter: false, - address: null, - birthday: null, - personalNumber: null, - stripeCustomerId: null, - profileEnabled: false, - } - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - imports: [MarketingNotificationsModule], - providers: [ - AuthService, - { - provide: ConfigService, - useValue: { - get: jest.fn((key: string) => { - if (key === 'keycloak.clientId') return 'realm-a12345' - if (key === 'keycloak.secret') return 'a12345' - if (key === 'sendgrid.marketingListId') return 'list-id' - return null - }), - }, - }, - { - provide: KeycloakAdminClient, - useValue: mockDeep(), - }, - { - provide: HttpService, - useValue: mockDeep(), - }, - MockPrismaService, - { - provide: KEYCLOAK_INSTANCE, - useValue: mockDeep(), - }, - { - provide: JwtService, - useValue: mockDeep(), - }, - { - provide: EmailService, - useValue: mockDeep(), - }, - { - provide: TemplateService, - useValue: mockDeep(), - }, - { - provide: NotificationsProviderInterface, - useClass: SendGridNotificationsProvider, - }, - ], - }) - .overrideProvider(ConfigService) - .useValue({ - get: jest.fn((key: string) => { - if (key === 'keycloak.clientId') return 'realm-a12345' - if (key === 'keycloak.secret') return 'a12345' - if (key === 'sendgrid.marketingListId') return 'list-id' - return null - }), - }) - .compile() - - service = module.get(AuthService) - config = module.get(ConfigService) - admin = module.get(KeycloakAdminClient) - marketing = module.get>(NotificationsProviderInterface) - keycloak = module.get(KEYCLOAK_INSTANCE) - }) - - it('should be defined', () => { - expect(service).toBeDefined() - }) - - describe('issueToken', () => { - const email = 'someuser@example.com' - const password = 's3cret' - - it('should call auth', async () => { - const tokenSpy = jest.spyOn(service, 'issueToken') - const token = mockDeep({ - access_token: { token: 't23456' }, - }) - const keycloakSpy = jest - .spyOn(keycloak.grantManager, 'obtainDirectly') - .mockResolvedValue(token) - expect(await service.issueToken(email, password)).toBe('t23456') - expect(keycloakSpy).toHaveBeenCalledWith(email, password) - expect(tokenSpy).toHaveBeenCalledWith(email, password) - expect(admin.auth).not.toHaveBeenCalled() - }) - }) - - describe('token endpoint', () => { - it('should call tokenEndpoint', async () => { - const data = { - grant_type: 'test-grant', - token: 'test-token', - } - const tokenEndpointSpy = jest.spyOn(service, 'tokenEndpoint').mockResolvedValue( - new Observable((s) => { - s.next({ - accessToken: 'test', - refreshToken: 'test-refresh', - expires: '300', - }) - }), - ) - expect(await firstValueFrom(await service.tokenEndpoint(data))).toHaveProperty('accessToken') - expect(tokenEndpointSpy).toHaveBeenCalledWith(data) - expect(admin.auth).not.toHaveBeenCalled() - }) - }) - - describe('refresh', () => { - it('should call issueTokenFromRefresh', async () => { - const refreshToken = 'JWT_TOKEN' - const refreshDto = plainToClass(RefreshDto, { refreshToken }) - const refreshSpy = jest.spyOn(service, 'issueTokenFromRefresh').mockResolvedValue( - new Observable((s) => { - s.next({ - accessToken: 'test', - refreshToken: 'test-refresh', - expires: '300', - }) - }), - ) - - expect(await firstValueFrom(await service.issueTokenFromRefresh(refreshDto))).toHaveProperty( - 'accessToken', - ) - expect(refreshSpy).toHaveBeenCalledWith(refreshDto) - expect(admin.auth).not.toHaveBeenCalled() - }) - }) - - describe('provider token call', () => { - it('should call issueTokenFromProvider', async () => { - const providerToken = 'JWT_TOKEN' - const picture = 'http://image.com' - const provider = 'test-provider' - const providerDto = plainToClass(ProviderDto, { provider, providerToken, picture }) - const providerSpy = jest.spyOn(service, 'issueTokenFromProvider').mockResolvedValue( - new Observable((s) => { - s.next({ - accessToken: 'test', - refreshToken: 'test-refresh', - expires: '300', - }) - }), - ) - - expect( - await firstValueFrom(await service.issueTokenFromProvider(providerDto)), - ).toHaveProperty('accessToken') - expect(providerSpy).toHaveBeenCalledWith(providerDto) - expect(admin.auth).not.toHaveBeenCalled() - }) - }) - - describe('login', () => { - const email = person.email ?? '' - const firstName = person.firstName ?? '' - const lastName = person.lastName ?? '' - const password = 's3cret' - const keycloakId = person.keycloakId ?? '123' - - it('should call issueGrant - without updating person', async () => { - const token = mockDeep({ - access_token: { - token: 't23456', - content: { email: email, given_name: firstName, family_name: lastName, sub: keycloakId }, - }, - }) - const keycloakSpy = jest - .spyOn(keycloak.grantManager, 'obtainDirectly') - .mockResolvedValue(token) - const loginDto = plainToClass(LoginDto, { email, password }) - const loginSpy = jest.spyOn(service, 'login') - const issueGrantSpy = jest.spyOn(service, 'issueGrant') - const userInfoSpy = jest - .spyOn(keycloak.grantManager, 'userInfo') - .mockResolvedValue(token.access_token?.content) - - prismaMock.person.findUnique.mockResolvedValue(person) - expect(await service.login(loginDto)).toBeObject() - expect(loginSpy).toHaveBeenCalledWith(loginDto) - expect(keycloakSpy).toHaveBeenCalledWith(email, password) - expect(issueGrantSpy).toHaveBeenCalledWith(email, password) - expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) - expect(admin.auth).not.toHaveBeenCalled() - }) - - it('should call issueGrant - with updating person due to keycloak mismatch', async () => { - const token = mockDeep({ - access_token: { - token: 't23456', - content: { email: email, given_name: firstName, family_name: lastName, sub: '1234' }, - }, - }) - const keycloakSpy = jest - .spyOn(keycloak.grantManager, 'obtainDirectly') - .mockResolvedValue(token) - const loginDto = plainToClass(LoginDto, { email, password }) - const loginSpy = jest.spyOn(service, 'login') - const issueGrantSpy = jest.spyOn(service, 'issueGrant') - const userInfoSpy = jest - .spyOn(keycloak.grantManager, 'userInfo') - .mockResolvedValue(token.access_token?.content) - const createPersonSpy = jest.spyOn(Object.getPrototypeOf(service), 'createPerson') - - prismaMock.person.findUnique.mockResolvedValue(person) - expect(await service.login(loginDto)).toBeObject() - expect(loginSpy).toHaveBeenCalledWith(loginDto) - expect(keycloakSpy).toHaveBeenCalledWith(email, password) - expect(issueGrantSpy).toHaveBeenCalledWith(email, password) - expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) - expect(admin.auth).toHaveBeenCalled() - expect(createPersonSpy).toHaveBeenCalled() - }) - - it('should call issueGrant - with creating person due to not being found', async () => { - const token = mockDeep({ - access_token: { - token: 't23456', - content: { email: email, given_name: firstName, family_name: lastName, sub: '1234' }, - }, - }) - const keycloakSpy = jest - .spyOn(keycloak.grantManager, 'obtainDirectly') - .mockResolvedValue(token) - const loginDto = plainToClass(LoginDto, { email, password }) - const loginSpy = jest.spyOn(service, 'login') - const issueGrantSpy = jest.spyOn(service, 'issueGrant') - const userInfoSpy = jest - .spyOn(keycloak.grantManager, 'userInfo') - .mockResolvedValue(token.access_token?.content) - const createPersonSpy = jest.spyOn(Object.getPrototypeOf(service), 'createPerson') - - expect(await service.login(loginDto)).toBeObject() - expect(loginSpy).toHaveBeenCalledWith(loginDto) - expect(keycloakSpy).toHaveBeenCalledWith(email, password) - expect(issueGrantSpy).toHaveBeenCalledWith(email, password) - expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) - expect(admin.auth).toHaveBeenCalled() - expect(createPersonSpy).toHaveBeenCalled() - }) - - it('should handle bad password on login', async () => { - const keycloakSpy = jest - .spyOn(keycloak.grantManager, 'obtainDirectly') - .mockRejectedValue(new Error('401:Unauthorized')) - const loginDto = plainToClass(LoginDto, { email, password }) - const loginSpy = jest.spyOn(service, 'login') - const loggerSpy = jest.spyOn(Logger, 'error').mockImplementation() - const issueGrantSpy = jest.spyOn(service, 'issueGrant') - - try { - await service.login(loginDto) - } catch (error) { - expect(error).toBeInstanceOf(UnauthorizedException) - expect(error.message).toBe('401:Unauthorized') - } - - expect(loginSpy).toHaveBeenCalledWith(loginDto) - expect(issueGrantSpy).toHaveBeenCalledWith(email, password) - expect(keycloakSpy).toHaveBeenCalledWith(email, password) - expect(loggerSpy).toBeCalled() - loggerSpy.mockRestore() - }) - }) - - describe('createUser', () => { - const email = 'someuser@example.com' - const password = 's3cret' - const firstName = 'John' - const lastName = 'Doe' - //if no company has been created company.id is expected to be undefined - const companyId = undefined - const profileEnabled = true - const newsletter = true - - it('should call keycloak and prisma', async () => { - const keycloakId = 'u123' - const registerDto = plainToClass(RegisterDto, { - email, - password, - firstName, - lastName, - newsletter, - }) - jest.spyOn(marketing, 'addContactsToList').mockImplementation(async () => true) - const createUserSpy = jest.spyOn(service, 'createUser') - const adminSpy = jest.spyOn(admin.users, 'create').mockResolvedValue({ id: keycloakId }) - const prismaSpy = jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) - - expect(await service.createUser(registerDto)).toBe(person) - expect(createUserSpy).toHaveBeenCalledWith(registerDto) - - expect(config.get).toHaveBeenCalled() - expect(config.get).toHaveBeenCalledWith('keycloak.clientId') - expect(config.get).toHaveBeenCalledWith('keycloak.secret') - expect(admin.auth).toHaveBeenCalledWith({ - clientId: 'realm-a12345', - clientSecret: 'a12345', - grantType: 'client_credentials', - }) - - // Check keycloak creation - expect(adminSpy).toHaveBeenCalledWith({ - username: email, - email, - firstName, - lastName, - enabled: true, - emailVerified: true, - groups: [], - requiredActions: [], - attributes: { selfReg: true }, - credentials: [ - { - type: 'password', - value: password, - temporary: false, - }, - ], - }) - - // Check db creation - expect(prismaSpy).toHaveBeenCalledWith({ - create: { keycloakId, email, firstName, lastName, newsletter, companyId, profileEnabled }, - update: { keycloakId }, - where: { email }, - }) - }) - - it('should handle bad password on registration', async () => { - admin.accessToken = 't23456' - const registerDto = plainToClass(RegisterDto, { email, password, firstName, lastName }) - const createUserSpy = jest.spyOn(service, 'createUser') - const loggerSpy = jest.spyOn(Logger, 'error').mockImplementation() - const adminSpy = jest.spyOn(admin.users, 'create').mockRejectedValue({ - message: 'Request failed with status code 409', - response: { - data: { - errorMessage: 'User exists with same username', - }, - }, - }) - - expect(await service.createUser(registerDto)).toEqual({ - error: 'Request failed with status code 409', - data: { - errorMessage: 'User exists with same username', - }, - }) - expect(createUserSpy).toHaveBeenCalledWith(registerDto) - expect(adminSpy).toHaveBeenCalled() - expect(loggerSpy).toBeCalled() - loggerSpy.mockRestore() - }) - - it('should subscribe email to marketing list if consent is given', async () => { - const keycloakId = 'u123' - const registerDto = plainToClass(RegisterDto, { - email, - password, - firstName, - lastName, - // Add to marketing list - newsletter: true, - }) - const person: Person = { + let service: AuthService + let config: ConfigService + let admin: KeycloakAdminClient + let keycloak: KeycloakConnect.Keycloak + let marketing: NotificationsProviderInterface + let personService: PersonService + + const person: Person = { id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', - firstName, - lastName, + firstName: 'Admin', + lastName: 'Dev', companyId: null, - keycloakId, - email, + keycloakId: '123', + email: 'test@podkrepi.bg', emailConfirmed: false, phone: null, picture: null, createdAt: new Date('2021-10-07T13:38:11.097Z'), updatedAt: new Date('2021-10-07T13:38:11.097Z'), - newsletter: true, + newsletter: false, address: null, birthday: null, personalNumber: null, stripeCustomerId: null, - profileEnabled: true, - } - jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) - jest.spyOn(admin.users, 'create').mockResolvedValue({ id: keycloakId }) - const marketingSpy = jest - .spyOn(marketing, 'addContactsToList') - .mockImplementation(async () => true) - - await service.createUser(registerDto) - - // Check was added to list - expect(marketingSpy).toHaveBeenCalledWith({ - contacts: [ - { - email, - first_name: firstName, - last_name: lastName, - }, - ], - list_ids: ['list-id'], - }) + profileEnabled: false, + } + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + imports: [MarketingNotificationsModule], + providers: [ + AuthService, + { + provide: ConfigService, + useValue: { + get: jest.fn((key: string) => { + if (key === 'keycloak.clientId') return 'realm-a12345' + if (key === 'keycloak.secret') return 'a12345' + if (key === 'sendgrid.marketingListId') return 'list-id' + return null + }), + }, + }, + { + provide: KeycloakAdminClient, + useValue: mockDeep(), + }, + { + provide: HttpService, + useValue: mockDeep(), + }, + MockPrismaService, + { + provide: KEYCLOAK_INSTANCE, + useValue: mockDeep(), + }, + { + provide: JwtService, + useValue: mockDeep(), + }, + { + provide: EmailService, + useValue: mockDeep(), + }, + { + provide: TemplateService, + useValue: mockDeep(), + }, + { + provide: NotificationsProviderInterface, + useClass: SendGridNotificationsProvider, + } + ], + }) + .overrideProvider(ConfigService) + .useValue({ + get: jest.fn((key: string) => { + if (key === 'keycloak.clientId') return 'realm-a12345' + if (key === 'keycloak.secret') return 'a12345' + if (key === 'sendgrid.marketingListId') return 'list-id' + return null + }), + }) + .compile() + + service = module.get(AuthService) + config = module.get(ConfigService) + admin = module.get(KeycloakAdminClient) + marketing = module.get>(NotificationsProviderInterface) + keycloak = module.get(KEYCLOAK_INSTANCE) + personService = module.get(PersonService) }) - it('should NOT subscribe email to marketing list if NO consent is given', async () => { - const keycloakId = 'u123' - const registerDto = plainToClass(RegisterDto, { - email, - password, - firstName, - lastName, - // Don't subscribe to marketing list - newsletter: false, - }) - const person: Person = { - id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', - firstName, - lastName, - companyId: null, - keycloakId, - email, - emailConfirmed: false, - phone: null, - picture: null, - createdAt: new Date('2021-10-07T13:38:11.097Z'), - updatedAt: new Date('2021-10-07T13:38:11.097Z'), - newsletter: false, - address: null, - birthday: null, - personalNumber: null, - stripeCustomerId: null, - profileEnabled: true, - } - jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) - jest.spyOn(admin.users, 'create').mockResolvedValue({ id: keycloakId }) - const marketingSpy = jest - .spyOn(marketing, 'addContactsToList') - .mockImplementation(async () => true) - - await service.createUser(registerDto) - - // Check was not added to list - expect(marketingSpy).not.toHaveBeenCalled() + it('should be defined', () => { + expect(service).toBeDefined() + }) + + describe('issueToken', () => { + const email = 'someuser@example.com' + const password = 's3cret' + + it('should call auth', async () => { + const tokenSpy = jest.spyOn(service, 'issueToken') + const token = mockDeep({ + access_token: {token: 't23456'}, + }) + const keycloakSpy = jest + .spyOn(keycloak.grantManager, 'obtainDirectly') + .mockResolvedValue(token) + expect(await service.issueToken(email, password)).toBe('t23456') + expect(keycloakSpy).toHaveBeenCalledWith(email, password) + expect(tokenSpy).toHaveBeenCalledWith(email, password) + expect(admin.auth).not.toHaveBeenCalled() + }) + }) + + describe('token endpoint', () => { + it('should call tokenEndpoint', async () => { + const data = { + grant_type: 'test-grant', + token: 'test-token', + } + const tokenEndpointSpy = jest.spyOn(service, 'tokenEndpoint').mockResolvedValue( + new Observable((s) => { + s.next({ + accessToken: 'test', + refreshToken: 'test-refresh', + expires: '300', + }) + }), + ) + expect(await firstValueFrom(await service.tokenEndpoint(data))).toHaveProperty('accessToken') + expect(tokenEndpointSpy).toHaveBeenCalledWith(data) + expect(admin.auth).not.toHaveBeenCalled() + }) + }) + + describe('refresh', () => { + it('should call issueTokenFromRefresh', async () => { + const refreshToken = 'JWT_TOKEN' + const refreshDto = plainToClass(RefreshDto, {refreshToken}) + const refreshSpy = jest.spyOn(service, 'issueTokenFromRefresh').mockResolvedValue( + new Observable((s) => { + s.next({ + accessToken: 'test', + refreshToken: 'test-refresh', + expires: '300', + }) + }), + ) + + expect(await firstValueFrom(await service.issueTokenFromRefresh(refreshDto))).toHaveProperty( + 'accessToken', + ) + expect(refreshSpy).toHaveBeenCalledWith(refreshDto) + expect(admin.auth).not.toHaveBeenCalled() + }) + }) + + describe('provider token call', () => { + it('should call issueTokenFromProvider', async () => { + const providerToken = 'JWT_TOKEN' + const picture = 'http://image.com' + const provider = 'test-provider' + const providerDto = plainToClass(ProviderDto, {provider, providerToken, picture}) + const providerSpy = jest.spyOn(service, 'issueTokenFromProvider').mockResolvedValue( + new Observable((s) => { + s.next({ + accessToken: 'test', + refreshToken: 'test-refresh', + expires: '300', + }) + }), + ) + + expect( + await firstValueFrom(await service.issueTokenFromProvider(providerDto)), + ).toHaveProperty('accessToken') + expect(providerSpy).toHaveBeenCalledWith(providerDto) + expect(admin.auth).not.toHaveBeenCalled() + }) + }) + + describe('login', () => { + const email = person.email ?? '' + const firstName = person.firstName ?? '' + const lastName = person.lastName ?? '' + const password = 's3cret' + const keycloakId = person.keycloakId ?? '123' + + it('should call issueGrant - without updating person', async () => { + const token = mockDeep({ + access_token: { + token: 't23456', + content: {email: email, given_name: firstName, family_name: lastName, sub: keycloakId}, + }, + }) + const keycloakSpy = jest + .spyOn(keycloak.grantManager, 'obtainDirectly') + .mockResolvedValue(token) + const loginDto = plainToClass(LoginDto, {email, password}) + const loginSpy = jest.spyOn(service, 'login') + const issueGrantSpy = jest.spyOn(service, 'issueGrant') + const userInfoSpy = jest + .spyOn(keycloak.grantManager, 'userInfo') + .mockResolvedValue(token.access_token?.content) + + prismaMock.person.findUnique.mockResolvedValue(person) + expect(await service.login(loginDto)).toBeObject() + expect(loginSpy).toHaveBeenCalledWith(loginDto) + expect(keycloakSpy).toHaveBeenCalledWith(email, password) + expect(issueGrantSpy).toHaveBeenCalledWith(email, password) + expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) + expect(admin.auth).not.toHaveBeenCalled() + }) + + it('should call issueGrant - with updating person due to keycloak mismatch', async () => { + const token = mockDeep({ + access_token: { + token: 't23456', + content: {email: email, given_name: firstName, family_name: lastName, sub: '1234'}, + }, + }) + const keycloakSpy = jest + .spyOn(keycloak.grantManager, 'obtainDirectly') + .mockResolvedValue(token) + const loginDto = plainToClass(LoginDto, {email, password}) + const loginSpy = jest.spyOn(service, 'login') + const issueGrantSpy = jest.spyOn(service, 'issueGrant') + const userInfoSpy = jest + .spyOn(keycloak.grantManager, 'userInfo') + .mockResolvedValue(token.access_token?.content) + const createPersonSpy = jest.spyOn(Object.getPrototypeOf(service), 'createPerson') + + prismaMock.person.findUnique.mockResolvedValue(person) + expect(await service.login(loginDto)).toBeObject() + expect(loginSpy).toHaveBeenCalledWith(loginDto) + expect(keycloakSpy).toHaveBeenCalledWith(email, password) + expect(issueGrantSpy).toHaveBeenCalledWith(email, password) + expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) + expect(admin.auth).toHaveBeenCalled() + expect(createPersonSpy).toHaveBeenCalled() + }) + + it('should call issueGrant - with creating person due to not being found', async () => { + const token = mockDeep({ + access_token: { + token: 't23456', + content: {email: email, given_name: firstName, family_name: lastName, sub: '1234'}, + }, + }) + const keycloakSpy = jest + .spyOn(keycloak.grantManager, 'obtainDirectly') + .mockResolvedValue(token) + const loginDto = plainToClass(LoginDto, {email, password}) + const loginSpy = jest.spyOn(service, 'login') + const issueGrantSpy = jest.spyOn(service, 'issueGrant') + const userInfoSpy = jest + .spyOn(keycloak.grantManager, 'userInfo') + .mockResolvedValue(token.access_token?.content) + const createPersonSpy = jest.spyOn(Object.getPrototypeOf(service), 'createPerson') + + expect(await service.login(loginDto)).toBeObject() + expect(loginSpy).toHaveBeenCalledWith(loginDto) + expect(keycloakSpy).toHaveBeenCalledWith(email, password) + expect(issueGrantSpy).toHaveBeenCalledWith(email, password) + expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) + expect(admin.auth).toHaveBeenCalled() + expect(createPersonSpy).toHaveBeenCalled() + }) + + it('should handle bad password on login', async () => { + const keycloakSpy = jest + .spyOn(keycloak.grantManager, 'obtainDirectly') + .mockRejectedValue(new Error('401:Unauthorized')) + const loginDto = plainToClass(LoginDto, {email, password}) + const loginSpy = jest.spyOn(service, 'login') + const loggerSpy = jest.spyOn(Logger, 'error').mockImplementation() + const issueGrantSpy = jest.spyOn(service, 'issueGrant') + + try { + await service.login(loginDto) + } catch (error) { + expect(error).toBeInstanceOf(UnauthorizedException) + expect(error.message).toBe('401:Unauthorized') + } + + expect(loginSpy).toHaveBeenCalledWith(loginDto) + expect(issueGrantSpy).toHaveBeenCalledWith(email, password) + expect(keycloakSpy).toHaveBeenCalledWith(email, password) + expect(loggerSpy).toBeCalled() + loggerSpy.mockRestore() + }) + }) + + describe('createUser', () => { + const email = 'someuser@example.com' + const password = 's3cret' + const firstName = 'John' + const lastName = 'Doe' + //if no company has been created company.id is expected to be undefined + const companyId = undefined + const profileEnabled = true + const newsletter = true + + it('should call keycloak and prisma', async () => { + const keycloakId = 'u123' + const registerDto = plainToClass(RegisterDto, { + email, + password, + firstName, + lastName, + newsletter, + }) + jest.spyOn(marketing, 'addContactsToList').mockImplementation(async () => true) + const createUserSpy = jest.spyOn(service, 'createUser') + const adminSpy = jest.spyOn(admin.users, 'create').mockResolvedValue({id: keycloakId}) + const prismaSpy = jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) + + expect(await service.createUser(registerDto)).toBe(person) + expect(createUserSpy).toHaveBeenCalledWith(registerDto) + + expect(config.get).toHaveBeenCalled() + expect(config.get).toHaveBeenCalledWith('keycloak.clientId') + expect(config.get).toHaveBeenCalledWith('keycloak.secret') + expect(admin.auth).toHaveBeenCalledWith({ + clientId: 'realm-a12345', + clientSecret: 'a12345', + grantType: 'client_credentials', + }) + + // Check keycloak creation + expect(adminSpy).toHaveBeenCalledWith({ + username: email, + email, + firstName, + lastName, + enabled: true, + emailVerified: true, + groups: [], + requiredActions: [], + attributes: {selfReg: true}, + credentials: [ + { + type: 'password', + value: password, + temporary: false, + }, + ], + }) + + // Check db creation + expect(prismaSpy).toHaveBeenCalledWith({ + create: {keycloakId, email, firstName, lastName, newsletter, companyId, profileEnabled}, + update: {keycloakId}, + where: {email}, + }) + }) + + it('should handle bad password on registration', async () => { + admin.accessToken = 't23456' + const registerDto = plainToClass(RegisterDto, {email, password, firstName, lastName}) + const createUserSpy = jest.spyOn(service, 'createUser') + const loggerSpy = jest.spyOn(Logger, 'error').mockImplementation() + const adminSpy = jest.spyOn(admin.users, 'create').mockRejectedValue({ + message: 'Request failed with status code 409', + response: { + data: { + errorMessage: 'User exists with same username', + }, + }, + }) + + expect(await service.createUser(registerDto)).toEqual({ + error: 'Request failed with status code 409', + data: { + errorMessage: 'User exists with same username', + }, + }) + expect(createUserSpy).toHaveBeenCalledWith(registerDto) + expect(adminSpy).toHaveBeenCalled() + expect(loggerSpy).toBeCalled() + loggerSpy.mockRestore() + }) + + it('should subscribe email to marketing list if consent is given', async () => { + const keycloakId = 'u123' + const registerDto = plainToClass(RegisterDto, { + email, + password, + firstName, + lastName, + // Add to marketing list + newsletter: true, + }) + const person: Person = { + id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', + firstName, + lastName, + companyId: null, + keycloakId, + email, + emailConfirmed: false, + phone: null, + picture: null, + createdAt: new Date('2021-10-07T13:38:11.097Z'), + updatedAt: new Date('2021-10-07T13:38:11.097Z'), + newsletter: true, + address: null, + birthday: null, + personalNumber: null, + stripeCustomerId: null, + profileEnabled: true, + } + jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) + jest.spyOn(admin.users, 'create').mockResolvedValue({id: keycloakId}) + const marketingSpy = jest + .spyOn(marketing, 'addContactsToList') + .mockImplementation(async () => true) + + await service.createUser(registerDto) + + // Check was added to list + expect(marketingSpy).toHaveBeenCalledWith({ + contacts: [ + { + email, + first_name: firstName, + last_name: lastName, + }, + ], + list_ids: ['list-id'], + }) + }) + + it('should NOT subscribe email to marketing list if NO consent is given', async () => { + const keycloakId = 'u123' + const registerDto = plainToClass(RegisterDto, { + email, + password, + firstName, + lastName, + // Don't subscribe to marketing list + newsletter: false, + }) + const person: Person = { + id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', + firstName, + lastName, + companyId: null, + keycloakId, + email, + emailConfirmed: false, + phone: null, + picture: null, + createdAt: new Date('2021-10-07T13:38:11.097Z'), + updatedAt: new Date('2021-10-07T13:38:11.097Z'), + newsletter: false, + address: null, + birthday: null, + personalNumber: null, + stripeCustomerId: null, + profileEnabled: true, + } + jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) + jest.spyOn(admin.users, 'create').mockResolvedValue({id: keycloakId}) + const marketingSpy = jest + .spyOn(marketing, 'addContactsToList') + .mockImplementation(async () => true) + + await service.createUser(registerDto) + + // Check was not added to list + expect(marketingSpy).not.toHaveBeenCalled() + }) }) - }) describe('permanentDeleteUser', () => { - it('should delete user successfully', async () => { - const keycloakId = '123'; - const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); - const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce(); - const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockResolvedValueOnce(person); - const loggerLogSpy = jest.spyOn(Logger, 'log'); - - await expect(service.permanentDeleteUser(keycloakId)).resolves.not.toThrow(); - - expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); - expect(adminDeleteSpy).toHaveBeenCalledWith({ id: keycloakId }); - expect(prismaDeleteSpy).toHaveBeenCalledWith({ where: { keycloakId } }); - expect(loggerLogSpy).toHaveBeenCalledWith(`User with keycloak id ${keycloakId} was successfully deleted!`); - }); - - it('should handle admin client rejection', async () => { - const keycloakId = '123'; - const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); - const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockRejectedValueOnce(new Error('Admin Client Rejection!')); - const loggerLogSpy = jest.spyOn(Logger, 'error'); - - await expect(service.permanentDeleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); - - expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); - expect(adminDeleteSpy).toHaveBeenCalledWith({ id: keycloakId }); - expect(loggerLogSpy).toHaveBeenCalledWith(`Deleting user fails with reason: Admin Client Rejection!`); - }); - - it('should handle Prisma rejection', async () => { - const keycloakId = '123'; - const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); - const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce(); - const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockRejectedValueOnce(new Error('Prisma Rejection!')); - const loggerLogSpy = jest.spyOn(Logger, 'error'); - - await expect(service.permanentDeleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); - - expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); - expect(adminDeleteSpy).toHaveBeenCalledWith({ id: keycloakId }); - expect(prismaDeleteSpy).toHaveBeenCalledWith({ where: { keycloakId } }); - expect(loggerLogSpy).toHaveBeenCalledWith(`Deleting user fails with reason: Prisma Rejection!`); - }); + const corporatePerson: any = { + id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', + firstName: 'Admin', + lastName: 'Dev', + companyId: null, + keycloakId: '123', + email: 'test@podkrepi.bg', + emailConfirmed: false, + phone: null, + picture: null, + createdAt: new Date('2021-10-07T13:38:11.097Z'), + updatedAt: new Date('2021-10-07T13:38:11.097Z'), + newsletter: false, + address: null, + birthday: null, + personalNumber: null, + stripeCustomerId: null, + profileEnabled: false, + beneficiaries: null, + organizer: null, + } + + it('should delete user successfully', async () => { + const keycloakId = '123'; + const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); + const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); + const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce(); + const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockResolvedValueOnce(person); + const loggerLogSpy = jest.spyOn(Logger, 'log'); + + await expect(service.permanentDeleteUser(keycloakId)).resolves.not.toThrow(); + + expect(personSpy).toHaveBeenCalledOnce(); + expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); + expect(adminDeleteSpy).toHaveBeenCalledWith({id: keycloakId}); + expect(prismaDeleteSpy).toHaveBeenCalledWith({where: {keycloakId}}); + expect(loggerLogSpy).toHaveBeenCalledWith(`User with keycloak id ${keycloakId} was successfully deleted!`); + }); + + it('should handle admin client rejection', async () => { + const keycloakId = '123'; + const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); + const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); + const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockRejectedValueOnce(new Error('Admin Client Rejection!')); + const loggerLogSpy = jest.spyOn(Logger, 'error'); + + await expect(service.permanentDeleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); + + expect(personSpy).toHaveBeenCalledOnce(); + expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); + expect(adminDeleteSpy).toHaveBeenCalledWith({id: keycloakId}); + expect(loggerLogSpy).toHaveBeenCalledWith(`Deleting user fails with reason: Admin Client Rejection!`); + }); + + it('should handle Prisma rejection', async () => { + const keycloakId = '123'; + const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); + const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); + const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce(); + const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockRejectedValueOnce(new Error('Prisma Rejection!')); + const loggerLogSpy = jest.spyOn(Logger, 'error'); + + await expect(service.permanentDeleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); + + expect(personSpy).toHaveBeenCalledOnce(); + expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); + expect(adminDeleteSpy).toHaveBeenCalledWith({id: keycloakId}); + expect(prismaDeleteSpy).toHaveBeenCalledWith({where: {keycloakId}}); + expect(loggerLogSpy).toHaveBeenCalledWith(`Deleting user fails with reason: Prisma Rejection!`); + }); + + it('should throw when corporate user has beneficiaries', async () => { + corporatePerson.beneficiaries = [{id: '123'} as Beneficiary]; + const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); + + await expect(service.permanentDeleteUser('123')).rejects.toThrow(InternalServerErrorException); + expect(personSpy).toHaveBeenCalledOnce(); + }); + + it('should throw when corporate user is organizer', async () => { + corporatePerson.organizer = [{id: '123'} as Organizer]; + const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); + + await expect(service.permanentDeleteUser('123')).rejects.toThrow(InternalServerErrorException); + expect(personSpy).toHaveBeenCalledOnce(); + }); + + it('should throw when corporate user is organizer & has beneficiaries', async () => { + corporatePerson.organizer = [{id: '123'} as Organizer]; + corporatePerson.beneficiaries = [{id: '123'} as Beneficiary]; + + const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); + + await expect(service.permanentDeleteUser('123')).rejects.toThrow(InternalServerErrorException); + expect(personSpy).toHaveBeenCalledOnce(); + }); }); }); diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index 567758433..0059476a8 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -8,30 +8,31 @@ import { NotFoundException, UnauthorizedException, } from '@nestjs/common' -import { HttpService } from '@nestjs/axios' -import { catchError, firstValueFrom, map, Observable } from 'rxjs' +import {HttpService} from '@nestjs/axios' +import {catchError, firstValueFrom, map, Observable} from 'rxjs' import KeycloakConnect from 'keycloak-connect' -import { ConfigService } from '@nestjs/config' -import { KEYCLOAK_INSTANCE } from 'nest-keycloak-connect' +import {ConfigService} from '@nestjs/config' +import {KEYCLOAK_INSTANCE} from 'nest-keycloak-connect' import KeycloakAdminClient from '@keycloak/keycloak-admin-client' -import { RequiredActionAlias } from '@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation' -import { AxiosResponse } from '@nestjs/terminus/dist/health-indicator/http/axios.interfaces' -import { TokenResponseRaw } from '@keycloak/keycloak-admin-client/lib/utils/auth' - -import { Company, Person } from '@prisma/client' -import { PrismaService } from '../prisma/prisma.service' -import { LoginDto } from './dto/login.dto' -import { ProfileType, RegisterDto } from './dto/register.dto' -import { RefreshDto } from './dto/refresh.dto' -import { KeycloakTokenParsed } from './keycloak' -import { ProviderDto } from './dto/provider.dto' -import { UpdatePersonDto } from '../person/dto/update-person.dto' -import { ForgottenPasswordEmailDto } from './dto/forgot-password.dto' -import { JwtService } from '@nestjs/jwt' -import { EmailService } from '../email/email.service' -import { ForgottenPasswordMailDto } from '../email/template.interface' -import { NewPasswordDto } from './dto/recovery-password.dto' -import { MarketingNotificationsService } from '../notifications/notifications.service' +import {RequiredActionAlias} from '@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation' +import {AxiosResponse} from '@nestjs/terminus/dist/health-indicator/http/axios.interfaces' +import {TokenResponseRaw} from '@keycloak/keycloak-admin-client/lib/utils/auth' + +import {Company, Person} from '@prisma/client' +import {PrismaService} from '../prisma/prisma.service' +import {LoginDto} from './dto/login.dto' +import {ProfileType, RegisterDto} from './dto/register.dto' +import {RefreshDto} from './dto/refresh.dto' +import {KeycloakTokenParsed} from './keycloak' +import {ProviderDto} from './dto/provider.dto' +import {UpdatePersonDto} from '../person/dto/update-person.dto' +import {ForgottenPasswordEmailDto} from './dto/forgot-password.dto' +import {JwtService} from '@nestjs/jwt' +import {EmailService} from '../email/email.service' +import {ForgottenPasswordMailDto} from '../email/template.interface' +import {NewPasswordDto} from './dto/recovery-password.dto' +import {MarketingNotificationsService} from '../notifications/notifications.service' +import {PersonService} from "../person/person.service"; type ErrorResponse = { error: string; data: unknown } type KeycloakErrorResponse = { error: string; error_description: string } @@ -63,7 +64,9 @@ export class AuthService { private sendEmail: EmailService, @Inject(KEYCLOAK_INSTANCE) private keycloak: KeycloakConnect.Keycloak, private readonly marketingNotificationsService: MarketingNotificationsService, - ) {} + private readonly personService: PersonService + ) { + } async issueGrant(email: string, password: string): Promise { return this.keycloak.grantManager.obtainDirectly(email, password) @@ -84,7 +87,7 @@ export class AuthService { accessToken: res.data.access_token, expires: res.data.expires_in, })), - catchError(({ response }: { response: AxiosResponse }) => { + catchError(({response}: { response: AxiosResponse }) => { const error = response.data Logger.error("Couldn't get authentication from keycloak. Error: " + JSON.stringify(error)) @@ -121,8 +124,8 @@ export class AuthService { keycloakId: userInfo.sub, }, // Store keycloakId to the person with same email - update: { keycloakId: userInfo.sub }, - where: { email: userInfo.email }, + update: {keycloakId: userInfo.sub}, + where: {email: userInfo.email}, }) return tokenObs$ } @@ -151,11 +154,11 @@ export class AuthService { const user = await this.keycloak.grantManager.userInfo( grant.access_token.token as string, ) - const person = await this.prismaService.person.findUnique({ where: { email: user.email } }) + const person = await this.prismaService.person.findUnique({where: {email: user.email}}) if (!person || person.keycloakId !== user.sub) { Logger.warn('No person found for the current keycloak user. Creating new one...') await this.authenticateAdmin() - const userData = await this.admin.users.findOne({ id: user.sub }) + const userData = await this.admin.users.findOne({id: user.sub}) const registerDto: RegisterDto = { type: ProfileType.INDIVIDUAL, email: userData?.email ?? '', @@ -250,7 +253,7 @@ export class AuthService { emailVerified: true, groups: [], requiredActions: verifyEmail ? [RequiredActionAlias.VERIFY_EMAIL] : [], - attributes: { selfReg: true }, + attributes: {selfReg: true}, credentials: [ { type: 'password', @@ -293,8 +296,8 @@ export class AuthService { profileEnabled: companyId ? false : true, }, // Store keycloakId to the person with same email - update: { keycloakId }, - where: { email: registerDto.email }, + update: {keycloakId}, + where: {email: registerDto.email}, }) } @@ -316,7 +319,7 @@ export class AuthService { async updateUser(keycloakId: string, updateDto: UpdatePersonDto) { await this.authenticateAdmin() await this.admin.users.update( - { id: keycloakId }, + {id: keycloakId}, { username: updateDto.email, email: updateDto.email, @@ -328,7 +331,7 @@ export class AuthService { }, ) return await this.prismaService.person.update({ - where: { keycloakId }, + where: {keycloakId}, data: { firstName: updateDto.firstName, lastName: updateDto.lastName, @@ -354,7 +357,7 @@ export class AuthService { async changeEnabledStatus(keycloakId: string, enabled: boolean) { await this.authenticateAdmin() // check if user is admin before attempting to activate/deactivate - const userGroups = await this.admin.users.listRoleMappings({ id: keycloakId }) + const userGroups = await this.admin.users.listRoleMappings({id: keycloakId}) const isAdmin = userGroups.realmMappings?.some( (obj) => obj.name === 'team-support' || @@ -365,28 +368,28 @@ export class AuthService { throw new ForbiddenException("Admin profiles can't be deactivated") } await this.admin.users.update( - { id: keycloakId }, + {id: keycloakId}, { enabled, }, ) return await this.prismaService.person.update({ - where: { keycloakId }, - data: { profileEnabled: enabled }, + where: {keycloakId}, + data: {profileEnabled: enabled}, }) } async sendMailForPasswordChange(forgotPasswordDto: ForgottenPasswordEmailDto) { const stage = this.config.get('APP_ENV') === 'development' ? 'APP_URL_LOCAL' : 'APP_URL' const person = await this.prismaService.person.findFirst({ - where: { email: forgotPasswordDto.email }, + where: {email: forgotPasswordDto.email}, }) if (!person || !person.email) { throw new NotFoundException('Invalid email') } - const payload = { username: person.email, sub: person.keycloakId } + const payload = {username: person.email, sub: person.keycloakId} const jtwSecret = process.env.JWT_SECRET_KEY const access_token = this.jwtService.sign(payload, { secret: jtwSecret, @@ -400,17 +403,17 @@ export class AuthService { lastName: person.lastName, link: link, } - const userEmail = { to: [person.email] } + const userEmail = {to: [person.email]} const mail = new ForgottenPasswordMailDto(profile) await this.sendEmail.sendFromTemplate(mail, userEmail, { //Allow users to receive the mail, regardles of unsubscribes - bypassUnsubscribeManagement: { enable: true }, + bypassUnsubscribeManagement: {enable: true}, }) } async updateForgottenPassword(recoveryPasswordDto: NewPasswordDto) { try { - const { sub: keycloakId } = this.jwtService.verify(recoveryPasswordDto.token, { + const {sub: keycloakId} = this.jwtService.verify(recoveryPasswordDto.token, { secret: process.env.JWT_SECRET_KEY, }) return await this.updateUserPassword(keycloakId, recoveryPasswordDto) @@ -422,22 +425,33 @@ export class AuthService { throw response.data ? new NotFoundException(response.data) : new BadRequestException( - 'The forgotten password link has expired, request a new link and try again!', - ) + 'The forgotten password link has expired, request a new link and try again!', + ) } } async permanentDeleteUser(keycloakId: string) { + const user = await this.personService.findOneByKeycloakId(keycloakId); + + if (user?.beneficiaries || user?.organizer) { + throw new InternalServerErrorException("Cannot delete a corporate profile"); + } + return this.authenticateAdmin() - .then(() => this.admin.users.del({ id: keycloakId })) - .then(() => this.prismaService.person.delete({ where: { keycloakId } })) - .then(() => { - Logger.log(`User with keycloak id ${keycloakId} was successfully deleted!`); - }) - .catch((err) => { - const errorMessage = `Deleting user fails with reason: ${err.message ?? 'server error!'}`; - Logger.error(errorMessage); - throw new InternalServerErrorException(errorMessage); - }); + .then(() => this.admin.users.del({id: keycloakId})) + .then(() => this.prismaService.person.delete({where: {keycloakId}})) + .then(() => Logger.log(`User with keycloak id ${keycloakId} was successfully deleted!`)) + .catch((err) => { + const errorMessage = `Deleting user fails with reason: ${err.message ?? 'server error!'}`; + Logger.error(errorMessage); + throw new InternalServerErrorException(errorMessage); + }); } } + + + + + + + diff --git a/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts b/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts index c9aa03e4e..b649008a4 100644 --- a/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts +++ b/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts @@ -1,15 +1,14 @@ - import {Person} from '../../person/entities/person.entity' import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' import {Campaign} from '../../campaign/entities/campaign.entity' export class Organizer { - id: string ; -personId: string ; -createdAt: Date ; -updatedAt: Date | null; -person?: Person ; -beneficiaries?: Beneficiary[] ; -campaigns?: Campaign[] ; + id: string; + personId: string; + createdAt: Date; + updatedAt: Date | null; + person?: Person; + beneficiaries?: Beneficiary[]; + campaigns?: Campaign[]; } diff --git a/apps/api/src/person/person.service.ts b/apps/api/src/person/person.service.ts index da9f18fdb..d1c35af4d 100644 --- a/apps/api/src/person/person.service.ts +++ b/apps/api/src/person/person.service.ts @@ -1,10 +1,10 @@ -import { Injectable, Logger } from '@nestjs/common' -import { ConfigService } from '@nestjs/config' +import {Injectable, Logger} from '@nestjs/common' +import {ConfigService} from '@nestjs/config' import mailClient from '@sendgrid/client' -import { Prisma } from '@prisma/client' -import { PrismaService } from '../prisma/prisma.service' -import { CreatePersonDto } from './dto/create-person.dto' -import { UpdatePersonDto } from './dto/update-person.dto' +import {Prisma} from '@prisma/client' +import {PrismaService} from '../prisma/prisma.service' +import {CreatePersonDto} from './dto/create-person.dto' +import {UpdatePersonDto} from './dto/update-person.dto' @Injectable() export class PersonService { @@ -24,7 +24,7 @@ export class PersonService { } async create(createPersonDto: CreatePersonDto) { - const person = await this.prisma.person.create({ data: createPersonDto }) + const person = await this.prisma.person.create({data: createPersonDto}) if (createPersonDto.newsletter && this.enabled) { await this.addToContactList(createPersonDto) } @@ -41,32 +41,32 @@ export class PersonService { const whereClause: Prisma.PersonWhereInput = { ...(search && { OR: [ - { firstName: { contains: search, mode: 'insensitive' } }, - { lastName: { contains: search, mode: 'insensitive' } }, - { email: { contains: search, mode: 'insensitive' } }, - { phone: { contains: search } }, + {firstName: {contains: search, mode: 'insensitive'}}, + {lastName: {contains: search, mode: 'insensitive'}}, + {email: {contains: search, mode: 'insensitive'}}, + {phone: {contains: search}}, ], }), } - let sort: Prisma.PersonOrderByWithRelationInput = { createdAt: 'desc' } + let sort: Prisma.PersonOrderByWithRelationInput = {createdAt: 'desc'} if (sortBy) switch (sortBy) { case 'organizer': - sort = { organizer: { createdAt: sortOrder == 'asc' ? 'asc' : 'desc' } } + sort = {organizer: {createdAt: sortOrder == 'asc' ? 'asc' : 'desc'}} break case 'coordinators': - sort = { coordinators: { createdAt: sortOrder == 'asc' ? 'asc' : 'desc' } } + sort = {coordinators: {createdAt: sortOrder == 'asc' ? 'asc' : 'desc'}} break case 'beneficiaries': - sort = { beneficiaries: { _count: sortOrder == 'asc' ? 'desc' : 'asc' } } + sort = {beneficiaries: {_count: sortOrder == 'asc' ? 'desc' : 'asc'}} break case 'type': - sort = { company: { createdAt: sortOrder == 'asc' ? 'desc' : 'asc' } } + sort = {company: {createdAt: sortOrder == 'asc' ? 'desc' : 'asc'}} break default: - sort = { [sortBy]: sortOrder ?? 'desc' } + sort = {[sortBy]: sortOrder ?? 'desc'} } const data = await this.prisma.person.findMany({ @@ -75,9 +75,9 @@ export class PersonService { where: whereClause, orderBy: [sort], include: { - organizer: { select: { id: true } }, - coordinators: { select: { id: true } }, - beneficiaries: { select: { id: true } }, + organizer: {select: {id: true}}, + coordinators: {select: {id: true}}, + beneficiaries: {select: {id: true}}, }, }) @@ -95,10 +95,10 @@ export class PersonService { async findOne(id: string) { return await this.prisma.person.findFirst({ - where: { id }, + where: {id}, include: { - organizer: { select: { id: true, _count: { select: { campaigns: true } } } }, - coordinators: { select: { id: true, _count: { select: { campaigns: true } } } }, + organizer: {select: {id: true, _count: {select: {campaigns: true}}}}, + coordinators: {select: {id: true, _count: {select: {campaigns: true}}}}, beneficiaries: { select: { id: true, @@ -106,7 +106,7 @@ export class PersonService { cityId: true, description: true, organizerRelation: true, - _count: { select: { campaigns: true } }, + _count: {select: {campaigns: true}}, }, }, }, @@ -114,19 +114,25 @@ export class PersonService { } async findByEmail(email: string) { - return await this.prisma.person.findFirst({ where: { email } }) + return await this.prisma.person.findFirst({where: {email}}) } async findOneByKeycloakId(keycloakId: string) { - return await this.prisma.person.findFirst({ where: { keycloakId }, include: { company: true } }) + return await this.prisma.person.findFirst({ + where: {keycloakId}, include: { + company: true, + beneficiaries: {select: {id:true}}, + organizer: {select:{id:true}} + } + }) } async update(id: string, updatePersonDto: UpdatePersonDto) { - return await this.prisma.person.update({ where: { id }, data: updatePersonDto }) + return await this.prisma.person.update({where: {id}, data: updatePersonDto}) } async remove(id: string) { - return await this.prisma.person.delete({ where: { id } }) + return await this.prisma.person.delete({where: {id}}) } private async addToContactList(createPersonDto: CreatePersonDto) { @@ -154,7 +160,7 @@ export class PersonService { // Create/Update a marketing notifications consent for emails that are not registered async updateUnregisteredNotificationConsent(email: string, consent: boolean) { await this.prisma.unregisteredNotificationConsent.update({ - data: { consent }, + data: {consent}, where: { email, }, From c9a866c75d79e2ac5735151cb788a7e336287e6e Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Mon, 20 Nov 2023 22:47:44 +0100 Subject: [PATCH 07/15] FEAT: fix if to check the array length and adjust tests. --- apps/api/src/auth/auth.service.spec.ts | 2 +- apps/api/src/auth/auth.service.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index 1225ef11b..70d0af39a 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -526,7 +526,7 @@ describe('AuthService', () => { personalNumber: null, stripeCustomerId: null, profileEnabled: false, - beneficiaries: null, + beneficiaries: [], organizer: null, } diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index 0059476a8..9c6b4bcb8 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -433,7 +433,8 @@ export class AuthService { async permanentDeleteUser(keycloakId: string) { const user = await this.personService.findOneByKeycloakId(keycloakId); - if (user?.beneficiaries || user?.organizer) { + //Check and throw if user is a corporate profile + if (user?.beneficiaries?.length || user?.organizer) { throw new InternalServerErrorException("Cannot delete a corporate profile"); } From 7ca574d0326967b3b622c0f7fec5c2fddafd2e6c Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Tue, 21 Nov 2023 09:34:36 +0100 Subject: [PATCH 08/15] FIX: wrong .env commit --- apps/api/src/account/account.controller.ts | 4 +- apps/api/src/account/account.service.ts | 4 +- apps/api/src/auth/auth.service.spec.ts | 12 ++-- apps/api/src/auth/auth.service.ts | 2 +- .../organizer/entities/organizer.entity.ts | 15 ++--- apps/api/src/person/person.service.ts | 56 +++++++++---------- 6 files changed, 47 insertions(+), 46 deletions(-) diff --git a/apps/api/src/account/account.controller.ts b/apps/api/src/account/account.controller.ts index 01571974e..24bea4a0a 100644 --- a/apps/api/src/account/account.controller.ts +++ b/apps/api/src/account/account.controller.ts @@ -69,9 +69,9 @@ export class AccountController { } @Delete('me') - async permanentDeleteUser(@AuthenticatedUser() user: KeycloakTokenParsed) { + async deleteUser(@AuthenticatedUser() user: KeycloakTokenParsed) { try { - return await this.accountService.permanentDeleteUser(user) + return await this.accountService.deleteUser(user) } catch (err) { Logger.error(`Failed to delete user with keycloakId ${user.sub}. Error is: ${err}`) throw err diff --git a/apps/api/src/account/account.service.ts b/apps/api/src/account/account.service.ts index 4f92298d9..fc6c04765 100644 --- a/apps/api/src/account/account.service.ts +++ b/apps/api/src/account/account.service.ts @@ -28,8 +28,8 @@ export class AccountService { return await this.authService.changeEnabledStatus(user.sub, false) } - async permanentDeleteUser(user: KeycloakTokenParsed) { - return await this.authService.permanentDeleteUser(user.sub) + async deleteUser(user: KeycloakTokenParsed) { + return await this.authService.deleteUser(user.sub) } async changeProfileActivationStatus(keycloakId: string, newStatus: boolean) { diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index 70d0af39a..9939ad8ed 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -538,7 +538,7 @@ describe('AuthService', () => { const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockResolvedValueOnce(person); const loggerLogSpy = jest.spyOn(Logger, 'log'); - await expect(service.permanentDeleteUser(keycloakId)).resolves.not.toThrow(); + await expect(service.deleteUser(keycloakId)).resolves.not.toThrow(); expect(personSpy).toHaveBeenCalledOnce(); expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); @@ -554,7 +554,7 @@ describe('AuthService', () => { const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockRejectedValueOnce(new Error('Admin Client Rejection!')); const loggerLogSpy = jest.spyOn(Logger, 'error'); - await expect(service.permanentDeleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); + await expect(service.deleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); expect(personSpy).toHaveBeenCalledOnce(); expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); @@ -570,7 +570,7 @@ describe('AuthService', () => { const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockRejectedValueOnce(new Error('Prisma Rejection!')); const loggerLogSpy = jest.spyOn(Logger, 'error'); - await expect(service.permanentDeleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); + await expect(service.deleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); expect(personSpy).toHaveBeenCalledOnce(); expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); @@ -583,7 +583,7 @@ describe('AuthService', () => { corporatePerson.beneficiaries = [{id: '123'} as Beneficiary]; const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); - await expect(service.permanentDeleteUser('123')).rejects.toThrow(InternalServerErrorException); + await expect(service.deleteUser('123')).rejects.toThrow(InternalServerErrorException); expect(personSpy).toHaveBeenCalledOnce(); }); @@ -591,7 +591,7 @@ describe('AuthService', () => { corporatePerson.organizer = [{id: '123'} as Organizer]; const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); - await expect(service.permanentDeleteUser('123')).rejects.toThrow(InternalServerErrorException); + await expect(service.deleteUser('123')).rejects.toThrow(InternalServerErrorException); expect(personSpy).toHaveBeenCalledOnce(); }); @@ -601,7 +601,7 @@ describe('AuthService', () => { const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); - await expect(service.permanentDeleteUser('123')).rejects.toThrow(InternalServerErrorException); + await expect(service.deleteUser('123')).rejects.toThrow(InternalServerErrorException); expect(personSpy).toHaveBeenCalledOnce(); }); }); diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index 9c6b4bcb8..19ba3a0c8 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -430,7 +430,7 @@ export class AuthService { } } - async permanentDeleteUser(keycloakId: string) { + async deleteUser(keycloakId: string) { const user = await this.personService.findOneByKeycloakId(keycloakId); //Check and throw if user is a corporate profile diff --git a/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts b/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts index b649008a4..c9aa03e4e 100644 --- a/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts +++ b/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts @@ -1,14 +1,15 @@ + import {Person} from '../../person/entities/person.entity' import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' import {Campaign} from '../../campaign/entities/campaign.entity' export class Organizer { - id: string; - personId: string; - createdAt: Date; - updatedAt: Date | null; - person?: Person; - beneficiaries?: Beneficiary[]; - campaigns?: Campaign[]; + id: string ; +personId: string ; +createdAt: Date ; +updatedAt: Date | null; +person?: Person ; +beneficiaries?: Beneficiary[] ; +campaigns?: Campaign[] ; } diff --git a/apps/api/src/person/person.service.ts b/apps/api/src/person/person.service.ts index d1c35af4d..3649d7a45 100644 --- a/apps/api/src/person/person.service.ts +++ b/apps/api/src/person/person.service.ts @@ -1,10 +1,10 @@ -import {Injectable, Logger} from '@nestjs/common' -import {ConfigService} from '@nestjs/config' +import { Injectable, Logger } from '@nestjs/common' +import { ConfigService } from '@nestjs/config' import mailClient from '@sendgrid/client' -import {Prisma} from '@prisma/client' -import {PrismaService} from '../prisma/prisma.service' -import {CreatePersonDto} from './dto/create-person.dto' -import {UpdatePersonDto} from './dto/update-person.dto' +import { Prisma } from '@prisma/client' +import { PrismaService } from '../prisma/prisma.service' +import { CreatePersonDto } from './dto/create-person.dto' +import { UpdatePersonDto } from './dto/update-person.dto' @Injectable() export class PersonService { @@ -24,7 +24,7 @@ export class PersonService { } async create(createPersonDto: CreatePersonDto) { - const person = await this.prisma.person.create({data: createPersonDto}) + const person = await this.prisma.person.create({ data: createPersonDto }) if (createPersonDto.newsletter && this.enabled) { await this.addToContactList(createPersonDto) } @@ -41,32 +41,32 @@ export class PersonService { const whereClause: Prisma.PersonWhereInput = { ...(search && { OR: [ - {firstName: {contains: search, mode: 'insensitive'}}, - {lastName: {contains: search, mode: 'insensitive'}}, - {email: {contains: search, mode: 'insensitive'}}, - {phone: {contains: search}}, + { firstName: { contains: search, mode: 'insensitive' } }, + { lastName: { contains: search, mode: 'insensitive' } }, + { email: { contains: search, mode: 'insensitive' } }, + { phone: { contains: search } }, ], }), } - let sort: Prisma.PersonOrderByWithRelationInput = {createdAt: 'desc'} + let sort: Prisma.PersonOrderByWithRelationInput = { createdAt: 'desc' } if (sortBy) switch (sortBy) { case 'organizer': - sort = {organizer: {createdAt: sortOrder == 'asc' ? 'asc' : 'desc'}} + sort = { organizer: { createdAt: sortOrder == 'asc' ? 'asc' : 'desc' } } break case 'coordinators': - sort = {coordinators: {createdAt: sortOrder == 'asc' ? 'asc' : 'desc'}} + sort = { coordinators: { createdAt: sortOrder == 'asc' ? 'asc' : 'desc' } } break case 'beneficiaries': - sort = {beneficiaries: {_count: sortOrder == 'asc' ? 'desc' : 'asc'}} + sort = { beneficiaries: { _count: sortOrder == 'asc' ? 'desc' : 'asc' } } break case 'type': - sort = {company: {createdAt: sortOrder == 'asc' ? 'desc' : 'asc'}} + sort = { company: { createdAt: sortOrder == 'asc' ? 'desc' : 'asc' } } break default: - sort = {[sortBy]: sortOrder ?? 'desc'} + sort = { [sortBy]: sortOrder ?? 'desc' } } const data = await this.prisma.person.findMany({ @@ -75,9 +75,9 @@ export class PersonService { where: whereClause, orderBy: [sort], include: { - organizer: {select: {id: true}}, - coordinators: {select: {id: true}}, - beneficiaries: {select: {id: true}}, + organizer: { select: { id: true } }, + coordinators: { select: { id: true } }, + beneficiaries: { select: { id: true } }, }, }) @@ -95,10 +95,10 @@ export class PersonService { async findOne(id: string) { return await this.prisma.person.findFirst({ - where: {id}, + where: { id }, include: { - organizer: {select: {id: true, _count: {select: {campaigns: true}}}}, - coordinators: {select: {id: true, _count: {select: {campaigns: true}}}}, + organizer: { select: { id: true, _count: { select: { campaigns: true } } } }, + coordinators: { select: { id: true, _count: { select: { campaigns: true } } } }, beneficiaries: { select: { id: true, @@ -106,7 +106,7 @@ export class PersonService { cityId: true, description: true, organizerRelation: true, - _count: {select: {campaigns: true}}, + _count: { select: { campaigns: true } }, }, }, }, @@ -114,7 +114,7 @@ export class PersonService { } async findByEmail(email: string) { - return await this.prisma.person.findFirst({where: {email}}) + return await this.prisma.person.findFirst({ where: { email } }) } async findOneByKeycloakId(keycloakId: string) { @@ -128,11 +128,11 @@ export class PersonService { } async update(id: string, updatePersonDto: UpdatePersonDto) { - return await this.prisma.person.update({where: {id}, data: updatePersonDto}) + return await this.prisma.person.update({ where: { id }, data: updatePersonDto }) } async remove(id: string) { - return await this.prisma.person.delete({where: {id}}) + return await this.prisma.person.delete({ where: { id } }) } private async addToContactList(createPersonDto: CreatePersonDto) { @@ -160,7 +160,7 @@ export class PersonService { // Create/Update a marketing notifications consent for emails that are not registered async updateUnregisteredNotificationConsent(email: string, consent: boolean) { await this.prisma.unregisteredNotificationConsent.update({ - data: {consent}, + data: { consent }, where: { email, }, From 3e5848cb0462fe7e4dc7f048b41a64d0d349fe0b Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Tue, 21 Nov 2023 09:39:35 +0100 Subject: [PATCH 09/15] FIX: wrong .env commit #2 --- .env | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.env b/.env index 73b871f31..d690cde6f 100644 --- a/.env +++ b/.env @@ -43,6 +43,7 @@ S3_ENDPOINT=https://cdn-dev.podkrepi.bg S3_ACCESS_KEY=s3-access-key S3_SECRET_ACCESS_KEY=s3-secret-access-key + ## Keycloak ## ############## KEYCLOAK_URL=http://localhost:8180/auth @@ -69,15 +70,11 @@ SENDGRID_API_KEY=sendgrid-key SENDGRID_SENDER_EMAIL=info@podkrepi.bg SENDGRID_INTERNAL_EMAIL=dev@podkrepi.bg SENDGRID_CONTACTS_URL=/v3/marketing/contacts -MARKETING_LIST_ID=6add1a52-f74e-4c14-af56-ec7e1d2318f0 -SENDGRID_SENDER_ID= -## if marketing notifications should be active --> true/false -> defaults to false -SEND_MARKETING_NOTIFICATIONS= ## Stripe ## ############ -STRIPE_SECRET_KEY=sk_test_51ODujOLWrhoGdioppagrcK4On9mXInu0Vf2ynbcHzjy4z42XWz0J9bW1kUTkqXKTmk1DI8OsF6VUhb9mOd05zi9S00ZQn3C6Jy -STRIPE_WEBHOOK_SECRET=whsec_1cd689f0f67df888042ac95950d2a448bb416aff6c0b5d1683ac87c73fcff4fd +STRIPE_SECRET_KEY=stripe-secret-key +STRIPE_WEBHOOK_SECRET=stripe-webhook-secret ## Paypal ## ############ @@ -98,11 +95,10 @@ IRIS_USER_HASH= BANK_BIC=UNCRBGSF PLATFORM_IBAN= IMPORT_TRX_TASK_INTERVAL_MINUTES=60 -#which hour of the day to run the check for consent CHECK_IRIS_CONSENT_TASK_HOUR=10 BILLING_ADMIN_MAIL=billing_admin@podkrepi.bg -CAMPAIGN_ADMIN_MAIL=responsible for campaign management +CAMPAIGN_ADMIN_MAIL= ## Cache ## ############## -CACHE_TTL=30000 +CACHE_TTL=60000 From 68fb84b217f614270ba10de4a7b0c2b40f09052e Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Tue, 21 Nov 2023 10:00:30 +0100 Subject: [PATCH 10/15] CHORE: reformat. --- apps/api/src/auth/auth.service.spec.ts | 1175 ++++++++++++------------ apps/api/src/auth/auth.service.ts | 116 ++- apps/api/src/person/person.service.ts | 9 +- 3 files changed, 660 insertions(+), 640 deletions(-) diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index 9939ad8ed..ff6eb6217 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -1,48 +1,486 @@ -import {Beneficiary, Person} from '@prisma/client' -import {mockDeep} from 'jest-mock-extended' -import {ConfigService} from '@nestjs/config' -import {HttpService} from '@nestjs/axios' -import {plainToClass} from 'class-transformer' -import {Test, TestingModule} from '@nestjs/testing' -import {InternalServerErrorException, Logger, UnauthorizedException} from '@nestjs/common' -import KeycloakConnect, {Grant} from 'keycloak-connect' -import {KEYCLOAK_INSTANCE} from 'nest-keycloak-connect' +import { Beneficiary, Person } from '@prisma/client' +import { mockDeep } from 'jest-mock-extended' +import { ConfigService } from '@nestjs/config' +import { HttpService } from '@nestjs/axios' +import { plainToClass } from 'class-transformer' +import { Test, TestingModule } from '@nestjs/testing' +import { InternalServerErrorException, Logger, UnauthorizedException } from '@nestjs/common' +import KeycloakConnect, { Grant } from 'keycloak-connect' +import { KEYCLOAK_INSTANCE } from 'nest-keycloak-connect' import KeycloakAdminClient from '@keycloak/keycloak-admin-client' -import {LoginDto} from './dto/login.dto' -import {AuthService} from './auth.service' -import {RegisterDto} from './dto/register.dto' -import {MockPrismaService, prismaMock} from '../prisma/prisma-client.mock' -import {RefreshDto} from './dto/refresh.dto' -import {firstValueFrom, Observable} from 'rxjs' -import {ProviderDto} from './dto/provider.dto' -import {EmailService} from '../email/email.service' -import {JwtService} from '@nestjs/jwt' -import {TemplateService} from '../email/template.service' - -import {SendGridNotificationsProvider} from '../notifications/providers/notifications.sendgrid.provider' -import {NotificationsProviderInterface} from '../notifications/providers/notifications.interface.providers' -import {MarketingNotificationsModule} from '../notifications/notifications.module' -import {Organizer} from "../domain/generated/organizer/entities"; -import {PersonService} from "../person/person.service"; +import { LoginDto } from './dto/login.dto' +import { AuthService } from './auth.service' +import { RegisterDto } from './dto/register.dto' +import { MockPrismaService, prismaMock } from '../prisma/prisma-client.mock' +import { RefreshDto } from './dto/refresh.dto' +import { firstValueFrom, Observable } from 'rxjs' +import { ProviderDto } from './dto/provider.dto' +import { EmailService } from '../email/email.service' +import { JwtService } from '@nestjs/jwt' +import { TemplateService } from '../email/template.service' + +import { SendGridNotificationsProvider } from '../notifications/providers/notifications.sendgrid.provider' +import { NotificationsProviderInterface } from '../notifications/providers/notifications.interface.providers' +import { MarketingNotificationsModule } from '../notifications/notifications.module' +import { Organizer } from '../domain/generated/organizer/entities' +import { PersonService } from '../person/person.service' jest.mock('@keycloak/keycloak-admin-client') describe('AuthService', () => { - let service: AuthService - let config: ConfigService - let admin: KeycloakAdminClient - let keycloak: KeycloakConnect.Keycloak - let marketing: NotificationsProviderInterface - let personService: PersonService - - const person: Person = { + let service: AuthService + let config: ConfigService + let admin: KeycloakAdminClient + let keycloak: KeycloakConnect.Keycloak + let marketing: NotificationsProviderInterface + let personService: PersonService + + const person: Person = { + id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', + firstName: 'Admin', + lastName: 'Dev', + companyId: null, + keycloakId: '123', + email: 'test@podkrepi.bg', + emailConfirmed: false, + phone: null, + picture: null, + createdAt: new Date('2021-10-07T13:38:11.097Z'), + updatedAt: new Date('2021-10-07T13:38:11.097Z'), + newsletter: false, + address: null, + birthday: null, + personalNumber: null, + stripeCustomerId: null, + profileEnabled: false, + } + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + imports: [MarketingNotificationsModule], + providers: [ + AuthService, + { + provide: ConfigService, + useValue: { + get: jest.fn((key: string) => { + if (key === 'keycloak.clientId') return 'realm-a12345' + if (key === 'keycloak.secret') return 'a12345' + if (key === 'sendgrid.marketingListId') return 'list-id' + return null + }), + }, + }, + { + provide: KeycloakAdminClient, + useValue: mockDeep(), + }, + { + provide: HttpService, + useValue: mockDeep(), + }, + MockPrismaService, + { + provide: KEYCLOAK_INSTANCE, + useValue: mockDeep(), + }, + { + provide: JwtService, + useValue: mockDeep(), + }, + { + provide: EmailService, + useValue: mockDeep(), + }, + { + provide: TemplateService, + useValue: mockDeep(), + }, + { + provide: NotificationsProviderInterface, + useClass: SendGridNotificationsProvider, + }, + ], + }) + .overrideProvider(ConfigService) + .useValue({ + get: jest.fn((key: string) => { + if (key === 'keycloak.clientId') return 'realm-a12345' + if (key === 'keycloak.secret') return 'a12345' + if (key === 'sendgrid.marketingListId') return 'list-id' + return null + }), + }) + .compile() + + service = module.get(AuthService) + config = module.get(ConfigService) + admin = module.get(KeycloakAdminClient) + marketing = module.get>(NotificationsProviderInterface) + keycloak = module.get(KEYCLOAK_INSTANCE) + personService = module.get(PersonService) + }) + + it('should be defined', () => { + expect(service).toBeDefined() + }) + + describe('issueToken', () => { + const email = 'someuser@example.com' + const password = 's3cret' + + it('should call auth', async () => { + const tokenSpy = jest.spyOn(service, 'issueToken') + const token = mockDeep({ + access_token: { token: 't23456' }, + }) + const keycloakSpy = jest + .spyOn(keycloak.grantManager, 'obtainDirectly') + .mockResolvedValue(token) + expect(await service.issueToken(email, password)).toBe('t23456') + expect(keycloakSpy).toHaveBeenCalledWith(email, password) + expect(tokenSpy).toHaveBeenCalledWith(email, password) + expect(admin.auth).not.toHaveBeenCalled() + }) + }) + + describe('token endpoint', () => { + it('should call tokenEndpoint', async () => { + const data = { + grant_type: 'test-grant', + token: 'test-token', + } + const tokenEndpointSpy = jest.spyOn(service, 'tokenEndpoint').mockResolvedValue( + new Observable((s) => { + s.next({ + accessToken: 'test', + refreshToken: 'test-refresh', + expires: '300', + }) + }), + ) + expect(await firstValueFrom(await service.tokenEndpoint(data))).toHaveProperty('accessToken') + expect(tokenEndpointSpy).toHaveBeenCalledWith(data) + expect(admin.auth).not.toHaveBeenCalled() + }) + }) + + describe('refresh', () => { + it('should call issueTokenFromRefresh', async () => { + const refreshToken = 'JWT_TOKEN' + const refreshDto = plainToClass(RefreshDto, { refreshToken }) + const refreshSpy = jest.spyOn(service, 'issueTokenFromRefresh').mockResolvedValue( + new Observable((s) => { + s.next({ + accessToken: 'test', + refreshToken: 'test-refresh', + expires: '300', + }) + }), + ) + + expect(await firstValueFrom(await service.issueTokenFromRefresh(refreshDto))).toHaveProperty( + 'accessToken', + ) + expect(refreshSpy).toHaveBeenCalledWith(refreshDto) + expect(admin.auth).not.toHaveBeenCalled() + }) + }) + + describe('provider token call', () => { + it('should call issueTokenFromProvider', async () => { + const providerToken = 'JWT_TOKEN' + const picture = 'http://image.com' + const provider = 'test-provider' + const providerDto = plainToClass(ProviderDto, { provider, providerToken, picture }) + const providerSpy = jest.spyOn(service, 'issueTokenFromProvider').mockResolvedValue( + new Observable((s) => { + s.next({ + accessToken: 'test', + refreshToken: 'test-refresh', + expires: '300', + }) + }), + ) + + expect( + await firstValueFrom(await service.issueTokenFromProvider(providerDto)), + ).toHaveProperty('accessToken') + expect(providerSpy).toHaveBeenCalledWith(providerDto) + expect(admin.auth).not.toHaveBeenCalled() + }) + }) + + describe('login', () => { + const email = person.email ?? '' + const firstName = person.firstName ?? '' + const lastName = person.lastName ?? '' + const password = 's3cret' + const keycloakId = person.keycloakId ?? '123' + + it('should call issueGrant - without updating person', async () => { + const token = mockDeep({ + access_token: { + token: 't23456', + content: { email: email, given_name: firstName, family_name: lastName, sub: keycloakId }, + }, + }) + const keycloakSpy = jest + .spyOn(keycloak.grantManager, 'obtainDirectly') + .mockResolvedValue(token) + const loginDto = plainToClass(LoginDto, { email, password }) + const loginSpy = jest.spyOn(service, 'login') + const issueGrantSpy = jest.spyOn(service, 'issueGrant') + const userInfoSpy = jest + .spyOn(keycloak.grantManager, 'userInfo') + .mockResolvedValue(token.access_token?.content) + + prismaMock.person.findUnique.mockResolvedValue(person) + expect(await service.login(loginDto)).toBeObject() + expect(loginSpy).toHaveBeenCalledWith(loginDto) + expect(keycloakSpy).toHaveBeenCalledWith(email, password) + expect(issueGrantSpy).toHaveBeenCalledWith(email, password) + expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) + expect(admin.auth).not.toHaveBeenCalled() + }) + + it('should call issueGrant - with updating person due to keycloak mismatch', async () => { + const token = mockDeep({ + access_token: { + token: 't23456', + content: { email: email, given_name: firstName, family_name: lastName, sub: '1234' }, + }, + }) + const keycloakSpy = jest + .spyOn(keycloak.grantManager, 'obtainDirectly') + .mockResolvedValue(token) + const loginDto = plainToClass(LoginDto, { email, password }) + const loginSpy = jest.spyOn(service, 'login') + const issueGrantSpy = jest.spyOn(service, 'issueGrant') + const userInfoSpy = jest + .spyOn(keycloak.grantManager, 'userInfo') + .mockResolvedValue(token.access_token?.content) + const createPersonSpy = jest.spyOn(Object.getPrototypeOf(service), 'createPerson') + + prismaMock.person.findUnique.mockResolvedValue(person) + expect(await service.login(loginDto)).toBeObject() + expect(loginSpy).toHaveBeenCalledWith(loginDto) + expect(keycloakSpy).toHaveBeenCalledWith(email, password) + expect(issueGrantSpy).toHaveBeenCalledWith(email, password) + expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) + expect(admin.auth).toHaveBeenCalled() + expect(createPersonSpy).toHaveBeenCalled() + }) + + it('should call issueGrant - with creating person due to not being found', async () => { + const token = mockDeep({ + access_token: { + token: 't23456', + content: { email: email, given_name: firstName, family_name: lastName, sub: '1234' }, + }, + }) + const keycloakSpy = jest + .spyOn(keycloak.grantManager, 'obtainDirectly') + .mockResolvedValue(token) + const loginDto = plainToClass(LoginDto, { email, password }) + const loginSpy = jest.spyOn(service, 'login') + const issueGrantSpy = jest.spyOn(service, 'issueGrant') + const userInfoSpy = jest + .spyOn(keycloak.grantManager, 'userInfo') + .mockResolvedValue(token.access_token?.content) + const createPersonSpy = jest.spyOn(Object.getPrototypeOf(service), 'createPerson') + + expect(await service.login(loginDto)).toBeObject() + expect(loginSpy).toHaveBeenCalledWith(loginDto) + expect(keycloakSpy).toHaveBeenCalledWith(email, password) + expect(issueGrantSpy).toHaveBeenCalledWith(email, password) + expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) + expect(admin.auth).toHaveBeenCalled() + expect(createPersonSpy).toHaveBeenCalled() + }) + + it('should handle bad password on login', async () => { + const keycloakSpy = jest + .spyOn(keycloak.grantManager, 'obtainDirectly') + .mockRejectedValue(new Error('401:Unauthorized')) + const loginDto = plainToClass(LoginDto, { email, password }) + const loginSpy = jest.spyOn(service, 'login') + const loggerSpy = jest.spyOn(Logger, 'error').mockImplementation() + const issueGrantSpy = jest.spyOn(service, 'issueGrant') + + try { + await service.login(loginDto) + } catch (error) { + expect(error).toBeInstanceOf(UnauthorizedException) + expect(error.message).toBe('401:Unauthorized') + } + + expect(loginSpy).toHaveBeenCalledWith(loginDto) + expect(issueGrantSpy).toHaveBeenCalledWith(email, password) + expect(keycloakSpy).toHaveBeenCalledWith(email, password) + expect(loggerSpy).toBeCalled() + loggerSpy.mockRestore() + }) + }) + + describe('createUser', () => { + const email = 'someuser@example.com' + const password = 's3cret' + const firstName = 'John' + const lastName = 'Doe' + //if no company has been created company.id is expected to be undefined + const companyId = undefined + const profileEnabled = true + const newsletter = true + + it('should call keycloak and prisma', async () => { + const keycloakId = 'u123' + const registerDto = plainToClass(RegisterDto, { + email, + password, + firstName, + lastName, + newsletter, + }) + jest.spyOn(marketing, 'addContactsToList').mockImplementation(async () => true) + const createUserSpy = jest.spyOn(service, 'createUser') + const adminSpy = jest.spyOn(admin.users, 'create').mockResolvedValue({ id: keycloakId }) + const prismaSpy = jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) + + expect(await service.createUser(registerDto)).toBe(person) + expect(createUserSpy).toHaveBeenCalledWith(registerDto) + + expect(config.get).toHaveBeenCalled() + expect(config.get).toHaveBeenCalledWith('keycloak.clientId') + expect(config.get).toHaveBeenCalledWith('keycloak.secret') + expect(admin.auth).toHaveBeenCalledWith({ + clientId: 'realm-a12345', + clientSecret: 'a12345', + grantType: 'client_credentials', + }) + + // Check keycloak creation + expect(adminSpy).toHaveBeenCalledWith({ + username: email, + email, + firstName, + lastName, + enabled: true, + emailVerified: true, + groups: [], + requiredActions: [], + attributes: { selfReg: true }, + credentials: [ + { + type: 'password', + value: password, + temporary: false, + }, + ], + }) + + // Check db creation + expect(prismaSpy).toHaveBeenCalledWith({ + create: { keycloakId, email, firstName, lastName, newsletter, companyId, profileEnabled }, + update: { keycloakId }, + where: { email }, + }) + }) + + it('should handle bad password on registration', async () => { + admin.accessToken = 't23456' + const registerDto = plainToClass(RegisterDto, { email, password, firstName, lastName }) + const createUserSpy = jest.spyOn(service, 'createUser') + const loggerSpy = jest.spyOn(Logger, 'error').mockImplementation() + const adminSpy = jest.spyOn(admin.users, 'create').mockRejectedValue({ + message: 'Request failed with status code 409', + response: { + data: { + errorMessage: 'User exists with same username', + }, + }, + }) + + expect(await service.createUser(registerDto)).toEqual({ + error: 'Request failed with status code 409', + data: { + errorMessage: 'User exists with same username', + }, + }) + expect(createUserSpy).toHaveBeenCalledWith(registerDto) + expect(adminSpy).toHaveBeenCalled() + expect(loggerSpy).toBeCalled() + loggerSpy.mockRestore() + }) + + it('should subscribe email to marketing list if consent is given', async () => { + const keycloakId = 'u123' + const registerDto = plainToClass(RegisterDto, { + email, + password, + firstName, + lastName, + // Add to marketing list + newsletter: true, + }) + const person: Person = { id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', - firstName: 'Admin', - lastName: 'Dev', + firstName, + lastName, companyId: null, - keycloakId: '123', - email: 'test@podkrepi.bg', + keycloakId, + email, + emailConfirmed: false, + phone: null, + picture: null, + createdAt: new Date('2021-10-07T13:38:11.097Z'), + updatedAt: new Date('2021-10-07T13:38:11.097Z'), + newsletter: true, + address: null, + birthday: null, + personalNumber: null, + stripeCustomerId: null, + profileEnabled: true, + } + jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) + jest.spyOn(admin.users, 'create').mockResolvedValue({ id: keycloakId }) + const marketingSpy = jest + .spyOn(marketing, 'addContactsToList') + .mockImplementation(async () => true) + + await service.createUser(registerDto) + + // Check was added to list + expect(marketingSpy).toHaveBeenCalledWith({ + contacts: [ + { + email, + first_name: firstName, + last_name: lastName, + }, + ], + list_ids: ['list-id'], + }) + }) + + it('should NOT subscribe email to marketing list if NO consent is given', async () => { + const keycloakId = 'u123' + const registerDto = plainToClass(RegisterDto, { + email, + password, + firstName, + lastName, + // Don't subscribe to marketing list + newsletter: false, + }) + const person: Person = { + id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', + firstName, + lastName, + companyId: null, + keycloakId, + email, emailConfirmed: false, phone: null, picture: null, @@ -53,556 +491,145 @@ describe('AuthService', () => { birthday: null, personalNumber: null, stripeCustomerId: null, - profileEnabled: false, + profileEnabled: true, + } + jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) + jest.spyOn(admin.users, 'create').mockResolvedValue({ id: keycloakId }) + const marketingSpy = jest + .spyOn(marketing, 'addContactsToList') + .mockImplementation(async () => true) + + await service.createUser(registerDto) + + // Check was not added to list + expect(marketingSpy).not.toHaveBeenCalled() + }) + }) + + describe('permanentDeleteUser', () => { + const corporatePerson: any = { + id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', + firstName: 'Admin', + lastName: 'Dev', + companyId: null, + keycloakId: '123', + email: 'test@podkrepi.bg', + emailConfirmed: false, + phone: null, + picture: null, + createdAt: new Date('2021-10-07T13:38:11.097Z'), + updatedAt: new Date('2021-10-07T13:38:11.097Z'), + newsletter: false, + address: null, + birthday: null, + personalNumber: null, + stripeCustomerId: null, + profileEnabled: false, + beneficiaries: [], + organizer: null, } - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - imports: [MarketingNotificationsModule], - providers: [ - AuthService, - { - provide: ConfigService, - useValue: { - get: jest.fn((key: string) => { - if (key === 'keycloak.clientId') return 'realm-a12345' - if (key === 'keycloak.secret') return 'a12345' - if (key === 'sendgrid.marketingListId') return 'list-id' - return null - }), - }, - }, - { - provide: KeycloakAdminClient, - useValue: mockDeep(), - }, - { - provide: HttpService, - useValue: mockDeep(), - }, - MockPrismaService, - { - provide: KEYCLOAK_INSTANCE, - useValue: mockDeep(), - }, - { - provide: JwtService, - useValue: mockDeep(), - }, - { - provide: EmailService, - useValue: mockDeep(), - }, - { - provide: TemplateService, - useValue: mockDeep(), - }, - { - provide: NotificationsProviderInterface, - useClass: SendGridNotificationsProvider, - } - ], - }) - .overrideProvider(ConfigService) - .useValue({ - get: jest.fn((key: string) => { - if (key === 'keycloak.clientId') return 'realm-a12345' - if (key === 'keycloak.secret') return 'a12345' - if (key === 'sendgrid.marketingListId') return 'list-id' - return null - }), - }) - .compile() - - service = module.get(AuthService) - config = module.get(ConfigService) - admin = module.get(KeycloakAdminClient) - marketing = module.get>(NotificationsProviderInterface) - keycloak = module.get(KEYCLOAK_INSTANCE) - personService = module.get(PersonService) + it('should delete user successfully', async () => { + const keycloakId = '123' + const personSpy = jest + .spyOn(personService, 'findOneByKeycloakId') + .mockResolvedValue(corporatePerson) + const authenticateAdminSpy = jest + .spyOn(service as any, 'authenticateAdmin') + .mockResolvedValueOnce('') + const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce() + const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockResolvedValueOnce(person) + const loggerLogSpy = jest.spyOn(Logger, 'log') + + await expect(service.deleteUser(keycloakId)).resolves.not.toThrow() + + expect(personSpy).toHaveBeenCalledOnce() + expect(authenticateAdminSpy).toHaveBeenCalledTimes(1) + expect(adminDeleteSpy).toHaveBeenCalledWith({ id: keycloakId }) + expect(prismaDeleteSpy).toHaveBeenCalledWith({ where: { keycloakId } }) + expect(loggerLogSpy).toHaveBeenCalledWith( + `User with keycloak id ${keycloakId} was successfully deleted!`, + ) }) - it('should be defined', () => { - expect(service).toBeDefined() + it('should handle admin client rejection', async () => { + const keycloakId = '123' + const personSpy = jest + .spyOn(personService, 'findOneByKeycloakId') + .mockResolvedValue(corporatePerson) + const authenticateAdminSpy = jest + .spyOn(service as any, 'authenticateAdmin') + .mockResolvedValueOnce('') + const adminDeleteSpy = jest + .spyOn(admin.users, 'del') + .mockRejectedValueOnce(new Error('Admin Client Rejection!')) + const loggerLogSpy = jest.spyOn(Logger, 'error') + + await expect(service.deleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException) + + expect(personSpy).toHaveBeenCalledOnce() + expect(authenticateAdminSpy).toHaveBeenCalledTimes(1) + expect(adminDeleteSpy).toHaveBeenCalledWith({ id: keycloakId }) + expect(loggerLogSpy).toHaveBeenCalledWith( + `Deleting user fails with reason: Admin Client Rejection!`, + ) }) - describe('issueToken', () => { - const email = 'someuser@example.com' - const password = 's3cret' - - it('should call auth', async () => { - const tokenSpy = jest.spyOn(service, 'issueToken') - const token = mockDeep({ - access_token: {token: 't23456'}, - }) - const keycloakSpy = jest - .spyOn(keycloak.grantManager, 'obtainDirectly') - .mockResolvedValue(token) - expect(await service.issueToken(email, password)).toBe('t23456') - expect(keycloakSpy).toHaveBeenCalledWith(email, password) - expect(tokenSpy).toHaveBeenCalledWith(email, password) - expect(admin.auth).not.toHaveBeenCalled() - }) + it('should handle Prisma rejection', async () => { + const keycloakId = '123' + const personSpy = jest + .spyOn(personService, 'findOneByKeycloakId') + .mockResolvedValue(corporatePerson) + const authenticateAdminSpy = jest + .spyOn(service as any, 'authenticateAdmin') + .mockResolvedValueOnce('') + const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce() + const prismaDeleteSpy = jest + .spyOn(prismaMock.person, 'delete') + .mockRejectedValueOnce(new Error('Prisma Rejection!')) + const loggerLogSpy = jest.spyOn(Logger, 'error') + + await expect(service.deleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException) + + expect(personSpy).toHaveBeenCalledOnce() + expect(authenticateAdminSpy).toHaveBeenCalledTimes(1) + expect(adminDeleteSpy).toHaveBeenCalledWith({ id: keycloakId }) + expect(prismaDeleteSpy).toHaveBeenCalledWith({ where: { keycloakId } }) + expect(loggerLogSpy).toHaveBeenCalledWith( + `Deleting user fails with reason: Prisma Rejection!`, + ) }) - describe('token endpoint', () => { - it('should call tokenEndpoint', async () => { - const data = { - grant_type: 'test-grant', - token: 'test-token', - } - const tokenEndpointSpy = jest.spyOn(service, 'tokenEndpoint').mockResolvedValue( - new Observable((s) => { - s.next({ - accessToken: 'test', - refreshToken: 'test-refresh', - expires: '300', - }) - }), - ) - expect(await firstValueFrom(await service.tokenEndpoint(data))).toHaveProperty('accessToken') - expect(tokenEndpointSpy).toHaveBeenCalledWith(data) - expect(admin.auth).not.toHaveBeenCalled() - }) - }) + it('should throw when corporate user has beneficiaries', async () => { + corporatePerson.beneficiaries = [{ id: '123' } as Beneficiary] + const personSpy = jest + .spyOn(personService, 'findOneByKeycloakId') + .mockResolvedValue(corporatePerson) - describe('refresh', () => { - it('should call issueTokenFromRefresh', async () => { - const refreshToken = 'JWT_TOKEN' - const refreshDto = plainToClass(RefreshDto, {refreshToken}) - const refreshSpy = jest.spyOn(service, 'issueTokenFromRefresh').mockResolvedValue( - new Observable((s) => { - s.next({ - accessToken: 'test', - refreshToken: 'test-refresh', - expires: '300', - }) - }), - ) - - expect(await firstValueFrom(await service.issueTokenFromRefresh(refreshDto))).toHaveProperty( - 'accessToken', - ) - expect(refreshSpy).toHaveBeenCalledWith(refreshDto) - expect(admin.auth).not.toHaveBeenCalled() - }) + await expect(service.deleteUser('123')).rejects.toThrow(InternalServerErrorException) + expect(personSpy).toHaveBeenCalledOnce() }) - describe('provider token call', () => { - it('should call issueTokenFromProvider', async () => { - const providerToken = 'JWT_TOKEN' - const picture = 'http://image.com' - const provider = 'test-provider' - const providerDto = plainToClass(ProviderDto, {provider, providerToken, picture}) - const providerSpy = jest.spyOn(service, 'issueTokenFromProvider').mockResolvedValue( - new Observable((s) => { - s.next({ - accessToken: 'test', - refreshToken: 'test-refresh', - expires: '300', - }) - }), - ) - - expect( - await firstValueFrom(await service.issueTokenFromProvider(providerDto)), - ).toHaveProperty('accessToken') - expect(providerSpy).toHaveBeenCalledWith(providerDto) - expect(admin.auth).not.toHaveBeenCalled() - }) - }) + it('should throw when corporate user is organizer', async () => { + corporatePerson.organizer = [{ id: '123' } as Organizer] + const personSpy = jest + .spyOn(personService, 'findOneByKeycloakId') + .mockResolvedValue(corporatePerson) - describe('login', () => { - const email = person.email ?? '' - const firstName = person.firstName ?? '' - const lastName = person.lastName ?? '' - const password = 's3cret' - const keycloakId = person.keycloakId ?? '123' - - it('should call issueGrant - without updating person', async () => { - const token = mockDeep({ - access_token: { - token: 't23456', - content: {email: email, given_name: firstName, family_name: lastName, sub: keycloakId}, - }, - }) - const keycloakSpy = jest - .spyOn(keycloak.grantManager, 'obtainDirectly') - .mockResolvedValue(token) - const loginDto = plainToClass(LoginDto, {email, password}) - const loginSpy = jest.spyOn(service, 'login') - const issueGrantSpy = jest.spyOn(service, 'issueGrant') - const userInfoSpy = jest - .spyOn(keycloak.grantManager, 'userInfo') - .mockResolvedValue(token.access_token?.content) - - prismaMock.person.findUnique.mockResolvedValue(person) - expect(await service.login(loginDto)).toBeObject() - expect(loginSpy).toHaveBeenCalledWith(loginDto) - expect(keycloakSpy).toHaveBeenCalledWith(email, password) - expect(issueGrantSpy).toHaveBeenCalledWith(email, password) - expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) - expect(admin.auth).not.toHaveBeenCalled() - }) - - it('should call issueGrant - with updating person due to keycloak mismatch', async () => { - const token = mockDeep({ - access_token: { - token: 't23456', - content: {email: email, given_name: firstName, family_name: lastName, sub: '1234'}, - }, - }) - const keycloakSpy = jest - .spyOn(keycloak.grantManager, 'obtainDirectly') - .mockResolvedValue(token) - const loginDto = plainToClass(LoginDto, {email, password}) - const loginSpy = jest.spyOn(service, 'login') - const issueGrantSpy = jest.spyOn(service, 'issueGrant') - const userInfoSpy = jest - .spyOn(keycloak.grantManager, 'userInfo') - .mockResolvedValue(token.access_token?.content) - const createPersonSpy = jest.spyOn(Object.getPrototypeOf(service), 'createPerson') - - prismaMock.person.findUnique.mockResolvedValue(person) - expect(await service.login(loginDto)).toBeObject() - expect(loginSpy).toHaveBeenCalledWith(loginDto) - expect(keycloakSpy).toHaveBeenCalledWith(email, password) - expect(issueGrantSpy).toHaveBeenCalledWith(email, password) - expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) - expect(admin.auth).toHaveBeenCalled() - expect(createPersonSpy).toHaveBeenCalled() - }) - - it('should call issueGrant - with creating person due to not being found', async () => { - const token = mockDeep({ - access_token: { - token: 't23456', - content: {email: email, given_name: firstName, family_name: lastName, sub: '1234'}, - }, - }) - const keycloakSpy = jest - .spyOn(keycloak.grantManager, 'obtainDirectly') - .mockResolvedValue(token) - const loginDto = plainToClass(LoginDto, {email, password}) - const loginSpy = jest.spyOn(service, 'login') - const issueGrantSpy = jest.spyOn(service, 'issueGrant') - const userInfoSpy = jest - .spyOn(keycloak.grantManager, 'userInfo') - .mockResolvedValue(token.access_token?.content) - const createPersonSpy = jest.spyOn(Object.getPrototypeOf(service), 'createPerson') - - expect(await service.login(loginDto)).toBeObject() - expect(loginSpy).toHaveBeenCalledWith(loginDto) - expect(keycloakSpy).toHaveBeenCalledWith(email, password) - expect(issueGrantSpy).toHaveBeenCalledWith(email, password) - expect(userInfoSpy).toHaveBeenCalledWith(token.access_token?.token) - expect(admin.auth).toHaveBeenCalled() - expect(createPersonSpy).toHaveBeenCalled() - }) - - it('should handle bad password on login', async () => { - const keycloakSpy = jest - .spyOn(keycloak.grantManager, 'obtainDirectly') - .mockRejectedValue(new Error('401:Unauthorized')) - const loginDto = plainToClass(LoginDto, {email, password}) - const loginSpy = jest.spyOn(service, 'login') - const loggerSpy = jest.spyOn(Logger, 'error').mockImplementation() - const issueGrantSpy = jest.spyOn(service, 'issueGrant') - - try { - await service.login(loginDto) - } catch (error) { - expect(error).toBeInstanceOf(UnauthorizedException) - expect(error.message).toBe('401:Unauthorized') - } - - expect(loginSpy).toHaveBeenCalledWith(loginDto) - expect(issueGrantSpy).toHaveBeenCalledWith(email, password) - expect(keycloakSpy).toHaveBeenCalledWith(email, password) - expect(loggerSpy).toBeCalled() - loggerSpy.mockRestore() - }) + await expect(service.deleteUser('123')).rejects.toThrow(InternalServerErrorException) + expect(personSpy).toHaveBeenCalledOnce() }) - describe('createUser', () => { - const email = 'someuser@example.com' - const password = 's3cret' - const firstName = 'John' - const lastName = 'Doe' - //if no company has been created company.id is expected to be undefined - const companyId = undefined - const profileEnabled = true - const newsletter = true - - it('should call keycloak and prisma', async () => { - const keycloakId = 'u123' - const registerDto = plainToClass(RegisterDto, { - email, - password, - firstName, - lastName, - newsletter, - }) - jest.spyOn(marketing, 'addContactsToList').mockImplementation(async () => true) - const createUserSpy = jest.spyOn(service, 'createUser') - const adminSpy = jest.spyOn(admin.users, 'create').mockResolvedValue({id: keycloakId}) - const prismaSpy = jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) - - expect(await service.createUser(registerDto)).toBe(person) - expect(createUserSpy).toHaveBeenCalledWith(registerDto) - - expect(config.get).toHaveBeenCalled() - expect(config.get).toHaveBeenCalledWith('keycloak.clientId') - expect(config.get).toHaveBeenCalledWith('keycloak.secret') - expect(admin.auth).toHaveBeenCalledWith({ - clientId: 'realm-a12345', - clientSecret: 'a12345', - grantType: 'client_credentials', - }) - - // Check keycloak creation - expect(adminSpy).toHaveBeenCalledWith({ - username: email, - email, - firstName, - lastName, - enabled: true, - emailVerified: true, - groups: [], - requiredActions: [], - attributes: {selfReg: true}, - credentials: [ - { - type: 'password', - value: password, - temporary: false, - }, - ], - }) - - // Check db creation - expect(prismaSpy).toHaveBeenCalledWith({ - create: {keycloakId, email, firstName, lastName, newsletter, companyId, profileEnabled}, - update: {keycloakId}, - where: {email}, - }) - }) - - it('should handle bad password on registration', async () => { - admin.accessToken = 't23456' - const registerDto = plainToClass(RegisterDto, {email, password, firstName, lastName}) - const createUserSpy = jest.spyOn(service, 'createUser') - const loggerSpy = jest.spyOn(Logger, 'error').mockImplementation() - const adminSpy = jest.spyOn(admin.users, 'create').mockRejectedValue({ - message: 'Request failed with status code 409', - response: { - data: { - errorMessage: 'User exists with same username', - }, - }, - }) - - expect(await service.createUser(registerDto)).toEqual({ - error: 'Request failed with status code 409', - data: { - errorMessage: 'User exists with same username', - }, - }) - expect(createUserSpy).toHaveBeenCalledWith(registerDto) - expect(adminSpy).toHaveBeenCalled() - expect(loggerSpy).toBeCalled() - loggerSpy.mockRestore() - }) - - it('should subscribe email to marketing list if consent is given', async () => { - const keycloakId = 'u123' - const registerDto = plainToClass(RegisterDto, { - email, - password, - firstName, - lastName, - // Add to marketing list - newsletter: true, - }) - const person: Person = { - id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', - firstName, - lastName, - companyId: null, - keycloakId, - email, - emailConfirmed: false, - phone: null, - picture: null, - createdAt: new Date('2021-10-07T13:38:11.097Z'), - updatedAt: new Date('2021-10-07T13:38:11.097Z'), - newsletter: true, - address: null, - birthday: null, - personalNumber: null, - stripeCustomerId: null, - profileEnabled: true, - } - jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) - jest.spyOn(admin.users, 'create').mockResolvedValue({id: keycloakId}) - const marketingSpy = jest - .spyOn(marketing, 'addContactsToList') - .mockImplementation(async () => true) - - await service.createUser(registerDto) - - // Check was added to list - expect(marketingSpy).toHaveBeenCalledWith({ - contacts: [ - { - email, - first_name: firstName, - last_name: lastName, - }, - ], - list_ids: ['list-id'], - }) - }) - - it('should NOT subscribe email to marketing list if NO consent is given', async () => { - const keycloakId = 'u123' - const registerDto = plainToClass(RegisterDto, { - email, - password, - firstName, - lastName, - // Don't subscribe to marketing list - newsletter: false, - }) - const person: Person = { - id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', - firstName, - lastName, - companyId: null, - keycloakId, - email, - emailConfirmed: false, - phone: null, - picture: null, - createdAt: new Date('2021-10-07T13:38:11.097Z'), - updatedAt: new Date('2021-10-07T13:38:11.097Z'), - newsletter: false, - address: null, - birthday: null, - personalNumber: null, - stripeCustomerId: null, - profileEnabled: true, - } - jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) - jest.spyOn(admin.users, 'create').mockResolvedValue({id: keycloakId}) - const marketingSpy = jest - .spyOn(marketing, 'addContactsToList') - .mockImplementation(async () => true) - - await service.createUser(registerDto) - - // Check was not added to list - expect(marketingSpy).not.toHaveBeenCalled() - }) - }) + it('should throw when corporate user is organizer & has beneficiaries', async () => { + corporatePerson.organizer = [{ id: '123' } as Organizer] + corporatePerson.beneficiaries = [{ id: '123' } as Beneficiary] + const personSpy = jest + .spyOn(personService, 'findOneByKeycloakId') + .mockResolvedValue(corporatePerson) - describe('permanentDeleteUser', () => { - const corporatePerson: any = { - id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', - firstName: 'Admin', - lastName: 'Dev', - companyId: null, - keycloakId: '123', - email: 'test@podkrepi.bg', - emailConfirmed: false, - phone: null, - picture: null, - createdAt: new Date('2021-10-07T13:38:11.097Z'), - updatedAt: new Date('2021-10-07T13:38:11.097Z'), - newsletter: false, - address: null, - birthday: null, - personalNumber: null, - stripeCustomerId: null, - profileEnabled: false, - beneficiaries: [], - organizer: null, - } - - it('should delete user successfully', async () => { - const keycloakId = '123'; - const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); - const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); - const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce(); - const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockResolvedValueOnce(person); - const loggerLogSpy = jest.spyOn(Logger, 'log'); - - await expect(service.deleteUser(keycloakId)).resolves.not.toThrow(); - - expect(personSpy).toHaveBeenCalledOnce(); - expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); - expect(adminDeleteSpy).toHaveBeenCalledWith({id: keycloakId}); - expect(prismaDeleteSpy).toHaveBeenCalledWith({where: {keycloakId}}); - expect(loggerLogSpy).toHaveBeenCalledWith(`User with keycloak id ${keycloakId} was successfully deleted!`); - }); - - it('should handle admin client rejection', async () => { - const keycloakId = '123'; - const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); - const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); - const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockRejectedValueOnce(new Error('Admin Client Rejection!')); - const loggerLogSpy = jest.spyOn(Logger, 'error'); - - await expect(service.deleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); - - expect(personSpy).toHaveBeenCalledOnce(); - expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); - expect(adminDeleteSpy).toHaveBeenCalledWith({id: keycloakId}); - expect(loggerLogSpy).toHaveBeenCalledWith(`Deleting user fails with reason: Admin Client Rejection!`); - }); - - it('should handle Prisma rejection', async () => { - const keycloakId = '123'; - const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); - const authenticateAdminSpy = jest.spyOn(service as any, 'authenticateAdmin').mockResolvedValueOnce(""); - const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce(); - const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockRejectedValueOnce(new Error('Prisma Rejection!')); - const loggerLogSpy = jest.spyOn(Logger, 'error'); - - await expect(service.deleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException); - - expect(personSpy).toHaveBeenCalledOnce(); - expect(authenticateAdminSpy).toHaveBeenCalledTimes(1); - expect(adminDeleteSpy).toHaveBeenCalledWith({id: keycloakId}); - expect(prismaDeleteSpy).toHaveBeenCalledWith({where: {keycloakId}}); - expect(loggerLogSpy).toHaveBeenCalledWith(`Deleting user fails with reason: Prisma Rejection!`); - }); - - it('should throw when corporate user has beneficiaries', async () => { - corporatePerson.beneficiaries = [{id: '123'} as Beneficiary]; - const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); - - await expect(service.deleteUser('123')).rejects.toThrow(InternalServerErrorException); - expect(personSpy).toHaveBeenCalledOnce(); - }); - - it('should throw when corporate user is organizer', async () => { - corporatePerson.organizer = [{id: '123'} as Organizer]; - const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); - - await expect(service.deleteUser('123')).rejects.toThrow(InternalServerErrorException); - expect(personSpy).toHaveBeenCalledOnce(); - }); - - it('should throw when corporate user is organizer & has beneficiaries', async () => { - corporatePerson.organizer = [{id: '123'} as Organizer]; - corporatePerson.beneficiaries = [{id: '123'} as Beneficiary]; - - const personSpy = jest.spyOn(personService, 'findOneByKeycloakId').mockResolvedValue(corporatePerson); - - await expect(service.deleteUser('123')).rejects.toThrow(InternalServerErrorException); - expect(personSpy).toHaveBeenCalledOnce(); - }); - }); -}); + await expect(service.deleteUser('123')).rejects.toThrow(InternalServerErrorException) + expect(personSpy).toHaveBeenCalledOnce() + }) + }) +}) diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index 19ba3a0c8..1b57dffa9 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -8,31 +8,31 @@ import { NotFoundException, UnauthorizedException, } from '@nestjs/common' -import {HttpService} from '@nestjs/axios' -import {catchError, firstValueFrom, map, Observable} from 'rxjs' +import { HttpService } from '@nestjs/axios' +import { catchError, firstValueFrom, map, Observable } from 'rxjs' import KeycloakConnect from 'keycloak-connect' -import {ConfigService} from '@nestjs/config' -import {KEYCLOAK_INSTANCE} from 'nest-keycloak-connect' +import { ConfigService } from '@nestjs/config' +import { KEYCLOAK_INSTANCE } from 'nest-keycloak-connect' import KeycloakAdminClient from '@keycloak/keycloak-admin-client' -import {RequiredActionAlias} from '@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation' -import {AxiosResponse} from '@nestjs/terminus/dist/health-indicator/http/axios.interfaces' -import {TokenResponseRaw} from '@keycloak/keycloak-admin-client/lib/utils/auth' - -import {Company, Person} from '@prisma/client' -import {PrismaService} from '../prisma/prisma.service' -import {LoginDto} from './dto/login.dto' -import {ProfileType, RegisterDto} from './dto/register.dto' -import {RefreshDto} from './dto/refresh.dto' -import {KeycloakTokenParsed} from './keycloak' -import {ProviderDto} from './dto/provider.dto' -import {UpdatePersonDto} from '../person/dto/update-person.dto' -import {ForgottenPasswordEmailDto} from './dto/forgot-password.dto' -import {JwtService} from '@nestjs/jwt' -import {EmailService} from '../email/email.service' -import {ForgottenPasswordMailDto} from '../email/template.interface' -import {NewPasswordDto} from './dto/recovery-password.dto' -import {MarketingNotificationsService} from '../notifications/notifications.service' -import {PersonService} from "../person/person.service"; +import { RequiredActionAlias } from '@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation' +import { AxiosResponse } from '@nestjs/terminus/dist/health-indicator/http/axios.interfaces' +import { TokenResponseRaw } from '@keycloak/keycloak-admin-client/lib/utils/auth' + +import { Company, Person } from '@prisma/client' +import { PrismaService } from '../prisma/prisma.service' +import { LoginDto } from './dto/login.dto' +import { ProfileType, RegisterDto } from './dto/register.dto' +import { RefreshDto } from './dto/refresh.dto' +import { KeycloakTokenParsed } from './keycloak' +import { ProviderDto } from './dto/provider.dto' +import { UpdatePersonDto } from '../person/dto/update-person.dto' +import { ForgottenPasswordEmailDto } from './dto/forgot-password.dto' +import { JwtService } from '@nestjs/jwt' +import { EmailService } from '../email/email.service' +import { ForgottenPasswordMailDto } from '../email/template.interface' +import { NewPasswordDto } from './dto/recovery-password.dto' +import { MarketingNotificationsService } from '../notifications/notifications.service' +import { PersonService } from '../person/person.service' type ErrorResponse = { error: string; data: unknown } type KeycloakErrorResponse = { error: string; error_description: string } @@ -64,9 +64,8 @@ export class AuthService { private sendEmail: EmailService, @Inject(KEYCLOAK_INSTANCE) private keycloak: KeycloakConnect.Keycloak, private readonly marketingNotificationsService: MarketingNotificationsService, - private readonly personService: PersonService - ) { - } + private readonly personService: PersonService, + ) {} async issueGrant(email: string, password: string): Promise { return this.keycloak.grantManager.obtainDirectly(email, password) @@ -87,7 +86,7 @@ export class AuthService { accessToken: res.data.access_token, expires: res.data.expires_in, })), - catchError(({response}: { response: AxiosResponse }) => { + catchError(({ response }: { response: AxiosResponse }) => { const error = response.data Logger.error("Couldn't get authentication from keycloak. Error: " + JSON.stringify(error)) @@ -124,8 +123,8 @@ export class AuthService { keycloakId: userInfo.sub, }, // Store keycloakId to the person with same email - update: {keycloakId: userInfo.sub}, - where: {email: userInfo.email}, + update: { keycloakId: userInfo.sub }, + where: { email: userInfo.email }, }) return tokenObs$ } @@ -154,11 +153,11 @@ export class AuthService { const user = await this.keycloak.grantManager.userInfo( grant.access_token.token as string, ) - const person = await this.prismaService.person.findUnique({where: {email: user.email}}) + const person = await this.prismaService.person.findUnique({ where: { email: user.email } }) if (!person || person.keycloakId !== user.sub) { Logger.warn('No person found for the current keycloak user. Creating new one...') await this.authenticateAdmin() - const userData = await this.admin.users.findOne({id: user.sub}) + const userData = await this.admin.users.findOne({ id: user.sub }) const registerDto: RegisterDto = { type: ProfileType.INDIVIDUAL, email: userData?.email ?? '', @@ -253,7 +252,7 @@ export class AuthService { emailVerified: true, groups: [], requiredActions: verifyEmail ? [RequiredActionAlias.VERIFY_EMAIL] : [], - attributes: {selfReg: true}, + attributes: { selfReg: true }, credentials: [ { type: 'password', @@ -296,8 +295,8 @@ export class AuthService { profileEnabled: companyId ? false : true, }, // Store keycloakId to the person with same email - update: {keycloakId}, - where: {email: registerDto.email}, + update: { keycloakId }, + where: { email: registerDto.email }, }) } @@ -319,7 +318,7 @@ export class AuthService { async updateUser(keycloakId: string, updateDto: UpdatePersonDto) { await this.authenticateAdmin() await this.admin.users.update( - {id: keycloakId}, + { id: keycloakId }, { username: updateDto.email, email: updateDto.email, @@ -331,7 +330,7 @@ export class AuthService { }, ) return await this.prismaService.person.update({ - where: {keycloakId}, + where: { keycloakId }, data: { firstName: updateDto.firstName, lastName: updateDto.lastName, @@ -357,7 +356,7 @@ export class AuthService { async changeEnabledStatus(keycloakId: string, enabled: boolean) { await this.authenticateAdmin() // check if user is admin before attempting to activate/deactivate - const userGroups = await this.admin.users.listRoleMappings({id: keycloakId}) + const userGroups = await this.admin.users.listRoleMappings({ id: keycloakId }) const isAdmin = userGroups.realmMappings?.some( (obj) => obj.name === 'team-support' || @@ -368,28 +367,28 @@ export class AuthService { throw new ForbiddenException("Admin profiles can't be deactivated") } await this.admin.users.update( - {id: keycloakId}, + { id: keycloakId }, { enabled, }, ) return await this.prismaService.person.update({ - where: {keycloakId}, - data: {profileEnabled: enabled}, + where: { keycloakId }, + data: { profileEnabled: enabled }, }) } async sendMailForPasswordChange(forgotPasswordDto: ForgottenPasswordEmailDto) { const stage = this.config.get('APP_ENV') === 'development' ? 'APP_URL_LOCAL' : 'APP_URL' const person = await this.prismaService.person.findFirst({ - where: {email: forgotPasswordDto.email}, + where: { email: forgotPasswordDto.email }, }) if (!person || !person.email) { throw new NotFoundException('Invalid email') } - const payload = {username: person.email, sub: person.keycloakId} + const payload = { username: person.email, sub: person.keycloakId } const jtwSecret = process.env.JWT_SECRET_KEY const access_token = this.jwtService.sign(payload, { secret: jtwSecret, @@ -403,17 +402,17 @@ export class AuthService { lastName: person.lastName, link: link, } - const userEmail = {to: [person.email]} + const userEmail = { to: [person.email] } const mail = new ForgottenPasswordMailDto(profile) await this.sendEmail.sendFromTemplate(mail, userEmail, { //Allow users to receive the mail, regardles of unsubscribes - bypassUnsubscribeManagement: {enable: true}, + bypassUnsubscribeManagement: { enable: true }, }) } async updateForgottenPassword(recoveryPasswordDto: NewPasswordDto) { try { - const {sub: keycloakId} = this.jwtService.verify(recoveryPasswordDto.token, { + const { sub: keycloakId } = this.jwtService.verify(recoveryPasswordDto.token, { secret: process.env.JWT_SECRET_KEY, }) return await this.updateUserPassword(keycloakId, recoveryPasswordDto) @@ -425,34 +424,27 @@ export class AuthService { throw response.data ? new NotFoundException(response.data) : new BadRequestException( - 'The forgotten password link has expired, request a new link and try again!', - ) + 'The forgotten password link has expired, request a new link and try again!', + ) } } async deleteUser(keycloakId: string) { - const user = await this.personService.findOneByKeycloakId(keycloakId); + const user = await this.personService.findOneByKeycloakId(keycloakId) //Check and throw if user is a corporate profile if (user?.beneficiaries?.length || user?.organizer) { - throw new InternalServerErrorException("Cannot delete a corporate profile"); + throw new InternalServerErrorException('Cannot delete a corporate profile') } return this.authenticateAdmin() - .then(() => this.admin.users.del({id: keycloakId})) - .then(() => this.prismaService.person.delete({where: {keycloakId}})) + .then(() => this.admin.users.del({ id: keycloakId })) + .then(() => this.prismaService.person.delete({ where: { keycloakId } })) .then(() => Logger.log(`User with keycloak id ${keycloakId} was successfully deleted!`)) .catch((err) => { - const errorMessage = `Deleting user fails with reason: ${err.message ?? 'server error!'}`; - Logger.error(errorMessage); - throw new InternalServerErrorException(errorMessage); - }); + const errorMessage = `Deleting user fails with reason: ${err.message ?? 'server error!'}` + Logger.error(errorMessage) + throw new InternalServerErrorException(errorMessage) + }) } } - - - - - - - diff --git a/apps/api/src/person/person.service.ts b/apps/api/src/person/person.service.ts index 3649d7a45..f0ac0cb54 100644 --- a/apps/api/src/person/person.service.ts +++ b/apps/api/src/person/person.service.ts @@ -119,11 +119,12 @@ export class PersonService { async findOneByKeycloakId(keycloakId: string) { return await this.prisma.person.findFirst({ - where: {keycloakId}, include: { + where: { keycloakId }, + include: { company: true, - beneficiaries: {select: {id:true}}, - organizer: {select:{id:true}} - } + beneficiaries: { select: { id: true } }, + organizer: { select: { id: true } }, + }, }) } From 150104c590acd2f83d0250f18a363dcc2bce10e8 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 21 Nov 2023 11:15:41 +0200 Subject: [PATCH 11/15] Run yarn format --- .../affiliate/dto/connect-affiliate.dto.ts | 12 +- .../affiliate/dto/create-affiliate.dto.ts | 8 +- .../domain/generated/affiliate/dto/index.ts | 7 +- .../affiliate/dto/update-affiliate.dto.ts | 8 +- .../affiliate/entities/affiliate.entity.ts | 24 ++-- .../generated/affiliate/entities/index.ts | 3 +- .../dto/connect-bankAccount.dto.ts | 8 +- .../bankAccount/dto/create-bankAccount.dto.ts | 22 ++-- .../domain/generated/bankAccount/dto/index.ts | 7 +- .../bankAccount/dto/update-bankAccount.dto.ts | 22 ++-- .../entities/bankAccount.entity.ts | 28 ++-- .../generated/bankAccount/entities/index.ts | 3 +- .../dto/connect-bankTransaction.dto.ts | 8 +- .../dto/create-bankTransaction.dto.ts | 40 +++--- .../generated/bankTransaction/dto/index.ts | 7 +- .../dto/update-bankTransaction.dto.ts | 38 +++--- .../entities/bankTransaction.entity.ts | 36 +++--- .../bankTransaction/entities/index.ts | 3 +- .../dto/connect-bankTransactionsFile.dto.ts | 8 +- .../bankTransactionsFile/dto/index.ts | 7 +- .../entities/bankTransactionsFile.entity.ts | 16 +-- .../bankTransactionsFile/entities/index.ts | 3 +- .../benefactor/dto/connect-benefactor.dto.ts | 10 +- .../benefactor/dto/create-benefactor.dto.ts | 8 +- .../domain/generated/benefactor/dto/index.ts | 7 +- .../benefactor/dto/update-benefactor.dto.ts | 8 +- .../benefactor/entities/benefactor.entity.ts | 16 +-- .../generated/benefactor/entities/index.ts | 3 +- .../dto/connect-beneficiary.dto.ts | 8 +- .../beneficiary/dto/create-beneficiary.dto.ts | 28 ++-- .../domain/generated/beneficiary/dto/index.ts | 7 +- .../beneficiary/dto/update-beneficiary.dto.ts | 28 ++-- .../entities/beneficiary.entity.ts | 58 ++++----- .../generated/beneficiary/entities/index.ts | 3 +- .../campaign/dto/connect-campaign.dto.ts | 12 +- .../campaign/dto/create-campaign.dto.ts | 24 ++-- .../domain/generated/campaign/dto/index.ts | 7 +- .../campaign/dto/update-campaign.dto.ts | 24 ++-- .../campaign/entities/campaign.entity.ts | 108 ++++++++-------- .../generated/campaign/entities/index.ts | 3 +- .../dto/connect-campaignFile.dto.ts | 8 +- .../dto/create-campaignFile.dto.ts | 16 +-- .../generated/campaignFile/dto/index.ts | 7 +- .../dto/update-campaignFile.dto.ts | 16 +-- .../entities/campaignFile.entity.ts | 24 ++-- .../generated/campaignFile/entities/index.ts | 3 +- .../dto/connect-campaignNews.dto.ts | 10 +- .../dto/create-campaignNews.dto.ts | 20 +-- .../generated/campaignNews/dto/index.ts | 7 +- .../dto/update-campaignNews.dto.ts | 20 +-- .../entities/campaignNews.entity.ts | 40 +++--- .../generated/campaignNews/entities/index.ts | 3 +- .../dto/connect-campaignNewsFile.dto.ts | 8 +- .../dto/create-campaignNewsFile.dto.ts | 16 +-- .../generated/campaignNewsFile/dto/index.ts | 7 +- .../dto/update-campaignNewsFile.dto.ts | 16 +-- .../entities/campaignNewsFile.entity.ts | 24 ++-- .../campaignNewsFile/entities/index.ts | 3 +- .../dto/connect-campaignType.dto.ts | 10 +- .../dto/create-campaignType.dto.ts | 12 +- .../generated/campaignType/dto/index.ts | 7 +- .../dto/update-campaignType.dto.ts | 12 +- .../entities/campaignType.entity.ts | 24 ++-- .../generated/campaignType/entities/index.ts | 3 +- .../generated/city/dto/connect-city.dto.ts | 10 +- .../generated/city/dto/create-city.dto.ts | 10 +- .../src/domain/generated/city/dto/index.ts | 7 +- .../generated/city/dto/update-city.dto.ts | 10 +- .../generated/city/entities/city.entity.ts | 18 ++- .../domain/generated/city/entities/index.ts | 3 +- .../company/dto/connect-company.dto.ts | 12 +- .../company/dto/create-company.dto.ts | 18 +-- .../src/domain/generated/company/dto/index.ts | 7 +- .../company/dto/update-company.dto.ts | 18 +-- .../company/entities/company.entity.ts | 36 +++--- .../generated/company/entities/index.ts | 3 +- .../dto/connect-coordinator.dto.ts | 10 +- .../coordinator/dto/create-coordinator.dto.ts | 10 +- .../domain/generated/coordinator/dto/index.ts | 7 +- .../coordinator/dto/update-coordinator.dto.ts | 10 +- .../entities/coordinator.entity.ts | 22 ++-- .../generated/coordinator/entities/index.ts | 3 +- .../country/dto/connect-country.dto.ts | 10 +- .../country/dto/create-country.dto.ts | 10 +- .../src/domain/generated/country/dto/index.ts | 7 +- .../country/dto/update-country.dto.ts | 10 +- .../country/entities/country.entity.ts | 12 +- .../generated/country/entities/index.ts | 3 +- .../document/dto/connect-document.dto.ts | 8 +- .../document/dto/create-document.dto.ts | 22 ++-- .../domain/generated/document/dto/index.ts | 7 +- .../document/dto/update-document.dto.ts | 22 ++-- .../document/entities/document.entity.ts | 28 ++-- .../generated/document/entities/index.ts | 3 +- .../donation/dto/connect-donation.dto.ts | 10 +- .../donation/dto/create-donation.dto.ts | 22 ++-- .../domain/generated/donation/dto/index.ts | 7 +- .../donation/dto/update-donation.dto.ts | 22 ++-- .../donation/entities/donation.entity.ts | 58 ++++----- .../generated/donation/entities/index.ts | 3 +- .../dto/connect-donationMetadata.dto.ts | 8 +- .../dto/create-donationMetadata.dto.ts | 10 +- .../generated/donationMetadata/dto/index.ts | 7 +- .../dto/update-donationMetadata.dto.ts | 10 +- .../entities/donationMetadata.entity.ts | 16 +-- .../donationMetadata/entities/index.ts | 3 +- .../dto/connect-donationWish.dto.ts | 10 +- .../dto/create-donationWish.dto.ts | 8 +- .../generated/donationWish/dto/index.ts | 7 +- .../dto/update-donationWish.dto.ts | 8 +- .../entities/donationWish.entity.ts | 28 ++-- .../generated/donationWish/entities/index.ts | 3 +- .../dto/connect-emailSentRegistry.dto.ts | 8 +- .../dto/create-emailSentRegistry.dto.ts | 18 +-- .../generated/emailSentRegistry/dto/index.ts | 7 +- .../dto/update-emailSentRegistry.dto.ts | 18 +-- .../entities/emailSentRegistry.entity.ts | 14 +- .../emailSentRegistry/entities/index.ts | 3 +- .../expense/dto/connect-expense.dto.ts | 8 +- .../expense/dto/create-expense.dto.ts | 18 +-- .../src/domain/generated/expense/dto/index.ts | 7 +- .../expense/dto/update-expense.dto.ts | 18 +-- .../expense/entities/expense.entity.ts | 42 +++--- .../generated/expense/entities/index.ts | 3 +- .../dto/connect-expenseFile.dto.ts | 8 +- .../expenseFile/dto/create-expenseFile.dto.ts | 10 +- .../domain/generated/expenseFile/dto/index.ts | 7 +- .../expenseFile/dto/update-expenseFile.dto.ts | 10 +- .../entities/expenseFile.entity.ts | 20 ++- .../generated/expenseFile/entities/index.ts | 3 +- .../dto/connect-infoRequest.dto.ts | 8 +- .../infoRequest/dto/create-infoRequest.dto.ts | 10 +- .../domain/generated/infoRequest/dto/index.ts | 7 +- .../infoRequest/dto/update-infoRequest.dto.ts | 10 +- .../generated/infoRequest/entities/index.ts | 3 +- .../entities/infoRequest.entity.ts | 18 ++- .../dto/connect-irregularity.dto.ts | 8 +- .../dto/create-irregularity.dto.ts | 8 +- .../generated/irregularity/dto/index.ts | 7 +- .../dto/update-irregularity.dto.ts | 8 +- .../generated/irregularity/entities/index.ts | 3 +- .../entities/irregularity.entity.ts | 34 +++-- .../dto/connect-irregularityFile.dto.ts | 8 +- .../dto/create-irregularityFile.dto.ts | 10 +- .../generated/irregularityFile/dto/index.ts | 7 +- .../dto/update-irregularityFile.dto.ts | 10 +- .../irregularityFile/entities/index.ts | 3 +- .../entities/irregularityFile.entity.ts | 20 ++- .../dto/connect-marketingTemplates.dto.ts | 8 +- .../dto/create-marketingTemplates.dto.ts | 8 +- .../generated/marketingTemplates/dto/index.ts | 7 +- .../dto/update-marketingTemplates.dto.ts | 8 +- .../marketingTemplates/entities/index.ts | 3 +- .../entities/marketingTemplates.entity.ts | 8 +- .../dto/connect-notificationList.dto.ts | 8 +- .../dto/create-notificationList.dto.ts | 8 +- .../generated/notificationList/dto/index.ts | 7 +- .../dto/update-notificationList.dto.ts | 8 +- .../notificationList/entities/index.ts | 3 +- .../entities/notificationList.entity.ts | 12 +- .../organizer/dto/connect-organizer.dto.ts | 10 +- .../organizer/dto/create-organizer.dto.ts | 10 +- .../domain/generated/organizer/dto/index.ts | 7 +- .../organizer/dto/update-organizer.dto.ts | 10 +- .../generated/organizer/entities/index.ts | 3 +- .../organizer/entities/organizer.entity.ts | 22 ++-- .../person/dto/connect-person.dto.ts | 18 ++- .../generated/person/dto/create-person.dto.ts | 30 ++--- .../src/domain/generated/person/dto/index.ts | 7 +- .../generated/person/dto/update-person.dto.ts | 30 ++--- .../domain/generated/person/entities/index.ts | 3 +- .../person/entities/person.entity.ts | 120 +++++++++--------- .../dto/connect-recurringDonation.dto.ts | 8 +- .../dto/create-recurringDonation.dto.ts | 16 +-- .../generated/recurringDonation/dto/index.ts | 7 +- .../dto/update-recurringDonation.dto.ts | 16 +-- .../recurringDonation/entities/index.ts | 3 +- .../entities/recurringDonation.entity.ts | 32 +++-- .../supporter/dto/connect-supporter.dto.ts | 8 +- .../supporter/dto/create-supporter.dto.ts | 14 +- .../domain/generated/supporter/dto/index.ts | 7 +- .../supporter/dto/update-supporter.dto.ts | 14 +- .../generated/supporter/entities/index.ts | 3 +- .../supporter/entities/supporter.entity.ts | 66 +++++----- .../transfer/dto/connect-transfer.dto.ts | 8 +- .../transfer/dto/create-transfer.dto.ts | 18 +-- .../domain/generated/transfer/dto/index.ts | 7 +- .../transfer/dto/update-transfer.dto.ts | 18 +-- .../generated/transfer/entities/index.ts | 3 +- .../transfer/entities/transfer.entity.ts | 48 ++++--- ...ect-unregisteredNotificationConsent.dto.ts | 10 +- ...ate-unregisteredNotificationConsent.dto.ts | 8 +- .../dto/index.ts | 7 +- ...ate-unregisteredNotificationConsent.dto.ts | 8 +- .../entities/index.ts | 3 +- .../unregisteredNotificationConsent.entity.ts | 10 +- .../generated/vault/dto/connect-vault.dto.ts | 8 +- .../generated/vault/dto/create-vault.dto.ts | 10 +- .../src/domain/generated/vault/dto/index.ts | 7 +- .../generated/vault/dto/update-vault.dto.ts | 10 +- .../domain/generated/vault/entities/index.ts | 3 +- .../generated/vault/entities/vault.entity.ts | 46 ++++--- .../withdrawal/dto/connect-withdrawal.dto.ts | 8 +- .../withdrawal/dto/create-withdrawal.dto.ts | 18 +-- .../domain/generated/withdrawal/dto/index.ts | 7 +- .../withdrawal/dto/update-withdrawal.dto.ts | 18 +-- .../generated/withdrawal/entities/index.ts | 3 +- .../withdrawal/entities/withdrawal.entity.ts | 46 ++++--- 208 files changed, 1149 insertions(+), 1731 deletions(-) diff --git a/apps/api/src/domain/generated/affiliate/dto/connect-affiliate.dto.ts b/apps/api/src/domain/generated/affiliate/dto/connect-affiliate.dto.ts index b69cf7398..aca06cc2c 100644 --- a/apps/api/src/domain/generated/affiliate/dto/connect-affiliate.dto.ts +++ b/apps/api/src/domain/generated/affiliate/dto/connect-affiliate.dto.ts @@ -1,7 +1,5 @@ - - export class ConnectAffiliateDto { - id?: string; -affiliateCode?: string; -companyId?: string; - } - \ No newline at end of file +export class ConnectAffiliateDto { + id?: string + affiliateCode?: string + companyId?: string +} diff --git a/apps/api/src/domain/generated/affiliate/dto/create-affiliate.dto.ts b/apps/api/src/domain/generated/affiliate/dto/create-affiliate.dto.ts index 066932149..d76e0c938 100644 --- a/apps/api/src/domain/generated/affiliate/dto/create-affiliate.dto.ts +++ b/apps/api/src/domain/generated/affiliate/dto/create-affiliate.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class CreateAffiliateDto { - affiliateCode?: string; + affiliateCode?: string } diff --git a/apps/api/src/domain/generated/affiliate/dto/index.ts b/apps/api/src/domain/generated/affiliate/dto/index.ts index eecad5a60..d3aea23c7 100644 --- a/apps/api/src/domain/generated/affiliate/dto/index.ts +++ b/apps/api/src/domain/generated/affiliate/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-affiliate.dto'; -export * from './create-affiliate.dto'; -export * from './update-affiliate.dto'; \ No newline at end of file +export * from './connect-affiliate.dto' +export * from './create-affiliate.dto' +export * from './update-affiliate.dto' diff --git a/apps/api/src/domain/generated/affiliate/dto/update-affiliate.dto.ts b/apps/api/src/domain/generated/affiliate/dto/update-affiliate.dto.ts index 249e8598a..51767a785 100644 --- a/apps/api/src/domain/generated/affiliate/dto/update-affiliate.dto.ts +++ b/apps/api/src/domain/generated/affiliate/dto/update-affiliate.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class UpdateAffiliateDto { - affiliateCode?: string; + affiliateCode?: string } diff --git a/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts b/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts index 6f2930a9f..3672e5d40 100644 --- a/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts +++ b/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts @@ -1,16 +1,14 @@ - -import {AffiliateStatus} from '@prisma/client' -import {Company} from '../../company/entities/company.entity' -import {Donation} from '../../donation/entities/donation.entity' - +import { AffiliateStatus } from '@prisma/client' +import { Company } from '../../company/entities/company.entity' +import { Donation } from '../../donation/entities/donation.entity' export class Affiliate { - id: string ; -status: AffiliateStatus ; -affiliateCode: string | null; -companyId: string ; -createdAt: Date ; -updatedAt: Date | null; -company?: Company ; -donations?: Donation[] ; + id: string + status: AffiliateStatus + affiliateCode: string | null + companyId: string + createdAt: Date + updatedAt: Date | null + company?: Company + donations?: Donation[] } diff --git a/apps/api/src/domain/generated/affiliate/entities/index.ts b/apps/api/src/domain/generated/affiliate/entities/index.ts index 159cc623d..e07a7eb43 100644 --- a/apps/api/src/domain/generated/affiliate/entities/index.ts +++ b/apps/api/src/domain/generated/affiliate/entities/index.ts @@ -1,2 +1 @@ - -export * from './affiliate.entity'; \ No newline at end of file +export * from './affiliate.entity' diff --git a/apps/api/src/domain/generated/bankAccount/dto/connect-bankAccount.dto.ts b/apps/api/src/domain/generated/bankAccount/dto/connect-bankAccount.dto.ts index 0b746491b..3fd44a13f 100644 --- a/apps/api/src/domain/generated/bankAccount/dto/connect-bankAccount.dto.ts +++ b/apps/api/src/domain/generated/bankAccount/dto/connect-bankAccount.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectBankAccountDto { - id: string; - } - \ No newline at end of file +export class ConnectBankAccountDto { + id: string +} diff --git a/apps/api/src/domain/generated/bankAccount/dto/create-bankAccount.dto.ts b/apps/api/src/domain/generated/bankAccount/dto/create-bankAccount.dto.ts index b81ea593f..47be199e5 100644 --- a/apps/api/src/domain/generated/bankAccount/dto/create-bankAccount.dto.ts +++ b/apps/api/src/domain/generated/bankAccount/dto/create-bankAccount.dto.ts @@ -1,16 +1,12 @@ - -import {AccountHolderType} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { AccountHolderType } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateBankAccountDto { - ibanNumber: string; -accountHolderName: string; -@ApiProperty({ enum: AccountHolderType}) -accountHolderType: AccountHolderType; -bankName?: string; -bankIdCode?: string; -fingerprint?: string; + ibanNumber: string + accountHolderName: string + @ApiProperty({ enum: AccountHolderType }) + accountHolderType: AccountHolderType + bankName?: string + bankIdCode?: string + fingerprint?: string } diff --git a/apps/api/src/domain/generated/bankAccount/dto/index.ts b/apps/api/src/domain/generated/bankAccount/dto/index.ts index 0e27b08bb..7d1b2b955 100644 --- a/apps/api/src/domain/generated/bankAccount/dto/index.ts +++ b/apps/api/src/domain/generated/bankAccount/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-bankAccount.dto'; -export * from './create-bankAccount.dto'; -export * from './update-bankAccount.dto'; \ No newline at end of file +export * from './connect-bankAccount.dto' +export * from './create-bankAccount.dto' +export * from './update-bankAccount.dto' diff --git a/apps/api/src/domain/generated/bankAccount/dto/update-bankAccount.dto.ts b/apps/api/src/domain/generated/bankAccount/dto/update-bankAccount.dto.ts index fef749490..96cf9bdb8 100644 --- a/apps/api/src/domain/generated/bankAccount/dto/update-bankAccount.dto.ts +++ b/apps/api/src/domain/generated/bankAccount/dto/update-bankAccount.dto.ts @@ -1,16 +1,12 @@ - -import {AccountHolderType} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { AccountHolderType } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateBankAccountDto { - ibanNumber?: string; -accountHolderName?: string; -@ApiProperty({ enum: AccountHolderType}) -accountHolderType?: AccountHolderType; -bankName?: string; -bankIdCode?: string; -fingerprint?: string; + ibanNumber?: string + accountHolderName?: string + @ApiProperty({ enum: AccountHolderType }) + accountHolderType?: AccountHolderType + bankName?: string + bankIdCode?: string + fingerprint?: string } diff --git a/apps/api/src/domain/generated/bankAccount/entities/bankAccount.entity.ts b/apps/api/src/domain/generated/bankAccount/entities/bankAccount.entity.ts index a65172090..59208cda9 100644 --- a/apps/api/src/domain/generated/bankAccount/entities/bankAccount.entity.ts +++ b/apps/api/src/domain/generated/bankAccount/entities/bankAccount.entity.ts @@ -1,18 +1,16 @@ - -import {BankAccountStatus,AccountHolderType} from '@prisma/client' -import {Withdrawal} from '../../withdrawal/entities/withdrawal.entity' - +import { BankAccountStatus, AccountHolderType } from '@prisma/client' +import { Withdrawal } from '../../withdrawal/entities/withdrawal.entity' export class BankAccount { - id: string ; -status: BankAccountStatus ; -ibanNumber: string ; -accountHolderName: string ; -accountHolderType: AccountHolderType ; -bankName: string | null; -bankIdCode: string | null; -fingerprint: string | null; -createdAt: Date ; -updatedAt: Date | null; -withdraws?: Withdrawal[] ; + id: string + status: BankAccountStatus + ibanNumber: string + accountHolderName: string + accountHolderType: AccountHolderType + bankName: string | null + bankIdCode: string | null + fingerprint: string | null + createdAt: Date + updatedAt: Date | null + withdraws?: Withdrawal[] } diff --git a/apps/api/src/domain/generated/bankAccount/entities/index.ts b/apps/api/src/domain/generated/bankAccount/entities/index.ts index e5c0a3d53..f1ae59edc 100644 --- a/apps/api/src/domain/generated/bankAccount/entities/index.ts +++ b/apps/api/src/domain/generated/bankAccount/entities/index.ts @@ -1,2 +1 @@ - -export * from './bankAccount.entity'; \ No newline at end of file +export * from './bankAccount.entity' diff --git a/apps/api/src/domain/generated/bankTransaction/dto/connect-bankTransaction.dto.ts b/apps/api/src/domain/generated/bankTransaction/dto/connect-bankTransaction.dto.ts index 9ed16b3d9..117f42bb9 100644 --- a/apps/api/src/domain/generated/bankTransaction/dto/connect-bankTransaction.dto.ts +++ b/apps/api/src/domain/generated/bankTransaction/dto/connect-bankTransaction.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectBankTransactionDto { - id: string; - } - \ No newline at end of file +export class ConnectBankTransactionDto { + id: string +} diff --git a/apps/api/src/domain/generated/bankTransaction/dto/create-bankTransaction.dto.ts b/apps/api/src/domain/generated/bankTransaction/dto/create-bankTransaction.dto.ts index 6f33920ae..05096c122 100644 --- a/apps/api/src/domain/generated/bankTransaction/dto/create-bankTransaction.dto.ts +++ b/apps/api/src/domain/generated/bankTransaction/dto/create-bankTransaction.dto.ts @@ -1,25 +1,21 @@ - -import {BankTransactionType,BankDonationStatus} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { BankTransactionType, BankDonationStatus } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateBankTransactionDto { - id: string; -ibanNumber: string; -bankName: string; -bankIdCode: string; -transactionDate: Date; -senderName?: string; -recipientName?: string; -senderIban?: string; -recipientIban?: string; -description: string; -matchedRef?: string; -@ApiProperty({ enum: BankTransactionType}) -type: BankTransactionType; -@ApiProperty({ enum: BankDonationStatus}) -bankDonationStatus?: BankDonationStatus; -notified?: boolean; + id: string + ibanNumber: string + bankName: string + bankIdCode: string + transactionDate: Date + senderName?: string + recipientName?: string + senderIban?: string + recipientIban?: string + description: string + matchedRef?: string + @ApiProperty({ enum: BankTransactionType }) + type: BankTransactionType + @ApiProperty({ enum: BankDonationStatus }) + bankDonationStatus?: BankDonationStatus + notified?: boolean } diff --git a/apps/api/src/domain/generated/bankTransaction/dto/index.ts b/apps/api/src/domain/generated/bankTransaction/dto/index.ts index 785b5362d..33978daf6 100644 --- a/apps/api/src/domain/generated/bankTransaction/dto/index.ts +++ b/apps/api/src/domain/generated/bankTransaction/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-bankTransaction.dto'; -export * from './create-bankTransaction.dto'; -export * from './update-bankTransaction.dto'; \ No newline at end of file +export * from './connect-bankTransaction.dto' +export * from './create-bankTransaction.dto' +export * from './update-bankTransaction.dto' diff --git a/apps/api/src/domain/generated/bankTransaction/dto/update-bankTransaction.dto.ts b/apps/api/src/domain/generated/bankTransaction/dto/update-bankTransaction.dto.ts index 467f65705..c01df91e4 100644 --- a/apps/api/src/domain/generated/bankTransaction/dto/update-bankTransaction.dto.ts +++ b/apps/api/src/domain/generated/bankTransaction/dto/update-bankTransaction.dto.ts @@ -1,24 +1,20 @@ - -import {BankTransactionType,BankDonationStatus} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { BankTransactionType, BankDonationStatus } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateBankTransactionDto { - ibanNumber?: string; -bankName?: string; -bankIdCode?: string; -transactionDate?: Date; -senderName?: string; -recipientName?: string; -senderIban?: string; -recipientIban?: string; -description?: string; -matchedRef?: string; -@ApiProperty({ enum: BankTransactionType}) -type?: BankTransactionType; -@ApiProperty({ enum: BankDonationStatus}) -bankDonationStatus?: BankDonationStatus; -notified?: boolean; + ibanNumber?: string + bankName?: string + bankIdCode?: string + transactionDate?: Date + senderName?: string + recipientName?: string + senderIban?: string + recipientIban?: string + description?: string + matchedRef?: string + @ApiProperty({ enum: BankTransactionType }) + type?: BankTransactionType + @ApiProperty({ enum: BankDonationStatus }) + bankDonationStatus?: BankDonationStatus + notified?: boolean } diff --git a/apps/api/src/domain/generated/bankTransaction/entities/bankTransaction.entity.ts b/apps/api/src/domain/generated/bankTransaction/entities/bankTransaction.entity.ts index 4dfdfadf0..1aeb5e393 100644 --- a/apps/api/src/domain/generated/bankTransaction/entities/bankTransaction.entity.ts +++ b/apps/api/src/domain/generated/bankTransaction/entities/bankTransaction.entity.ts @@ -1,22 +1,20 @@ - -import {Currency,BankTransactionType,BankDonationStatus} from '@prisma/client' - +import { Currency, BankTransactionType, BankDonationStatus } from '@prisma/client' export class BankTransaction { - id: string ; -ibanNumber: string ; -bankName: string ; -bankIdCode: string ; -transactionDate: Date ; -senderName: string | null; -recipientName: string | null; -senderIban: string | null; -recipientIban: string | null; -amount: number ; -currency: Currency ; -description: string ; -matchedRef: string | null; -type: BankTransactionType ; -bankDonationStatus: BankDonationStatus | null; -notified: boolean | null; + id: string + ibanNumber: string + bankName: string + bankIdCode: string + transactionDate: Date + senderName: string | null + recipientName: string | null + senderIban: string | null + recipientIban: string | null + amount: number + currency: Currency + description: string + matchedRef: string | null + type: BankTransactionType + bankDonationStatus: BankDonationStatus | null + notified: boolean | null } diff --git a/apps/api/src/domain/generated/bankTransaction/entities/index.ts b/apps/api/src/domain/generated/bankTransaction/entities/index.ts index 573d9ea09..e8b88ec1c 100644 --- a/apps/api/src/domain/generated/bankTransaction/entities/index.ts +++ b/apps/api/src/domain/generated/bankTransaction/entities/index.ts @@ -1,2 +1 @@ - -export * from './bankTransaction.entity'; \ No newline at end of file +export * from './bankTransaction.entity' diff --git a/apps/api/src/domain/generated/bankTransactionsFile/dto/connect-bankTransactionsFile.dto.ts b/apps/api/src/domain/generated/bankTransactionsFile/dto/connect-bankTransactionsFile.dto.ts index c383807cf..6cdf90627 100644 --- a/apps/api/src/domain/generated/bankTransactionsFile/dto/connect-bankTransactionsFile.dto.ts +++ b/apps/api/src/domain/generated/bankTransactionsFile/dto/connect-bankTransactionsFile.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectBankTransactionsFileDto { - id: string; - } - \ No newline at end of file +export class ConnectBankTransactionsFileDto { + id: string +} diff --git a/apps/api/src/domain/generated/bankTransactionsFile/dto/index.ts b/apps/api/src/domain/generated/bankTransactionsFile/dto/index.ts index 5b340a88a..20977448f 100644 --- a/apps/api/src/domain/generated/bankTransactionsFile/dto/index.ts +++ b/apps/api/src/domain/generated/bankTransactionsFile/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-bankTransactionsFile.dto'; -export * from './create-bankTransactionsFile.dto'; -export * from './update-bankTransactionsFile.dto'; \ No newline at end of file +export * from './connect-bankTransactionsFile.dto' +export * from './create-bankTransactionsFile.dto' +export * from './update-bankTransactionsFile.dto' diff --git a/apps/api/src/domain/generated/bankTransactionsFile/entities/bankTransactionsFile.entity.ts b/apps/api/src/domain/generated/bankTransactionsFile/entities/bankTransactionsFile.entity.ts index 527fd9fbb..e77fd9cf1 100644 --- a/apps/api/src/domain/generated/bankTransactionsFile/entities/bankTransactionsFile.entity.ts +++ b/apps/api/src/domain/generated/bankTransactionsFile/entities/bankTransactionsFile.entity.ts @@ -1,12 +1,10 @@ - -import {BankTransactionsFileType} from '@prisma/client' - +import { BankTransactionsFileType } from '@prisma/client' export class BankTransactionsFile { - id: string ; -filename: string ; -mimetype: string ; -bankTransactionsFileId: string ; -type: BankTransactionsFileType ; -personId: string ; + id: string + filename: string + mimetype: string + bankTransactionsFileId: string + type: BankTransactionsFileType + personId: string } diff --git a/apps/api/src/domain/generated/bankTransactionsFile/entities/index.ts b/apps/api/src/domain/generated/bankTransactionsFile/entities/index.ts index 6ccda1bc5..f37c6f255 100644 --- a/apps/api/src/domain/generated/bankTransactionsFile/entities/index.ts +++ b/apps/api/src/domain/generated/bankTransactionsFile/entities/index.ts @@ -1,2 +1 @@ - -export * from './bankTransactionsFile.entity'; \ No newline at end of file +export * from './bankTransactionsFile.entity' diff --git a/apps/api/src/domain/generated/benefactor/dto/connect-benefactor.dto.ts b/apps/api/src/domain/generated/benefactor/dto/connect-benefactor.dto.ts index 21f5ab163..4fe025c7e 100644 --- a/apps/api/src/domain/generated/benefactor/dto/connect-benefactor.dto.ts +++ b/apps/api/src/domain/generated/benefactor/dto/connect-benefactor.dto.ts @@ -1,6 +1,4 @@ - - export class ConnectBenefactorDto { - id?: string; -extCustomerId?: string; - } - \ No newline at end of file +export class ConnectBenefactorDto { + id?: string + extCustomerId?: string +} diff --git a/apps/api/src/domain/generated/benefactor/dto/create-benefactor.dto.ts b/apps/api/src/domain/generated/benefactor/dto/create-benefactor.dto.ts index 612398342..832716f11 100644 --- a/apps/api/src/domain/generated/benefactor/dto/create-benefactor.dto.ts +++ b/apps/api/src/domain/generated/benefactor/dto/create-benefactor.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class CreateBenefactorDto { - extCustomerId?: string; + extCustomerId?: string } diff --git a/apps/api/src/domain/generated/benefactor/dto/index.ts b/apps/api/src/domain/generated/benefactor/dto/index.ts index 38c4268e3..7d1ae714d 100644 --- a/apps/api/src/domain/generated/benefactor/dto/index.ts +++ b/apps/api/src/domain/generated/benefactor/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-benefactor.dto'; -export * from './create-benefactor.dto'; -export * from './update-benefactor.dto'; \ No newline at end of file +export * from './connect-benefactor.dto' +export * from './create-benefactor.dto' +export * from './update-benefactor.dto' diff --git a/apps/api/src/domain/generated/benefactor/dto/update-benefactor.dto.ts b/apps/api/src/domain/generated/benefactor/dto/update-benefactor.dto.ts index 516ffc550..310f1f4c7 100644 --- a/apps/api/src/domain/generated/benefactor/dto/update-benefactor.dto.ts +++ b/apps/api/src/domain/generated/benefactor/dto/update-benefactor.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class UpdateBenefactorDto { - extCustomerId?: string; + extCustomerId?: string } diff --git a/apps/api/src/domain/generated/benefactor/entities/benefactor.entity.ts b/apps/api/src/domain/generated/benefactor/entities/benefactor.entity.ts index 1272e85fa..c5de54418 100644 --- a/apps/api/src/domain/generated/benefactor/entities/benefactor.entity.ts +++ b/apps/api/src/domain/generated/benefactor/entities/benefactor.entity.ts @@ -1,12 +1,10 @@ - -import {Person} from '../../person/entities/person.entity' - +import { Person } from '../../person/entities/person.entity' export class Benefactor { - id: string ; -personId: string ; -extCustomerId: string | null; -createdAt: Date ; -updatedAt: Date | null; -person?: Person ; + id: string + personId: string + extCustomerId: string | null + createdAt: Date + updatedAt: Date | null + person?: Person } diff --git a/apps/api/src/domain/generated/benefactor/entities/index.ts b/apps/api/src/domain/generated/benefactor/entities/index.ts index 7eadc8a26..a2fdda115 100644 --- a/apps/api/src/domain/generated/benefactor/entities/index.ts +++ b/apps/api/src/domain/generated/benefactor/entities/index.ts @@ -1,2 +1 @@ - -export * from './benefactor.entity'; \ No newline at end of file +export * from './benefactor.entity' diff --git a/apps/api/src/domain/generated/beneficiary/dto/connect-beneficiary.dto.ts b/apps/api/src/domain/generated/beneficiary/dto/connect-beneficiary.dto.ts index e172843c9..a860abb38 100644 --- a/apps/api/src/domain/generated/beneficiary/dto/connect-beneficiary.dto.ts +++ b/apps/api/src/domain/generated/beneficiary/dto/connect-beneficiary.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectBeneficiaryDto { - id: string; - } - \ No newline at end of file +export class ConnectBeneficiaryDto { + id: string +} diff --git a/apps/api/src/domain/generated/beneficiary/dto/create-beneficiary.dto.ts b/apps/api/src/domain/generated/beneficiary/dto/create-beneficiary.dto.ts index fc915ff5d..6cb1e49be 100644 --- a/apps/api/src/domain/generated/beneficiary/dto/create-beneficiary.dto.ts +++ b/apps/api/src/domain/generated/beneficiary/dto/create-beneficiary.dto.ts @@ -1,19 +1,15 @@ - -import {Prisma,BeneficiaryType,PersonRelation} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { Prisma, BeneficiaryType, PersonRelation } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateBeneficiaryDto { - @ApiProperty({ enum: BeneficiaryType}) -type: BeneficiaryType; -countryCode: string; -@ApiProperty({ enum: PersonRelation}) -coordinatorRelation?: PersonRelation; -description?: string; -privateData?: Prisma.InputJsonValue; -publicData?: Prisma.InputJsonValue; -@ApiProperty({ enum: PersonRelation}) -organizerRelation?: PersonRelation; + @ApiProperty({ enum: BeneficiaryType }) + type: BeneficiaryType + countryCode: string + @ApiProperty({ enum: PersonRelation }) + coordinatorRelation?: PersonRelation + description?: string + privateData?: Prisma.InputJsonValue + publicData?: Prisma.InputJsonValue + @ApiProperty({ enum: PersonRelation }) + organizerRelation?: PersonRelation } diff --git a/apps/api/src/domain/generated/beneficiary/dto/index.ts b/apps/api/src/domain/generated/beneficiary/dto/index.ts index 5e7aa035a..53b54ab2d 100644 --- a/apps/api/src/domain/generated/beneficiary/dto/index.ts +++ b/apps/api/src/domain/generated/beneficiary/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-beneficiary.dto'; -export * from './create-beneficiary.dto'; -export * from './update-beneficiary.dto'; \ No newline at end of file +export * from './connect-beneficiary.dto' +export * from './create-beneficiary.dto' +export * from './update-beneficiary.dto' diff --git a/apps/api/src/domain/generated/beneficiary/dto/update-beneficiary.dto.ts b/apps/api/src/domain/generated/beneficiary/dto/update-beneficiary.dto.ts index 764bc76a6..cb803cb07 100644 --- a/apps/api/src/domain/generated/beneficiary/dto/update-beneficiary.dto.ts +++ b/apps/api/src/domain/generated/beneficiary/dto/update-beneficiary.dto.ts @@ -1,19 +1,15 @@ - -import {Prisma,BeneficiaryType,PersonRelation} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { Prisma, BeneficiaryType, PersonRelation } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateBeneficiaryDto { - @ApiProperty({ enum: BeneficiaryType}) -type?: BeneficiaryType; -countryCode?: string; -@ApiProperty({ enum: PersonRelation}) -coordinatorRelation?: PersonRelation; -description?: string; -privateData?: Prisma.InputJsonValue; -publicData?: Prisma.InputJsonValue; -@ApiProperty({ enum: PersonRelation}) -organizerRelation?: PersonRelation; + @ApiProperty({ enum: BeneficiaryType }) + type?: BeneficiaryType + countryCode?: string + @ApiProperty({ enum: PersonRelation }) + coordinatorRelation?: PersonRelation + description?: string + privateData?: Prisma.InputJsonValue + publicData?: Prisma.InputJsonValue + @ApiProperty({ enum: PersonRelation }) + organizerRelation?: PersonRelation } diff --git a/apps/api/src/domain/generated/beneficiary/entities/beneficiary.entity.ts b/apps/api/src/domain/generated/beneficiary/entities/beneficiary.entity.ts index cd16bbf53..c4cf25c5a 100644 --- a/apps/api/src/domain/generated/beneficiary/entities/beneficiary.entity.ts +++ b/apps/api/src/domain/generated/beneficiary/entities/beneficiary.entity.ts @@ -1,33 +1,31 @@ - -import {Prisma,BeneficiaryType,PersonRelation} from '@prisma/client' -import {City} from '../../city/entities/city.entity' -import {Company} from '../../company/entities/company.entity' -import {Coordinator} from '../../coordinator/entities/coordinator.entity' -import {Organizer} from '../../organizer/entities/organizer.entity' -import {Person} from '../../person/entities/person.entity' -import {Campaign} from '../../campaign/entities/campaign.entity' - +import { Prisma, BeneficiaryType, PersonRelation } from '@prisma/client' +import { City } from '../../city/entities/city.entity' +import { Company } from '../../company/entities/company.entity' +import { Coordinator } from '../../coordinator/entities/coordinator.entity' +import { Organizer } from '../../organizer/entities/organizer.entity' +import { Person } from '../../person/entities/person.entity' +import { Campaign } from '../../campaign/entities/campaign.entity' export class Beneficiary { - id: string ; -type: BeneficiaryType ; -personId: string | null; -coordinatorId: string | null; -countryCode: string ; -cityId: string ; -createdAt: Date ; -updatedAt: Date | null; -coordinatorRelation: PersonRelation | null; -description: string | null; -privateData: Prisma.JsonValue | null; -publicData: Prisma.JsonValue | null; -companyId: string | null; -organizerId: string | null; -organizerRelation: PersonRelation | null; -city?: City ; -company?: Company | null; -coordinator?: Coordinator | null; -organizer?: Organizer | null; -person?: Person | null; -campaigns?: Campaign[] ; + id: string + type: BeneficiaryType + personId: string | null + coordinatorId: string | null + countryCode: string + cityId: string + createdAt: Date + updatedAt: Date | null + coordinatorRelation: PersonRelation | null + description: string | null + privateData: Prisma.JsonValue | null + publicData: Prisma.JsonValue | null + companyId: string | null + organizerId: string | null + organizerRelation: PersonRelation | null + city?: City + company?: Company | null + coordinator?: Coordinator | null + organizer?: Organizer | null + person?: Person | null + campaigns?: Campaign[] } diff --git a/apps/api/src/domain/generated/beneficiary/entities/index.ts b/apps/api/src/domain/generated/beneficiary/entities/index.ts index 1c70ada2d..dfedc52a2 100644 --- a/apps/api/src/domain/generated/beneficiary/entities/index.ts +++ b/apps/api/src/domain/generated/beneficiary/entities/index.ts @@ -1,2 +1 @@ - -export * from './beneficiary.entity'; \ No newline at end of file +export * from './beneficiary.entity' diff --git a/apps/api/src/domain/generated/campaign/dto/connect-campaign.dto.ts b/apps/api/src/domain/generated/campaign/dto/connect-campaign.dto.ts index 8455213fc..b1f28f448 100644 --- a/apps/api/src/domain/generated/campaign/dto/connect-campaign.dto.ts +++ b/apps/api/src/domain/generated/campaign/dto/connect-campaign.dto.ts @@ -1,7 +1,5 @@ - - export class ConnectCampaignDto { - id?: string; -slug?: string; -paymentReference?: string; - } - \ No newline at end of file +export class ConnectCampaignDto { + id?: string + slug?: string + paymentReference?: string +} diff --git a/apps/api/src/domain/generated/campaign/dto/create-campaign.dto.ts b/apps/api/src/domain/generated/campaign/dto/create-campaign.dto.ts index ef04d2a86..20dd31506 100644 --- a/apps/api/src/domain/generated/campaign/dto/create-campaign.dto.ts +++ b/apps/api/src/domain/generated/campaign/dto/create-campaign.dto.ts @@ -1,17 +1,11 @@ - - - - - - export class CreateCampaignDto { - slug: string; -title: string; -essence: string; -description?: string; -targetAmount?: number; -startDate?: Date; -endDate?: Date; -deletedAt?: Date; -paymentReference: string; + slug: string + title: string + essence: string + description?: string + targetAmount?: number + startDate?: Date + endDate?: Date + deletedAt?: Date + paymentReference: string } diff --git a/apps/api/src/domain/generated/campaign/dto/index.ts b/apps/api/src/domain/generated/campaign/dto/index.ts index 241d02034..867889df2 100644 --- a/apps/api/src/domain/generated/campaign/dto/index.ts +++ b/apps/api/src/domain/generated/campaign/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-campaign.dto'; -export * from './create-campaign.dto'; -export * from './update-campaign.dto'; \ No newline at end of file +export * from './connect-campaign.dto' +export * from './create-campaign.dto' +export * from './update-campaign.dto' diff --git a/apps/api/src/domain/generated/campaign/dto/update-campaign.dto.ts b/apps/api/src/domain/generated/campaign/dto/update-campaign.dto.ts index c54f9040b..299525728 100644 --- a/apps/api/src/domain/generated/campaign/dto/update-campaign.dto.ts +++ b/apps/api/src/domain/generated/campaign/dto/update-campaign.dto.ts @@ -1,17 +1,11 @@ - - - - - - export class UpdateCampaignDto { - slug?: string; -title?: string; -essence?: string; -description?: string; -targetAmount?: number; -startDate?: Date; -endDate?: Date; -deletedAt?: Date; -paymentReference?: string; + slug?: string + title?: string + essence?: string + description?: string + targetAmount?: number + startDate?: Date + endDate?: Date + deletedAt?: Date + paymentReference?: string } diff --git a/apps/api/src/domain/generated/campaign/entities/campaign.entity.ts b/apps/api/src/domain/generated/campaign/entities/campaign.entity.ts index 0aabf3539..3de7f1e63 100644 --- a/apps/api/src/domain/generated/campaign/entities/campaign.entity.ts +++ b/apps/api/src/domain/generated/campaign/entities/campaign.entity.ts @@ -1,58 +1,56 @@ - -import {CampaignState,Currency} from '@prisma/client' -import {Person} from '../../person/entities/person.entity' -import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' -import {CampaignType} from '../../campaignType/entities/campaignType.entity' -import {Coordinator} from '../../coordinator/entities/coordinator.entity' -import {Organizer} from '../../organizer/entities/organizer.entity' -import {Company} from '../../company/entities/company.entity' -import {CampaignFile} from '../../campaignFile/entities/campaignFile.entity' -import {DonationWish} from '../../donationWish/entities/donationWish.entity' -import {Irregularity} from '../../irregularity/entities/irregularity.entity' -import {Transfer} from '../../transfer/entities/transfer.entity' -import {Vault} from '../../vault/entities/vault.entity' -import {Withdrawal} from '../../withdrawal/entities/withdrawal.entity' -import {SlugArchive} from '../../slugArchive/entities/slugArchive.entity' -import {CampaignNews} from '../../campaignNews/entities/campaignNews.entity' -import {NotificationList} from '../../notificationList/entities/notificationList.entity' - +import { CampaignState, Currency } from '@prisma/client' +import { Person } from '../../person/entities/person.entity' +import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' +import { CampaignType } from '../../campaignType/entities/campaignType.entity' +import { Coordinator } from '../../coordinator/entities/coordinator.entity' +import { Organizer } from '../../organizer/entities/organizer.entity' +import { Company } from '../../company/entities/company.entity' +import { CampaignFile } from '../../campaignFile/entities/campaignFile.entity' +import { DonationWish } from '../../donationWish/entities/donationWish.entity' +import { Irregularity } from '../../irregularity/entities/irregularity.entity' +import { Transfer } from '../../transfer/entities/transfer.entity' +import { Vault } from '../../vault/entities/vault.entity' +import { Withdrawal } from '../../withdrawal/entities/withdrawal.entity' +import { SlugArchive } from '../../slugArchive/entities/slugArchive.entity' +import { CampaignNews } from '../../campaignNews/entities/campaignNews.entity' +import { NotificationList } from '../../notificationList/entities/notificationList.entity' export class Campaign { - id: string ; -state: CampaignState ; -slug: string ; -title: string ; -essence: string ; -coordinatorId: string ; -beneficiaryId: string ; -campaignTypeId: string ; -description: string | null; -targetAmount: number | null; -startDate: Date | null; -endDate: Date | null; -createdAt: Date ; -updatedAt: Date | null; -deletedAt: Date | null; -approvedById: string | null; -currency: Currency ; -allowDonationOnComplete: boolean ; -paymentReference: string ; -organizerId: string | null; -companyId: string | null; -approvedBy?: Person | null; -beneficiary?: Beneficiary ; -campaignType?: CampaignType ; -coordinator?: Coordinator ; -organizer?: Organizer | null; -company?: Company | null; -campaignFiles?: CampaignFile[] ; -donationWish?: DonationWish[] ; -irregularities?: Irregularity[] ; -outgoingTransfers?: Transfer[] ; -incomingTransfers?: Transfer[] ; -vaults?: Vault[] ; -withdrawals?: Withdrawal[] ; -slugArchive?: SlugArchive[] ; -campaignNews?: CampaignNews[] ; -notificationLists?: NotificationList[] ; + id: string + state: CampaignState + slug: string + title: string + essence: string + coordinatorId: string + beneficiaryId: string + campaignTypeId: string + description: string | null + targetAmount: number | null + startDate: Date | null + endDate: Date | null + createdAt: Date + updatedAt: Date | null + deletedAt: Date | null + approvedById: string | null + currency: Currency + allowDonationOnComplete: boolean + paymentReference: string + organizerId: string | null + companyId: string | null + approvedBy?: Person | null + beneficiary?: Beneficiary + campaignType?: CampaignType + coordinator?: Coordinator + organizer?: Organizer | null + company?: Company | null + campaignFiles?: CampaignFile[] + donationWish?: DonationWish[] + irregularities?: Irregularity[] + outgoingTransfers?: Transfer[] + incomingTransfers?: Transfer[] + vaults?: Vault[] + withdrawals?: Withdrawal[] + slugArchive?: SlugArchive[] + campaignNews?: CampaignNews[] + notificationLists?: NotificationList[] } diff --git a/apps/api/src/domain/generated/campaign/entities/index.ts b/apps/api/src/domain/generated/campaign/entities/index.ts index 1b36a8a95..60f683cf0 100644 --- a/apps/api/src/domain/generated/campaign/entities/index.ts +++ b/apps/api/src/domain/generated/campaign/entities/index.ts @@ -1,2 +1 @@ - -export * from './campaign.entity'; \ No newline at end of file +export * from './campaign.entity' diff --git a/apps/api/src/domain/generated/campaignFile/dto/connect-campaignFile.dto.ts b/apps/api/src/domain/generated/campaignFile/dto/connect-campaignFile.dto.ts index cff9608ef..6bc075ba1 100644 --- a/apps/api/src/domain/generated/campaignFile/dto/connect-campaignFile.dto.ts +++ b/apps/api/src/domain/generated/campaignFile/dto/connect-campaignFile.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectCampaignFileDto { - id: string; - } - \ No newline at end of file +export class ConnectCampaignFileDto { + id: string +} diff --git a/apps/api/src/domain/generated/campaignFile/dto/create-campaignFile.dto.ts b/apps/api/src/domain/generated/campaignFile/dto/create-campaignFile.dto.ts index 4abc7c4fa..d95e8c8d1 100644 --- a/apps/api/src/domain/generated/campaignFile/dto/create-campaignFile.dto.ts +++ b/apps/api/src/domain/generated/campaignFile/dto/create-campaignFile.dto.ts @@ -1,13 +1,9 @@ - -import {CampaignFileRole} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { CampaignFileRole } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateCampaignFileDto { - filename: string; -mimetype: string; -@ApiProperty({ enum: CampaignFileRole}) -role: CampaignFileRole; + filename: string + mimetype: string + @ApiProperty({ enum: CampaignFileRole }) + role: CampaignFileRole } diff --git a/apps/api/src/domain/generated/campaignFile/dto/index.ts b/apps/api/src/domain/generated/campaignFile/dto/index.ts index 4783677d1..4aee57739 100644 --- a/apps/api/src/domain/generated/campaignFile/dto/index.ts +++ b/apps/api/src/domain/generated/campaignFile/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-campaignFile.dto'; -export * from './create-campaignFile.dto'; -export * from './update-campaignFile.dto'; \ No newline at end of file +export * from './connect-campaignFile.dto' +export * from './create-campaignFile.dto' +export * from './update-campaignFile.dto' diff --git a/apps/api/src/domain/generated/campaignFile/dto/update-campaignFile.dto.ts b/apps/api/src/domain/generated/campaignFile/dto/update-campaignFile.dto.ts index 518c2fb17..91edf0627 100644 --- a/apps/api/src/domain/generated/campaignFile/dto/update-campaignFile.dto.ts +++ b/apps/api/src/domain/generated/campaignFile/dto/update-campaignFile.dto.ts @@ -1,13 +1,9 @@ - -import {CampaignFileRole} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { CampaignFileRole } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateCampaignFileDto { - filename?: string; -mimetype?: string; -@ApiProperty({ enum: CampaignFileRole}) -role?: CampaignFileRole; + filename?: string + mimetype?: string + @ApiProperty({ enum: CampaignFileRole }) + role?: CampaignFileRole } diff --git a/apps/api/src/domain/generated/campaignFile/entities/campaignFile.entity.ts b/apps/api/src/domain/generated/campaignFile/entities/campaignFile.entity.ts index a2121df59..3d42e1747 100644 --- a/apps/api/src/domain/generated/campaignFile/entities/campaignFile.entity.ts +++ b/apps/api/src/domain/generated/campaignFile/entities/campaignFile.entity.ts @@ -1,16 +1,14 @@ - -import {CampaignFileRole} from '@prisma/client' -import {Campaign} from '../../campaign/entities/campaign.entity' -import {Person} from '../../person/entities/person.entity' - +import { CampaignFileRole } from '@prisma/client' +import { Campaign } from '../../campaign/entities/campaign.entity' +import { Person } from '../../person/entities/person.entity' export class CampaignFile { - id: string ; -filename: string ; -campaignId: string ; -personId: string ; -mimetype: string ; -role: CampaignFileRole ; -campaign?: Campaign ; -person?: Person ; + id: string + filename: string + campaignId: string + personId: string + mimetype: string + role: CampaignFileRole + campaign?: Campaign + person?: Person } diff --git a/apps/api/src/domain/generated/campaignFile/entities/index.ts b/apps/api/src/domain/generated/campaignFile/entities/index.ts index 1177918c9..1b4dd6ad3 100644 --- a/apps/api/src/domain/generated/campaignFile/entities/index.ts +++ b/apps/api/src/domain/generated/campaignFile/entities/index.ts @@ -1,2 +1 @@ - -export * from './campaignFile.entity'; \ No newline at end of file +export * from './campaignFile.entity' diff --git a/apps/api/src/domain/generated/campaignNews/dto/connect-campaignNews.dto.ts b/apps/api/src/domain/generated/campaignNews/dto/connect-campaignNews.dto.ts index d2b369028..399d0f96b 100644 --- a/apps/api/src/domain/generated/campaignNews/dto/connect-campaignNews.dto.ts +++ b/apps/api/src/domain/generated/campaignNews/dto/connect-campaignNews.dto.ts @@ -1,6 +1,4 @@ - - export class ConnectCampaignNewsDto { - id?: string; -slug?: string; - } - \ No newline at end of file +export class ConnectCampaignNewsDto { + id?: string + slug?: string +} diff --git a/apps/api/src/domain/generated/campaignNews/dto/create-campaignNews.dto.ts b/apps/api/src/domain/generated/campaignNews/dto/create-campaignNews.dto.ts index c66e7e93d..b7acf5db8 100644 --- a/apps/api/src/domain/generated/campaignNews/dto/create-campaignNews.dto.ts +++ b/apps/api/src/domain/generated/campaignNews/dto/create-campaignNews.dto.ts @@ -1,15 +1,9 @@ - - - - - - export class CreateCampaignNewsDto { - slug: string; -title: string; -author: string; -sourceLink?: string; -publishedAt?: Date; -editedAt?: Date; -description: string; + slug: string + title: string + author: string + sourceLink?: string + publishedAt?: Date + editedAt?: Date + description: string } diff --git a/apps/api/src/domain/generated/campaignNews/dto/index.ts b/apps/api/src/domain/generated/campaignNews/dto/index.ts index d8692302f..b887f9b80 100644 --- a/apps/api/src/domain/generated/campaignNews/dto/index.ts +++ b/apps/api/src/domain/generated/campaignNews/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-campaignNews.dto'; -export * from './create-campaignNews.dto'; -export * from './update-campaignNews.dto'; \ No newline at end of file +export * from './connect-campaignNews.dto' +export * from './create-campaignNews.dto' +export * from './update-campaignNews.dto' diff --git a/apps/api/src/domain/generated/campaignNews/dto/update-campaignNews.dto.ts b/apps/api/src/domain/generated/campaignNews/dto/update-campaignNews.dto.ts index b97165ede..82adf9710 100644 --- a/apps/api/src/domain/generated/campaignNews/dto/update-campaignNews.dto.ts +++ b/apps/api/src/domain/generated/campaignNews/dto/update-campaignNews.dto.ts @@ -1,15 +1,9 @@ - - - - - - export class UpdateCampaignNewsDto { - slug?: string; -title?: string; -author?: string; -sourceLink?: string; -publishedAt?: Date; -editedAt?: Date; -description?: string; + slug?: string + title?: string + author?: string + sourceLink?: string + publishedAt?: Date + editedAt?: Date + description?: string } diff --git a/apps/api/src/domain/generated/campaignNews/entities/campaignNews.entity.ts b/apps/api/src/domain/generated/campaignNews/entities/campaignNews.entity.ts index 5fe575ab0..f046989d1 100644 --- a/apps/api/src/domain/generated/campaignNews/entities/campaignNews.entity.ts +++ b/apps/api/src/domain/generated/campaignNews/entities/campaignNews.entity.ts @@ -1,24 +1,22 @@ - -import {CampaignNewsState} from '@prisma/client' -import {Campaign} from '../../campaign/entities/campaign.entity' -import {Person} from '../../person/entities/person.entity' -import {CampaignNewsFile} from '../../campaignNewsFile/entities/campaignNewsFile.entity' - +import { CampaignNewsState } from '@prisma/client' +import { Campaign } from '../../campaign/entities/campaign.entity' +import { Person } from '../../person/entities/person.entity' +import { CampaignNewsFile } from '../../campaignNewsFile/entities/campaignNewsFile.entity' export class CampaignNews { - id: string ; -campaignId: string ; -publisherId: string ; -slug: string ; -title: string ; -author: string ; -sourceLink: string | null; -state: CampaignNewsState ; -createdAt: Date ; -publishedAt: Date | null; -editedAt: Date | null; -description: string ; -campaign?: Campaign ; -publisher?: Person ; -newsFiles?: CampaignNewsFile[] ; + id: string + campaignId: string + publisherId: string + slug: string + title: string + author: string + sourceLink: string | null + state: CampaignNewsState + createdAt: Date + publishedAt: Date | null + editedAt: Date | null + description: string + campaign?: Campaign + publisher?: Person + newsFiles?: CampaignNewsFile[] } diff --git a/apps/api/src/domain/generated/campaignNews/entities/index.ts b/apps/api/src/domain/generated/campaignNews/entities/index.ts index a356a01d1..cb5d82606 100644 --- a/apps/api/src/domain/generated/campaignNews/entities/index.ts +++ b/apps/api/src/domain/generated/campaignNews/entities/index.ts @@ -1,2 +1 @@ - -export * from './campaignNews.entity'; \ No newline at end of file +export * from './campaignNews.entity' diff --git a/apps/api/src/domain/generated/campaignNewsFile/dto/connect-campaignNewsFile.dto.ts b/apps/api/src/domain/generated/campaignNewsFile/dto/connect-campaignNewsFile.dto.ts index ab48dffbb..3292302a0 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/dto/connect-campaignNewsFile.dto.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/dto/connect-campaignNewsFile.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectCampaignNewsFileDto { - id: string; - } - \ No newline at end of file +export class ConnectCampaignNewsFileDto { + id: string +} diff --git a/apps/api/src/domain/generated/campaignNewsFile/dto/create-campaignNewsFile.dto.ts b/apps/api/src/domain/generated/campaignNewsFile/dto/create-campaignNewsFile.dto.ts index 8615826f7..b99ca94c8 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/dto/create-campaignNewsFile.dto.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/dto/create-campaignNewsFile.dto.ts @@ -1,13 +1,9 @@ - -import {CampaignFileRole} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { CampaignFileRole } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateCampaignNewsFileDto { - filename: string; -mimetype: string; -@ApiProperty({ enum: CampaignFileRole}) -role: CampaignFileRole; + filename: string + mimetype: string + @ApiProperty({ enum: CampaignFileRole }) + role: CampaignFileRole } diff --git a/apps/api/src/domain/generated/campaignNewsFile/dto/index.ts b/apps/api/src/domain/generated/campaignNewsFile/dto/index.ts index f8d203eaa..b2ce1b44c 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/dto/index.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-campaignNewsFile.dto'; -export * from './create-campaignNewsFile.dto'; -export * from './update-campaignNewsFile.dto'; \ No newline at end of file +export * from './connect-campaignNewsFile.dto' +export * from './create-campaignNewsFile.dto' +export * from './update-campaignNewsFile.dto' diff --git a/apps/api/src/domain/generated/campaignNewsFile/dto/update-campaignNewsFile.dto.ts b/apps/api/src/domain/generated/campaignNewsFile/dto/update-campaignNewsFile.dto.ts index cd6ef53f4..dd638edca 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/dto/update-campaignNewsFile.dto.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/dto/update-campaignNewsFile.dto.ts @@ -1,13 +1,9 @@ - -import {CampaignFileRole} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { CampaignFileRole } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateCampaignNewsFileDto { - filename?: string; -mimetype?: string; -@ApiProperty({ enum: CampaignFileRole}) -role?: CampaignFileRole; + filename?: string + mimetype?: string + @ApiProperty({ enum: CampaignFileRole }) + role?: CampaignFileRole } diff --git a/apps/api/src/domain/generated/campaignNewsFile/entities/campaignNewsFile.entity.ts b/apps/api/src/domain/generated/campaignNewsFile/entities/campaignNewsFile.entity.ts index 9707618c1..18d32c0c9 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/entities/campaignNewsFile.entity.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/entities/campaignNewsFile.entity.ts @@ -1,16 +1,14 @@ - -import {CampaignFileRole} from '@prisma/client' -import {CampaignNews} from '../../campaignNews/entities/campaignNews.entity' -import {Person} from '../../person/entities/person.entity' - +import { CampaignFileRole } from '@prisma/client' +import { CampaignNews } from '../../campaignNews/entities/campaignNews.entity' +import { Person } from '../../person/entities/person.entity' export class CampaignNewsFile { - id: string ; -filename: string ; -newsId: string ; -personId: string ; -mimetype: string ; -role: CampaignFileRole ; -news?: CampaignNews ; -person?: Person ; + id: string + filename: string + newsId: string + personId: string + mimetype: string + role: CampaignFileRole + news?: CampaignNews + person?: Person } diff --git a/apps/api/src/domain/generated/campaignNewsFile/entities/index.ts b/apps/api/src/domain/generated/campaignNewsFile/entities/index.ts index d112cd6d7..9c6fe2cab 100644 --- a/apps/api/src/domain/generated/campaignNewsFile/entities/index.ts +++ b/apps/api/src/domain/generated/campaignNewsFile/entities/index.ts @@ -1,2 +1 @@ - -export * from './campaignNewsFile.entity'; \ No newline at end of file +export * from './campaignNewsFile.entity' diff --git a/apps/api/src/domain/generated/campaignType/dto/connect-campaignType.dto.ts b/apps/api/src/domain/generated/campaignType/dto/connect-campaignType.dto.ts index fa5c9ecf2..7eb88de61 100644 --- a/apps/api/src/domain/generated/campaignType/dto/connect-campaignType.dto.ts +++ b/apps/api/src/domain/generated/campaignType/dto/connect-campaignType.dto.ts @@ -1,6 +1,4 @@ - - export class ConnectCampaignTypeDto { - id?: string; -slug?: string; - } - \ No newline at end of file +export class ConnectCampaignTypeDto { + id?: string + slug?: string +} diff --git a/apps/api/src/domain/generated/campaignType/dto/create-campaignType.dto.ts b/apps/api/src/domain/generated/campaignType/dto/create-campaignType.dto.ts index 588de0cad..3e3c3a04c 100644 --- a/apps/api/src/domain/generated/campaignType/dto/create-campaignType.dto.ts +++ b/apps/api/src/domain/generated/campaignType/dto/create-campaignType.dto.ts @@ -1,11 +1,5 @@ - - - - - - export class CreateCampaignTypeDto { - name: string; -slug: string; -description?: string; + name: string + slug: string + description?: string } diff --git a/apps/api/src/domain/generated/campaignType/dto/index.ts b/apps/api/src/domain/generated/campaignType/dto/index.ts index 6ce9a2e56..a3d17f0f1 100644 --- a/apps/api/src/domain/generated/campaignType/dto/index.ts +++ b/apps/api/src/domain/generated/campaignType/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-campaignType.dto'; -export * from './create-campaignType.dto'; -export * from './update-campaignType.dto'; \ No newline at end of file +export * from './connect-campaignType.dto' +export * from './create-campaignType.dto' +export * from './update-campaignType.dto' diff --git a/apps/api/src/domain/generated/campaignType/dto/update-campaignType.dto.ts b/apps/api/src/domain/generated/campaignType/dto/update-campaignType.dto.ts index 4ccebd4cd..42116f6ff 100644 --- a/apps/api/src/domain/generated/campaignType/dto/update-campaignType.dto.ts +++ b/apps/api/src/domain/generated/campaignType/dto/update-campaignType.dto.ts @@ -1,11 +1,5 @@ - - - - - - export class UpdateCampaignTypeDto { - name?: string; -slug?: string; -description?: string; + name?: string + slug?: string + description?: string } diff --git a/apps/api/src/domain/generated/campaignType/entities/campaignType.entity.ts b/apps/api/src/domain/generated/campaignType/entities/campaignType.entity.ts index d9ff4a1af..eedb6679e 100644 --- a/apps/api/src/domain/generated/campaignType/entities/campaignType.entity.ts +++ b/apps/api/src/domain/generated/campaignType/entities/campaignType.entity.ts @@ -1,16 +1,14 @@ - -import {CampaignTypeCategory} from '@prisma/client' -import {Campaign} from '../../campaign/entities/campaign.entity' - +import { CampaignTypeCategory } from '@prisma/client' +import { Campaign } from '../../campaign/entities/campaign.entity' export class CampaignType { - id: string ; -name: string ; -slug: string ; -description: string | null; -parentId: string | null; -category: CampaignTypeCategory ; -parent?: CampaignType | null; -children?: CampaignType[] ; -campaigns?: Campaign[] ; + id: string + name: string + slug: string + description: string | null + parentId: string | null + category: CampaignTypeCategory + parent?: CampaignType | null + children?: CampaignType[] + campaigns?: Campaign[] } diff --git a/apps/api/src/domain/generated/campaignType/entities/index.ts b/apps/api/src/domain/generated/campaignType/entities/index.ts index fd1c4c73c..69de9cc0f 100644 --- a/apps/api/src/domain/generated/campaignType/entities/index.ts +++ b/apps/api/src/domain/generated/campaignType/entities/index.ts @@ -1,2 +1 @@ - -export * from './campaignType.entity'; \ No newline at end of file +export * from './campaignType.entity' diff --git a/apps/api/src/domain/generated/city/dto/connect-city.dto.ts b/apps/api/src/domain/generated/city/dto/connect-city.dto.ts index 2c8ae2e64..f02778b3e 100644 --- a/apps/api/src/domain/generated/city/dto/connect-city.dto.ts +++ b/apps/api/src/domain/generated/city/dto/connect-city.dto.ts @@ -1,6 +1,4 @@ - - export class ConnectCityDto { - id?: string; -postalCode?: string; - } - \ No newline at end of file +export class ConnectCityDto { + id?: string + postalCode?: string +} diff --git a/apps/api/src/domain/generated/city/dto/create-city.dto.ts b/apps/api/src/domain/generated/city/dto/create-city.dto.ts index 68b2a51f6..56f37e88c 100644 --- a/apps/api/src/domain/generated/city/dto/create-city.dto.ts +++ b/apps/api/src/domain/generated/city/dto/create-city.dto.ts @@ -1,10 +1,4 @@ - - - - - - export class CreateCityDto { - name: string; -postalCode: string; + name: string + postalCode: string } diff --git a/apps/api/src/domain/generated/city/dto/index.ts b/apps/api/src/domain/generated/city/dto/index.ts index 1b6315c72..b823bfd61 100644 --- a/apps/api/src/domain/generated/city/dto/index.ts +++ b/apps/api/src/domain/generated/city/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-city.dto'; -export * from './create-city.dto'; -export * from './update-city.dto'; \ No newline at end of file +export * from './connect-city.dto' +export * from './create-city.dto' +export * from './update-city.dto' diff --git a/apps/api/src/domain/generated/city/dto/update-city.dto.ts b/apps/api/src/domain/generated/city/dto/update-city.dto.ts index fc6630b75..0099660af 100644 --- a/apps/api/src/domain/generated/city/dto/update-city.dto.ts +++ b/apps/api/src/domain/generated/city/dto/update-city.dto.ts @@ -1,10 +1,4 @@ - - - - - - export class UpdateCityDto { - name?: string; -postalCode?: string; + name?: string + postalCode?: string } diff --git a/apps/api/src/domain/generated/city/entities/city.entity.ts b/apps/api/src/domain/generated/city/entities/city.entity.ts index 004ec33f2..99ef221ca 100644 --- a/apps/api/src/domain/generated/city/entities/city.entity.ts +++ b/apps/api/src/domain/generated/city/entities/city.entity.ts @@ -1,13 +1,11 @@ - -import {Country} from '../../country/entities/country.entity' -import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' - +import { Country } from '../../country/entities/country.entity' +import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' export class City { - id: string ; -name: string ; -postalCode: string ; -countryId: string ; -countryCode?: Country ; -beneficiaries?: Beneficiary[] ; + id: string + name: string + postalCode: string + countryId: string + countryCode?: Country + beneficiaries?: Beneficiary[] } diff --git a/apps/api/src/domain/generated/city/entities/index.ts b/apps/api/src/domain/generated/city/entities/index.ts index 9e9cd504e..ddeee0cf1 100644 --- a/apps/api/src/domain/generated/city/entities/index.ts +++ b/apps/api/src/domain/generated/city/entities/index.ts @@ -1,2 +1 @@ - -export * from './city.entity'; \ No newline at end of file +export * from './city.entity' diff --git a/apps/api/src/domain/generated/company/dto/connect-company.dto.ts b/apps/api/src/domain/generated/company/dto/connect-company.dto.ts index 40f1eb3c1..5731c5a4c 100644 --- a/apps/api/src/domain/generated/company/dto/connect-company.dto.ts +++ b/apps/api/src/domain/generated/company/dto/connect-company.dto.ts @@ -1,7 +1,5 @@ - - export class ConnectCompanyDto { - id?: string; -companyNumber?: string; -personId?: string; - } - \ No newline at end of file +export class ConnectCompanyDto { + id?: string + companyNumber?: string + personId?: string +} diff --git a/apps/api/src/domain/generated/company/dto/create-company.dto.ts b/apps/api/src/domain/generated/company/dto/create-company.dto.ts index 7a4ac3d62..983a813b2 100644 --- a/apps/api/src/domain/generated/company/dto/create-company.dto.ts +++ b/apps/api/src/domain/generated/company/dto/create-company.dto.ts @@ -1,14 +1,8 @@ - - - - - - export class CreateCompanyDto { - companyName: string; -companyNumber: string; -legalPersonName?: string; -countryCode?: string; -cityId?: string; -personId?: string; + companyName: string + companyNumber: string + legalPersonName?: string + countryCode?: string + cityId?: string + personId?: string } diff --git a/apps/api/src/domain/generated/company/dto/index.ts b/apps/api/src/domain/generated/company/dto/index.ts index 5532e5f94..3ad34072c 100644 --- a/apps/api/src/domain/generated/company/dto/index.ts +++ b/apps/api/src/domain/generated/company/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-company.dto'; -export * from './create-company.dto'; -export * from './update-company.dto'; \ No newline at end of file +export * from './connect-company.dto' +export * from './create-company.dto' +export * from './update-company.dto' diff --git a/apps/api/src/domain/generated/company/dto/update-company.dto.ts b/apps/api/src/domain/generated/company/dto/update-company.dto.ts index 8950f3284..adf9c0db7 100644 --- a/apps/api/src/domain/generated/company/dto/update-company.dto.ts +++ b/apps/api/src/domain/generated/company/dto/update-company.dto.ts @@ -1,14 +1,8 @@ - - - - - - export class UpdateCompanyDto { - companyName?: string; -companyNumber?: string; -legalPersonName?: string; -countryCode?: string; -cityId?: string; -personId?: string; + companyName?: string + companyNumber?: string + legalPersonName?: string + countryCode?: string + cityId?: string + personId?: string } diff --git a/apps/api/src/domain/generated/company/entities/company.entity.ts b/apps/api/src/domain/generated/company/entities/company.entity.ts index 0c52549c0..d577baea1 100644 --- a/apps/api/src/domain/generated/company/entities/company.entity.ts +++ b/apps/api/src/domain/generated/company/entities/company.entity.ts @@ -1,22 +1,20 @@ - -import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' -import {Campaign} from '../../campaign/entities/campaign.entity' -import {Person} from '../../person/entities/person.entity' -import {Affiliate} from '../../affiliate/entities/affiliate.entity' - +import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' +import { Campaign } from '../../campaign/entities/campaign.entity' +import { Person } from '../../person/entities/person.entity' +import { Affiliate } from '../../affiliate/entities/affiliate.entity' export class Company { - id: string ; -companyName: string ; -companyNumber: string ; -legalPersonName: string | null; -countryCode: string | null; -cityId: string | null; -personId: string | null; -createdAt: Date ; -updatedAt: Date | null; -beneficiaries?: Beneficiary[] ; -Campaign?: Campaign[] ; -person?: Person | null; -affiliate?: Affiliate | null; + id: string + companyName: string + companyNumber: string + legalPersonName: string | null + countryCode: string | null + cityId: string | null + personId: string | null + createdAt: Date + updatedAt: Date | null + beneficiaries?: Beneficiary[] + Campaign?: Campaign[] + person?: Person | null + affiliate?: Affiliate | null } diff --git a/apps/api/src/domain/generated/company/entities/index.ts b/apps/api/src/domain/generated/company/entities/index.ts index 7635c0271..9c8b84bf6 100644 --- a/apps/api/src/domain/generated/company/entities/index.ts +++ b/apps/api/src/domain/generated/company/entities/index.ts @@ -1,2 +1 @@ - -export * from './company.entity'; \ No newline at end of file +export * from './company.entity' diff --git a/apps/api/src/domain/generated/coordinator/dto/connect-coordinator.dto.ts b/apps/api/src/domain/generated/coordinator/dto/connect-coordinator.dto.ts index 10f4bcbf0..dd9430f4e 100644 --- a/apps/api/src/domain/generated/coordinator/dto/connect-coordinator.dto.ts +++ b/apps/api/src/domain/generated/coordinator/dto/connect-coordinator.dto.ts @@ -1,6 +1,4 @@ - - export class ConnectCoordinatorDto { - id?: string; -personId?: string; - } - \ No newline at end of file +export class ConnectCoordinatorDto { + id?: string + personId?: string +} diff --git a/apps/api/src/domain/generated/coordinator/dto/create-coordinator.dto.ts b/apps/api/src/domain/generated/coordinator/dto/create-coordinator.dto.ts index f45f8e364..bfb4f7a4f 100644 --- a/apps/api/src/domain/generated/coordinator/dto/create-coordinator.dto.ts +++ b/apps/api/src/domain/generated/coordinator/dto/create-coordinator.dto.ts @@ -1,9 +1 @@ - - - - - - -export class CreateCoordinatorDto { - -} +export class CreateCoordinatorDto {} diff --git a/apps/api/src/domain/generated/coordinator/dto/index.ts b/apps/api/src/domain/generated/coordinator/dto/index.ts index 912f2a219..e52a4a99f 100644 --- a/apps/api/src/domain/generated/coordinator/dto/index.ts +++ b/apps/api/src/domain/generated/coordinator/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-coordinator.dto'; -export * from './create-coordinator.dto'; -export * from './update-coordinator.dto'; \ No newline at end of file +export * from './connect-coordinator.dto' +export * from './create-coordinator.dto' +export * from './update-coordinator.dto' diff --git a/apps/api/src/domain/generated/coordinator/dto/update-coordinator.dto.ts b/apps/api/src/domain/generated/coordinator/dto/update-coordinator.dto.ts index 87b6a5c64..6824eaff4 100644 --- a/apps/api/src/domain/generated/coordinator/dto/update-coordinator.dto.ts +++ b/apps/api/src/domain/generated/coordinator/dto/update-coordinator.dto.ts @@ -1,9 +1 @@ - - - - - - -export class UpdateCoordinatorDto { - -} +export class UpdateCoordinatorDto {} diff --git a/apps/api/src/domain/generated/coordinator/entities/coordinator.entity.ts b/apps/api/src/domain/generated/coordinator/entities/coordinator.entity.ts index deeb9fa2c..1cc86fdc1 100644 --- a/apps/api/src/domain/generated/coordinator/entities/coordinator.entity.ts +++ b/apps/api/src/domain/generated/coordinator/entities/coordinator.entity.ts @@ -1,15 +1,13 @@ - -import {Person} from '../../person/entities/person.entity' -import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' -import {Campaign} from '../../campaign/entities/campaign.entity' - +import { Person } from '../../person/entities/person.entity' +import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' +import { Campaign } from '../../campaign/entities/campaign.entity' export class Coordinator { - id: string ; -personId: string ; -createdAt: Date ; -updatedAt: Date | null; -person?: Person ; -beneficiaries?: Beneficiary[] ; -campaigns?: Campaign[] ; + id: string + personId: string + createdAt: Date + updatedAt: Date | null + person?: Person + beneficiaries?: Beneficiary[] + campaigns?: Campaign[] } diff --git a/apps/api/src/domain/generated/coordinator/entities/index.ts b/apps/api/src/domain/generated/coordinator/entities/index.ts index 49b128a1a..c0710e67a 100644 --- a/apps/api/src/domain/generated/coordinator/entities/index.ts +++ b/apps/api/src/domain/generated/coordinator/entities/index.ts @@ -1,2 +1 @@ - -export * from './coordinator.entity'; \ No newline at end of file +export * from './coordinator.entity' diff --git a/apps/api/src/domain/generated/country/dto/connect-country.dto.ts b/apps/api/src/domain/generated/country/dto/connect-country.dto.ts index 7fdcf366f..7f793b9f6 100644 --- a/apps/api/src/domain/generated/country/dto/connect-country.dto.ts +++ b/apps/api/src/domain/generated/country/dto/connect-country.dto.ts @@ -1,6 +1,4 @@ - - export class ConnectCountryDto { - id?: string; -countryCode?: string; - } - \ No newline at end of file +export class ConnectCountryDto { + id?: string + countryCode?: string +} diff --git a/apps/api/src/domain/generated/country/dto/create-country.dto.ts b/apps/api/src/domain/generated/country/dto/create-country.dto.ts index b16cd9dbc..0e823c597 100644 --- a/apps/api/src/domain/generated/country/dto/create-country.dto.ts +++ b/apps/api/src/domain/generated/country/dto/create-country.dto.ts @@ -1,10 +1,4 @@ - - - - - - export class CreateCountryDto { - name: string; -countryCode: string; + name: string + countryCode: string } diff --git a/apps/api/src/domain/generated/country/dto/index.ts b/apps/api/src/domain/generated/country/dto/index.ts index 22d45c644..9284b8275 100644 --- a/apps/api/src/domain/generated/country/dto/index.ts +++ b/apps/api/src/domain/generated/country/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-country.dto'; -export * from './create-country.dto'; -export * from './update-country.dto'; \ No newline at end of file +export * from './connect-country.dto' +export * from './create-country.dto' +export * from './update-country.dto' diff --git a/apps/api/src/domain/generated/country/dto/update-country.dto.ts b/apps/api/src/domain/generated/country/dto/update-country.dto.ts index f502eb44b..b3406fd6c 100644 --- a/apps/api/src/domain/generated/country/dto/update-country.dto.ts +++ b/apps/api/src/domain/generated/country/dto/update-country.dto.ts @@ -1,10 +1,4 @@ - - - - - - export class UpdateCountryDto { - name?: string; -countryCode?: string; + name?: string + countryCode?: string } diff --git a/apps/api/src/domain/generated/country/entities/country.entity.ts b/apps/api/src/domain/generated/country/entities/country.entity.ts index b71be4438..4b45fd1fa 100644 --- a/apps/api/src/domain/generated/country/entities/country.entity.ts +++ b/apps/api/src/domain/generated/country/entities/country.entity.ts @@ -1,10 +1,8 @@ - -import {City} from '../../city/entities/city.entity' - +import { City } from '../../city/entities/city.entity' export class Country { - id: string ; -name: string ; -countryCode: string ; -cities?: City[] ; + id: string + name: string + countryCode: string + cities?: City[] } diff --git a/apps/api/src/domain/generated/country/entities/index.ts b/apps/api/src/domain/generated/country/entities/index.ts index d160a811d..1e3b72c86 100644 --- a/apps/api/src/domain/generated/country/entities/index.ts +++ b/apps/api/src/domain/generated/country/entities/index.ts @@ -1,2 +1 @@ - -export * from './country.entity'; \ No newline at end of file +export * from './country.entity' diff --git a/apps/api/src/domain/generated/document/dto/connect-document.dto.ts b/apps/api/src/domain/generated/document/dto/connect-document.dto.ts index a03a5c496..3a84611a9 100644 --- a/apps/api/src/domain/generated/document/dto/connect-document.dto.ts +++ b/apps/api/src/domain/generated/document/dto/connect-document.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectDocumentDto { - id: string; - } - \ No newline at end of file +export class ConnectDocumentDto { + id: string +} diff --git a/apps/api/src/domain/generated/document/dto/create-document.dto.ts b/apps/api/src/domain/generated/document/dto/create-document.dto.ts index 4e9aadf14..3a627f38c 100644 --- a/apps/api/src/domain/generated/document/dto/create-document.dto.ts +++ b/apps/api/src/domain/generated/document/dto/create-document.dto.ts @@ -1,16 +1,12 @@ - -import {DocumentType} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { DocumentType } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateDocumentDto { - @ApiProperty({ enum: DocumentType}) -type: DocumentType; -name: string; -filename: string; -filetype?: string; -description?: string; -sourceUrl: string; + @ApiProperty({ enum: DocumentType }) + type: DocumentType + name: string + filename: string + filetype?: string + description?: string + sourceUrl: string } diff --git a/apps/api/src/domain/generated/document/dto/index.ts b/apps/api/src/domain/generated/document/dto/index.ts index 23dc27179..5bc2bdf4a 100644 --- a/apps/api/src/domain/generated/document/dto/index.ts +++ b/apps/api/src/domain/generated/document/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-document.dto'; -export * from './create-document.dto'; -export * from './update-document.dto'; \ No newline at end of file +export * from './connect-document.dto' +export * from './create-document.dto' +export * from './update-document.dto' diff --git a/apps/api/src/domain/generated/document/dto/update-document.dto.ts b/apps/api/src/domain/generated/document/dto/update-document.dto.ts index 5af3aa1b0..71d92c7ea 100644 --- a/apps/api/src/domain/generated/document/dto/update-document.dto.ts +++ b/apps/api/src/domain/generated/document/dto/update-document.dto.ts @@ -1,16 +1,12 @@ - -import {DocumentType} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { DocumentType } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateDocumentDto { - @ApiProperty({ enum: DocumentType}) -type?: DocumentType; -name?: string; -filename?: string; -filetype?: string; -description?: string; -sourceUrl?: string; + @ApiProperty({ enum: DocumentType }) + type?: DocumentType + name?: string + filename?: string + filetype?: string + description?: string + sourceUrl?: string } diff --git a/apps/api/src/domain/generated/document/entities/document.entity.ts b/apps/api/src/domain/generated/document/entities/document.entity.ts index 7dc06e018..460b25233 100644 --- a/apps/api/src/domain/generated/document/entities/document.entity.ts +++ b/apps/api/src/domain/generated/document/entities/document.entity.ts @@ -1,18 +1,16 @@ - -import {DocumentType} from '@prisma/client' -import {Person} from '../../person/entities/person.entity' -import {Expense} from '../../expense/entities/expense.entity' - +import { DocumentType } from '@prisma/client' +import { Person } from '../../person/entities/person.entity' +import { Expense } from '../../expense/entities/expense.entity' export class Document { - id: string ; -type: DocumentType ; -name: string ; -filename: string ; -filetype: string | null; -description: string | null; -sourceUrl: string ; -ownerId: string ; -owner?: Person ; -expenses?: Expense[] ; + id: string + type: DocumentType + name: string + filename: string + filetype: string | null + description: string | null + sourceUrl: string + ownerId: string + owner?: Person + expenses?: Expense[] } diff --git a/apps/api/src/domain/generated/document/entities/index.ts b/apps/api/src/domain/generated/document/entities/index.ts index e56503c0c..5170971ae 100644 --- a/apps/api/src/domain/generated/document/entities/index.ts +++ b/apps/api/src/domain/generated/document/entities/index.ts @@ -1,2 +1 @@ - -export * from './document.entity'; \ No newline at end of file +export * from './document.entity' diff --git a/apps/api/src/domain/generated/donation/dto/connect-donation.dto.ts b/apps/api/src/domain/generated/donation/dto/connect-donation.dto.ts index 36fcb2358..a5015856d 100644 --- a/apps/api/src/domain/generated/donation/dto/connect-donation.dto.ts +++ b/apps/api/src/domain/generated/donation/dto/connect-donation.dto.ts @@ -1,6 +1,4 @@ - - export class ConnectDonationDto { - id?: string; -extPaymentIntentId?: string; - } - \ No newline at end of file +export class ConnectDonationDto { + id?: string + extPaymentIntentId?: string +} diff --git a/apps/api/src/domain/generated/donation/dto/create-donation.dto.ts b/apps/api/src/domain/generated/donation/dto/create-donation.dto.ts index 3d93f8af7..e447208dc 100644 --- a/apps/api/src/domain/generated/donation/dto/create-donation.dto.ts +++ b/apps/api/src/domain/generated/donation/dto/create-donation.dto.ts @@ -1,16 +1,12 @@ - -import {DonationType} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { DonationType } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateDonationDto { - @ApiProperty({ enum: DonationType}) -type: DonationType; -extCustomerId: string; -extPaymentIntentId: string; -extPaymentMethodId: string; -billingEmail?: string; -billingName?: string; + @ApiProperty({ enum: DonationType }) + type: DonationType + extCustomerId: string + extPaymentIntentId: string + extPaymentMethodId: string + billingEmail?: string + billingName?: string } diff --git a/apps/api/src/domain/generated/donation/dto/index.ts b/apps/api/src/domain/generated/donation/dto/index.ts index b0e424478..4c9722733 100644 --- a/apps/api/src/domain/generated/donation/dto/index.ts +++ b/apps/api/src/domain/generated/donation/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-donation.dto'; -export * from './create-donation.dto'; -export * from './update-donation.dto'; \ No newline at end of file +export * from './connect-donation.dto' +export * from './create-donation.dto' +export * from './update-donation.dto' diff --git a/apps/api/src/domain/generated/donation/dto/update-donation.dto.ts b/apps/api/src/domain/generated/donation/dto/update-donation.dto.ts index 7caea543d..c88603166 100644 --- a/apps/api/src/domain/generated/donation/dto/update-donation.dto.ts +++ b/apps/api/src/domain/generated/donation/dto/update-donation.dto.ts @@ -1,16 +1,12 @@ - -import {DonationType} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { DonationType } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateDonationDto { - @ApiProperty({ enum: DonationType}) -type?: DonationType; -extCustomerId?: string; -extPaymentIntentId?: string; -extPaymentMethodId?: string; -billingEmail?: string; -billingName?: string; + @ApiProperty({ enum: DonationType }) + type?: DonationType + extCustomerId?: string + extPaymentIntentId?: string + extPaymentMethodId?: string + billingEmail?: string + billingName?: string } diff --git a/apps/api/src/domain/generated/donation/entities/donation.entity.ts b/apps/api/src/domain/generated/donation/entities/donation.entity.ts index 003899405..57fc0ce8b 100644 --- a/apps/api/src/domain/generated/donation/entities/donation.entity.ts +++ b/apps/api/src/domain/generated/donation/entities/donation.entity.ts @@ -1,33 +1,31 @@ - -import {DonationType,DonationStatus,PaymentProvider,Currency} from '@prisma/client' -import {Person} from '../../person/entities/person.entity' -import {Vault} from '../../vault/entities/vault.entity' -import {Affiliate} from '../../affiliate/entities/affiliate.entity' -import {DonationWish} from '../../donationWish/entities/donationWish.entity' -import {DonationMetadata} from '../../donationMetadata/entities/donationMetadata.entity' - +import { DonationType, DonationStatus, PaymentProvider, Currency } from '@prisma/client' +import { Person } from '../../person/entities/person.entity' +import { Vault } from '../../vault/entities/vault.entity' +import { Affiliate } from '../../affiliate/entities/affiliate.entity' +import { DonationWish } from '../../donationWish/entities/donationWish.entity' +import { DonationMetadata } from '../../donationMetadata/entities/donationMetadata.entity' export class Donation { - id: string ; -type: DonationType ; -status: DonationStatus ; -provider: PaymentProvider ; -targetVaultId: string ; -extCustomerId: string ; -extPaymentIntentId: string ; -extPaymentMethodId: string ; -createdAt: Date ; -updatedAt: Date | null; -amount: number ; -currency: Currency ; -affiliateId: string | null; -personId: string | null; -billingEmail: string | null; -billingName: string | null; -chargedAmount: number ; -person?: Person | null; -targetVault?: Vault ; -affiliate?: Affiliate | null; -DonationWish?: DonationWish | null; -metadata?: DonationMetadata | null; + id: string + type: DonationType + status: DonationStatus + provider: PaymentProvider + targetVaultId: string + extCustomerId: string + extPaymentIntentId: string + extPaymentMethodId: string + createdAt: Date + updatedAt: Date | null + amount: number + currency: Currency + affiliateId: string | null + personId: string | null + billingEmail: string | null + billingName: string | null + chargedAmount: number + person?: Person | null + targetVault?: Vault + affiliate?: Affiliate | null + DonationWish?: DonationWish | null + metadata?: DonationMetadata | null } diff --git a/apps/api/src/domain/generated/donation/entities/index.ts b/apps/api/src/domain/generated/donation/entities/index.ts index 19345a833..f1cd626f7 100644 --- a/apps/api/src/domain/generated/donation/entities/index.ts +++ b/apps/api/src/domain/generated/donation/entities/index.ts @@ -1,2 +1 @@ - -export * from './donation.entity'; \ No newline at end of file +export * from './donation.entity' diff --git a/apps/api/src/domain/generated/donationMetadata/dto/connect-donationMetadata.dto.ts b/apps/api/src/domain/generated/donationMetadata/dto/connect-donationMetadata.dto.ts index 04146d7f7..9875d62d7 100644 --- a/apps/api/src/domain/generated/donationMetadata/dto/connect-donationMetadata.dto.ts +++ b/apps/api/src/domain/generated/donationMetadata/dto/connect-donationMetadata.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectDonationMetadataDto { - donationId: string; - } - \ No newline at end of file +export class ConnectDonationMetadataDto { + donationId: string +} diff --git a/apps/api/src/domain/generated/donationMetadata/dto/create-donationMetadata.dto.ts b/apps/api/src/domain/generated/donationMetadata/dto/create-donationMetadata.dto.ts index ff1cd5857..fc3917bb7 100644 --- a/apps/api/src/domain/generated/donationMetadata/dto/create-donationMetadata.dto.ts +++ b/apps/api/src/domain/generated/donationMetadata/dto/create-donationMetadata.dto.ts @@ -1,10 +1,6 @@ - -import {Prisma} from '@prisma/client' - - - +import { Prisma } from '@prisma/client' export class CreateDonationMetadataDto { - name?: string; -extraData?: Prisma.InputJsonValue; + name?: string + extraData?: Prisma.InputJsonValue } diff --git a/apps/api/src/domain/generated/donationMetadata/dto/index.ts b/apps/api/src/domain/generated/donationMetadata/dto/index.ts index 00ba311f1..f313f5d13 100644 --- a/apps/api/src/domain/generated/donationMetadata/dto/index.ts +++ b/apps/api/src/domain/generated/donationMetadata/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-donationMetadata.dto'; -export * from './create-donationMetadata.dto'; -export * from './update-donationMetadata.dto'; \ No newline at end of file +export * from './connect-donationMetadata.dto' +export * from './create-donationMetadata.dto' +export * from './update-donationMetadata.dto' diff --git a/apps/api/src/domain/generated/donationMetadata/dto/update-donationMetadata.dto.ts b/apps/api/src/domain/generated/donationMetadata/dto/update-donationMetadata.dto.ts index d972a6431..e2382d4b5 100644 --- a/apps/api/src/domain/generated/donationMetadata/dto/update-donationMetadata.dto.ts +++ b/apps/api/src/domain/generated/donationMetadata/dto/update-donationMetadata.dto.ts @@ -1,10 +1,6 @@ - -import {Prisma} from '@prisma/client' - - - +import { Prisma } from '@prisma/client' export class UpdateDonationMetadataDto { - name?: string; -extraData?: Prisma.InputJsonValue; + name?: string + extraData?: Prisma.InputJsonValue } diff --git a/apps/api/src/domain/generated/donationMetadata/entities/donationMetadata.entity.ts b/apps/api/src/domain/generated/donationMetadata/entities/donationMetadata.entity.ts index 8f79eae96..59e23cdb4 100644 --- a/apps/api/src/domain/generated/donationMetadata/entities/donationMetadata.entity.ts +++ b/apps/api/src/domain/generated/donationMetadata/entities/donationMetadata.entity.ts @@ -1,12 +1,10 @@ - -import {Prisma} from '@prisma/client' -import {Donation} from '../../donation/entities/donation.entity' - +import { Prisma } from '@prisma/client' +import { Donation } from '../../donation/entities/donation.entity' export class DonationMetadata { - donationId: string ; -name: string | null; -createdAt: Date ; -extraData: Prisma.JsonValue | null; -donation?: Donation ; + donationId: string + name: string | null + createdAt: Date + extraData: Prisma.JsonValue | null + donation?: Donation } diff --git a/apps/api/src/domain/generated/donationMetadata/entities/index.ts b/apps/api/src/domain/generated/donationMetadata/entities/index.ts index 3b0ebdaaa..c995d374a 100644 --- a/apps/api/src/domain/generated/donationMetadata/entities/index.ts +++ b/apps/api/src/domain/generated/donationMetadata/entities/index.ts @@ -1,2 +1 @@ - -export * from './donationMetadata.entity'; \ No newline at end of file +export * from './donationMetadata.entity' diff --git a/apps/api/src/domain/generated/donationWish/dto/connect-donationWish.dto.ts b/apps/api/src/domain/generated/donationWish/dto/connect-donationWish.dto.ts index 0a22fdacb..1db39f218 100644 --- a/apps/api/src/domain/generated/donationWish/dto/connect-donationWish.dto.ts +++ b/apps/api/src/domain/generated/donationWish/dto/connect-donationWish.dto.ts @@ -1,6 +1,4 @@ - - export class ConnectDonationWishDto { - id?: string; -donationId?: string; - } - \ No newline at end of file +export class ConnectDonationWishDto { + id?: string + donationId?: string +} diff --git a/apps/api/src/domain/generated/donationWish/dto/create-donationWish.dto.ts b/apps/api/src/domain/generated/donationWish/dto/create-donationWish.dto.ts index f3fb7a217..bb78bc42d 100644 --- a/apps/api/src/domain/generated/donationWish/dto/create-donationWish.dto.ts +++ b/apps/api/src/domain/generated/donationWish/dto/create-donationWish.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class CreateDonationWishDto { - message: string; + message: string } diff --git a/apps/api/src/domain/generated/donationWish/dto/index.ts b/apps/api/src/domain/generated/donationWish/dto/index.ts index 4f6533391..5e71d99de 100644 --- a/apps/api/src/domain/generated/donationWish/dto/index.ts +++ b/apps/api/src/domain/generated/donationWish/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-donationWish.dto'; -export * from './create-donationWish.dto'; -export * from './update-donationWish.dto'; \ No newline at end of file +export * from './connect-donationWish.dto' +export * from './create-donationWish.dto' +export * from './update-donationWish.dto' diff --git a/apps/api/src/domain/generated/donationWish/dto/update-donationWish.dto.ts b/apps/api/src/domain/generated/donationWish/dto/update-donationWish.dto.ts index e133cbbd2..ece50305f 100644 --- a/apps/api/src/domain/generated/donationWish/dto/update-donationWish.dto.ts +++ b/apps/api/src/domain/generated/donationWish/dto/update-donationWish.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class UpdateDonationWishDto { - message?: string; + message?: string } diff --git a/apps/api/src/domain/generated/donationWish/entities/donationWish.entity.ts b/apps/api/src/domain/generated/donationWish/entities/donationWish.entity.ts index 4eec6c75c..731ac8a43 100644 --- a/apps/api/src/domain/generated/donationWish/entities/donationWish.entity.ts +++ b/apps/api/src/domain/generated/donationWish/entities/donationWish.entity.ts @@ -1,18 +1,16 @@ - -import {Campaign} from '../../campaign/entities/campaign.entity' -import {Person} from '../../person/entities/person.entity' -import {Donation} from '../../donation/entities/donation.entity' - +import { Campaign } from '../../campaign/entities/campaign.entity' +import { Person } from '../../person/entities/person.entity' +import { Donation } from '../../donation/entities/donation.entity' export class DonationWish { - id: string ; -message: string ; -campaignId: string ; -personId: string | null; -donationId: string | null; -createdAt: Date ; -updatedAt: Date | null; -campaign?: Campaign ; -person?: Person | null; -donation?: Donation | null; + id: string + message: string + campaignId: string + personId: string | null + donationId: string | null + createdAt: Date + updatedAt: Date | null + campaign?: Campaign + person?: Person | null + donation?: Donation | null } diff --git a/apps/api/src/domain/generated/donationWish/entities/index.ts b/apps/api/src/domain/generated/donationWish/entities/index.ts index fb2d563dd..3603a8ab3 100644 --- a/apps/api/src/domain/generated/donationWish/entities/index.ts +++ b/apps/api/src/domain/generated/donationWish/entities/index.ts @@ -1,2 +1 @@ - -export * from './donationWish.entity'; \ No newline at end of file +export * from './donationWish.entity' diff --git a/apps/api/src/domain/generated/emailSentRegistry/dto/connect-emailSentRegistry.dto.ts b/apps/api/src/domain/generated/emailSentRegistry/dto/connect-emailSentRegistry.dto.ts index 1d7870fc8..72f1ce6c6 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/dto/connect-emailSentRegistry.dto.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/dto/connect-emailSentRegistry.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectEmailSentRegistryDto { - id: string; - } - \ No newline at end of file +export class ConnectEmailSentRegistryDto { + id: string +} diff --git a/apps/api/src/domain/generated/emailSentRegistry/dto/create-emailSentRegistry.dto.ts b/apps/api/src/domain/generated/emailSentRegistry/dto/create-emailSentRegistry.dto.ts index b4f5dd42b..2d33b5baa 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/dto/create-emailSentRegistry.dto.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/dto/create-emailSentRegistry.dto.ts @@ -1,14 +1,10 @@ - -import {EmailType} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { EmailType } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateEmailSentRegistryDto { - email: string; -dateSent: Date; -campaignId?: string; -@ApiProperty({ enum: EmailType}) -type: EmailType; + email: string + dateSent: Date + campaignId?: string + @ApiProperty({ enum: EmailType }) + type: EmailType } diff --git a/apps/api/src/domain/generated/emailSentRegistry/dto/index.ts b/apps/api/src/domain/generated/emailSentRegistry/dto/index.ts index 8fe532c07..c743ad0b8 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/dto/index.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-emailSentRegistry.dto'; -export * from './create-emailSentRegistry.dto'; -export * from './update-emailSentRegistry.dto'; \ No newline at end of file +export * from './connect-emailSentRegistry.dto' +export * from './create-emailSentRegistry.dto' +export * from './update-emailSentRegistry.dto' diff --git a/apps/api/src/domain/generated/emailSentRegistry/dto/update-emailSentRegistry.dto.ts b/apps/api/src/domain/generated/emailSentRegistry/dto/update-emailSentRegistry.dto.ts index 773e9209f..744d93257 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/dto/update-emailSentRegistry.dto.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/dto/update-emailSentRegistry.dto.ts @@ -1,14 +1,10 @@ - -import {EmailType} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { EmailType } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateEmailSentRegistryDto { - email?: string; -dateSent?: Date; -campaignId?: string; -@ApiProperty({ enum: EmailType}) -type?: EmailType; + email?: string + dateSent?: Date + campaignId?: string + @ApiProperty({ enum: EmailType }) + type?: EmailType } diff --git a/apps/api/src/domain/generated/emailSentRegistry/entities/emailSentRegistry.entity.ts b/apps/api/src/domain/generated/emailSentRegistry/entities/emailSentRegistry.entity.ts index 7881993d7..c936a22ec 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/entities/emailSentRegistry.entity.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/entities/emailSentRegistry.entity.ts @@ -1,11 +1,9 @@ - -import {EmailType} from '@prisma/client' - +import { EmailType } from '@prisma/client' export class EmailSentRegistry { - id: string ; -email: string ; -dateSent: Date ; -campaignId: string | null; -type: EmailType ; + id: string + email: string + dateSent: Date + campaignId: string | null + type: EmailType } diff --git a/apps/api/src/domain/generated/emailSentRegistry/entities/index.ts b/apps/api/src/domain/generated/emailSentRegistry/entities/index.ts index 69bf03d76..99aa635b9 100644 --- a/apps/api/src/domain/generated/emailSentRegistry/entities/index.ts +++ b/apps/api/src/domain/generated/emailSentRegistry/entities/index.ts @@ -1,2 +1 @@ - -export * from './emailSentRegistry.entity'; \ No newline at end of file +export * from './emailSentRegistry.entity' diff --git a/apps/api/src/domain/generated/expense/dto/connect-expense.dto.ts b/apps/api/src/domain/generated/expense/dto/connect-expense.dto.ts index 765441b8b..232d459d5 100644 --- a/apps/api/src/domain/generated/expense/dto/connect-expense.dto.ts +++ b/apps/api/src/domain/generated/expense/dto/connect-expense.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectExpenseDto { - id: string; - } - \ No newline at end of file +export class ConnectExpenseDto { + id: string +} diff --git a/apps/api/src/domain/generated/expense/dto/create-expense.dto.ts b/apps/api/src/domain/generated/expense/dto/create-expense.dto.ts index 44a9d9fbd..f5dbe6346 100644 --- a/apps/api/src/domain/generated/expense/dto/create-expense.dto.ts +++ b/apps/api/src/domain/generated/expense/dto/create-expense.dto.ts @@ -1,14 +1,10 @@ - -import {ExpenseType,ExpenseStatus} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { ExpenseType, ExpenseStatus } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateExpenseDto { - @ApiProperty({ enum: ExpenseType}) -type: ExpenseType; -description?: string; -@ApiProperty({ enum: ExpenseStatus}) -status: ExpenseStatus; + @ApiProperty({ enum: ExpenseType }) + type: ExpenseType + description?: string + @ApiProperty({ enum: ExpenseStatus }) + status: ExpenseStatus } diff --git a/apps/api/src/domain/generated/expense/dto/index.ts b/apps/api/src/domain/generated/expense/dto/index.ts index 6271ca029..a83042912 100644 --- a/apps/api/src/domain/generated/expense/dto/index.ts +++ b/apps/api/src/domain/generated/expense/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-expense.dto'; -export * from './create-expense.dto'; -export * from './update-expense.dto'; \ No newline at end of file +export * from './connect-expense.dto' +export * from './create-expense.dto' +export * from './update-expense.dto' diff --git a/apps/api/src/domain/generated/expense/dto/update-expense.dto.ts b/apps/api/src/domain/generated/expense/dto/update-expense.dto.ts index 48031311e..0cb9cfdcb 100644 --- a/apps/api/src/domain/generated/expense/dto/update-expense.dto.ts +++ b/apps/api/src/domain/generated/expense/dto/update-expense.dto.ts @@ -1,14 +1,10 @@ - -import {ExpenseType,ExpenseStatus} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { ExpenseType, ExpenseStatus } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateExpenseDto { - @ApiProperty({ enum: ExpenseType}) -type?: ExpenseType; -description?: string; -@ApiProperty({ enum: ExpenseStatus}) -status?: ExpenseStatus; + @ApiProperty({ enum: ExpenseType }) + type?: ExpenseType + description?: string + @ApiProperty({ enum: ExpenseStatus }) + status?: ExpenseStatus } diff --git a/apps/api/src/domain/generated/expense/entities/expense.entity.ts b/apps/api/src/domain/generated/expense/entities/expense.entity.ts index 984046039..26750219b 100644 --- a/apps/api/src/domain/generated/expense/entities/expense.entity.ts +++ b/apps/api/src/domain/generated/expense/entities/expense.entity.ts @@ -1,25 +1,23 @@ - -import {ExpenseType,Currency,ExpenseStatus} from '@prisma/client' -import {Person} from '../../person/entities/person.entity' -import {Document} from '../../document/entities/document.entity' -import {Vault} from '../../vault/entities/vault.entity' -import {ExpenseFile} from '../../expenseFile/entities/expenseFile.entity' - +import { ExpenseType, Currency, ExpenseStatus } from '@prisma/client' +import { Person } from '../../person/entities/person.entity' +import { Document } from '../../document/entities/document.entity' +import { Vault } from '../../vault/entities/vault.entity' +import { ExpenseFile } from '../../expenseFile/entities/expenseFile.entity' export class Expense { - id: string ; -type: ExpenseType ; -description: string | null; -vaultId: string ; -documentId: string | null; -approvedById: string | null; -amount: number ; -currency: Currency ; -status: ExpenseStatus ; -deleted: boolean ; -approvedBy?: Person | null; -document?: Document | null; -vault?: Vault ; -spentAt: Date ; -expenseFiles?: ExpenseFile[] ; + id: string + type: ExpenseType + description: string | null + vaultId: string + documentId: string | null + approvedById: string | null + amount: number + currency: Currency + status: ExpenseStatus + deleted: boolean + approvedBy?: Person | null + document?: Document | null + vault?: Vault + spentAt: Date + expenseFiles?: ExpenseFile[] } diff --git a/apps/api/src/domain/generated/expense/entities/index.ts b/apps/api/src/domain/generated/expense/entities/index.ts index 3ff675058..92a38afcb 100644 --- a/apps/api/src/domain/generated/expense/entities/index.ts +++ b/apps/api/src/domain/generated/expense/entities/index.ts @@ -1,2 +1 @@ - -export * from './expense.entity'; \ No newline at end of file +export * from './expense.entity' diff --git a/apps/api/src/domain/generated/expenseFile/dto/connect-expenseFile.dto.ts b/apps/api/src/domain/generated/expenseFile/dto/connect-expenseFile.dto.ts index fca306f4f..87147ce4c 100644 --- a/apps/api/src/domain/generated/expenseFile/dto/connect-expenseFile.dto.ts +++ b/apps/api/src/domain/generated/expenseFile/dto/connect-expenseFile.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectExpenseFileDto { - id: string; - } - \ No newline at end of file +export class ConnectExpenseFileDto { + id: string +} diff --git a/apps/api/src/domain/generated/expenseFile/dto/create-expenseFile.dto.ts b/apps/api/src/domain/generated/expenseFile/dto/create-expenseFile.dto.ts index ad2ab5fc1..d9dd8ba14 100644 --- a/apps/api/src/domain/generated/expenseFile/dto/create-expenseFile.dto.ts +++ b/apps/api/src/domain/generated/expenseFile/dto/create-expenseFile.dto.ts @@ -1,10 +1,4 @@ - - - - - - export class CreateExpenseFileDto { - filename: string; -mimetype: string; + filename: string + mimetype: string } diff --git a/apps/api/src/domain/generated/expenseFile/dto/index.ts b/apps/api/src/domain/generated/expenseFile/dto/index.ts index 2ad77b2a2..7020f5a00 100644 --- a/apps/api/src/domain/generated/expenseFile/dto/index.ts +++ b/apps/api/src/domain/generated/expenseFile/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-expenseFile.dto'; -export * from './create-expenseFile.dto'; -export * from './update-expenseFile.dto'; \ No newline at end of file +export * from './connect-expenseFile.dto' +export * from './create-expenseFile.dto' +export * from './update-expenseFile.dto' diff --git a/apps/api/src/domain/generated/expenseFile/dto/update-expenseFile.dto.ts b/apps/api/src/domain/generated/expenseFile/dto/update-expenseFile.dto.ts index f85781276..5d6db6363 100644 --- a/apps/api/src/domain/generated/expenseFile/dto/update-expenseFile.dto.ts +++ b/apps/api/src/domain/generated/expenseFile/dto/update-expenseFile.dto.ts @@ -1,10 +1,4 @@ - - - - - - export class UpdateExpenseFileDto { - filename?: string; -mimetype?: string; + filename?: string + mimetype?: string } diff --git a/apps/api/src/domain/generated/expenseFile/entities/expenseFile.entity.ts b/apps/api/src/domain/generated/expenseFile/entities/expenseFile.entity.ts index 822a1c151..325054eb7 100644 --- a/apps/api/src/domain/generated/expenseFile/entities/expenseFile.entity.ts +++ b/apps/api/src/domain/generated/expenseFile/entities/expenseFile.entity.ts @@ -1,14 +1,12 @@ - -import {Expense} from '../../expense/entities/expense.entity' -import {Person} from '../../person/entities/person.entity' - +import { Expense } from '../../expense/entities/expense.entity' +import { Person } from '../../person/entities/person.entity' export class ExpenseFile { - id: string ; -filename: string ; -mimetype: string ; -expenseId: string ; -uploaderId: string ; -expense?: Expense ; -uploadedBy?: Person ; + id: string + filename: string + mimetype: string + expenseId: string + uploaderId: string + expense?: Expense + uploadedBy?: Person } diff --git a/apps/api/src/domain/generated/expenseFile/entities/index.ts b/apps/api/src/domain/generated/expenseFile/entities/index.ts index e86acc0e4..61115da08 100644 --- a/apps/api/src/domain/generated/expenseFile/entities/index.ts +++ b/apps/api/src/domain/generated/expenseFile/entities/index.ts @@ -1,2 +1 @@ - -export * from './expenseFile.entity'; \ No newline at end of file +export * from './expenseFile.entity' diff --git a/apps/api/src/domain/generated/infoRequest/dto/connect-infoRequest.dto.ts b/apps/api/src/domain/generated/infoRequest/dto/connect-infoRequest.dto.ts index b0f67d810..6f64361bf 100644 --- a/apps/api/src/domain/generated/infoRequest/dto/connect-infoRequest.dto.ts +++ b/apps/api/src/domain/generated/infoRequest/dto/connect-infoRequest.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectInfoRequestDto { - id: string; - } - \ No newline at end of file +export class ConnectInfoRequestDto { + id: string +} diff --git a/apps/api/src/domain/generated/infoRequest/dto/create-infoRequest.dto.ts b/apps/api/src/domain/generated/infoRequest/dto/create-infoRequest.dto.ts index 36ea6f3ca..0fb8b87ae 100644 --- a/apps/api/src/domain/generated/infoRequest/dto/create-infoRequest.dto.ts +++ b/apps/api/src/domain/generated/infoRequest/dto/create-infoRequest.dto.ts @@ -1,10 +1,4 @@ - - - - - - export class CreateInfoRequestDto { - message: string; -deletedAt?: Date; + message: string + deletedAt?: Date } diff --git a/apps/api/src/domain/generated/infoRequest/dto/index.ts b/apps/api/src/domain/generated/infoRequest/dto/index.ts index f51868edf..5ed53ece6 100644 --- a/apps/api/src/domain/generated/infoRequest/dto/index.ts +++ b/apps/api/src/domain/generated/infoRequest/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-infoRequest.dto'; -export * from './create-infoRequest.dto'; -export * from './update-infoRequest.dto'; \ No newline at end of file +export * from './connect-infoRequest.dto' +export * from './create-infoRequest.dto' +export * from './update-infoRequest.dto' diff --git a/apps/api/src/domain/generated/infoRequest/dto/update-infoRequest.dto.ts b/apps/api/src/domain/generated/infoRequest/dto/update-infoRequest.dto.ts index 3e3bafbd5..591f3cfb9 100644 --- a/apps/api/src/domain/generated/infoRequest/dto/update-infoRequest.dto.ts +++ b/apps/api/src/domain/generated/infoRequest/dto/update-infoRequest.dto.ts @@ -1,10 +1,4 @@ - - - - - - export class UpdateInfoRequestDto { - message?: string; -deletedAt?: Date; + message?: string + deletedAt?: Date } diff --git a/apps/api/src/domain/generated/infoRequest/entities/index.ts b/apps/api/src/domain/generated/infoRequest/entities/index.ts index ed02c039a..86407b245 100644 --- a/apps/api/src/domain/generated/infoRequest/entities/index.ts +++ b/apps/api/src/domain/generated/infoRequest/entities/index.ts @@ -1,2 +1 @@ - -export * from './infoRequest.entity'; \ No newline at end of file +export * from './infoRequest.entity' diff --git a/apps/api/src/domain/generated/infoRequest/entities/infoRequest.entity.ts b/apps/api/src/domain/generated/infoRequest/entities/infoRequest.entity.ts index a4bf957dd..310939146 100644 --- a/apps/api/src/domain/generated/infoRequest/entities/infoRequest.entity.ts +++ b/apps/api/src/domain/generated/infoRequest/entities/infoRequest.entity.ts @@ -1,13 +1,11 @@ - -import {Person} from '../../person/entities/person.entity' - +import { Person } from '../../person/entities/person.entity' export class InfoRequest { - id: string ; -personId: string ; -message: string ; -createdAt: Date ; -updatedAt: Date | null; -deletedAt: Date | null; -person?: Person ; + id: string + personId: string + message: string + createdAt: Date + updatedAt: Date | null + deletedAt: Date | null + person?: Person } diff --git a/apps/api/src/domain/generated/irregularity/dto/connect-irregularity.dto.ts b/apps/api/src/domain/generated/irregularity/dto/connect-irregularity.dto.ts index 6d38ef2fb..2de4c0e8b 100644 --- a/apps/api/src/domain/generated/irregularity/dto/connect-irregularity.dto.ts +++ b/apps/api/src/domain/generated/irregularity/dto/connect-irregularity.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectIrregularityDto { - id: string; - } - \ No newline at end of file +export class ConnectIrregularityDto { + id: string +} diff --git a/apps/api/src/domain/generated/irregularity/dto/create-irregularity.dto.ts b/apps/api/src/domain/generated/irregularity/dto/create-irregularity.dto.ts index 3d4740615..08f2f775f 100644 --- a/apps/api/src/domain/generated/irregularity/dto/create-irregularity.dto.ts +++ b/apps/api/src/domain/generated/irregularity/dto/create-irregularity.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class CreateIrregularityDto { - description: string; + description: string } diff --git a/apps/api/src/domain/generated/irregularity/dto/index.ts b/apps/api/src/domain/generated/irregularity/dto/index.ts index 4e164346b..b8b329e0e 100644 --- a/apps/api/src/domain/generated/irregularity/dto/index.ts +++ b/apps/api/src/domain/generated/irregularity/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-irregularity.dto'; -export * from './create-irregularity.dto'; -export * from './update-irregularity.dto'; \ No newline at end of file +export * from './connect-irregularity.dto' +export * from './create-irregularity.dto' +export * from './update-irregularity.dto' diff --git a/apps/api/src/domain/generated/irregularity/dto/update-irregularity.dto.ts b/apps/api/src/domain/generated/irregularity/dto/update-irregularity.dto.ts index 078567749..fbc3856e1 100644 --- a/apps/api/src/domain/generated/irregularity/dto/update-irregularity.dto.ts +++ b/apps/api/src/domain/generated/irregularity/dto/update-irregularity.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class UpdateIrregularityDto { - description?: string; + description?: string } diff --git a/apps/api/src/domain/generated/irregularity/entities/index.ts b/apps/api/src/domain/generated/irregularity/entities/index.ts index 27e5f7ffa..0a00f6ec4 100644 --- a/apps/api/src/domain/generated/irregularity/entities/index.ts +++ b/apps/api/src/domain/generated/irregularity/entities/index.ts @@ -1,2 +1 @@ - -export * from './irregularity.entity'; \ No newline at end of file +export * from './irregularity.entity' diff --git a/apps/api/src/domain/generated/irregularity/entities/irregularity.entity.ts b/apps/api/src/domain/generated/irregularity/entities/irregularity.entity.ts index 816a28d3f..f08e89a79 100644 --- a/apps/api/src/domain/generated/irregularity/entities/irregularity.entity.ts +++ b/apps/api/src/domain/generated/irregularity/entities/irregularity.entity.ts @@ -1,21 +1,19 @@ - -import {IrregularityStatus,IrregularityReason,NotifierType} from '@prisma/client' -import {Campaign} from '../../campaign/entities/campaign.entity' -import {Person} from '../../person/entities/person.entity' -import {IrregularityFile} from '../../irregularityFile/entities/irregularityFile.entity' - +import { IrregularityStatus, IrregularityReason, NotifierType } from '@prisma/client' +import { Campaign } from '../../campaign/entities/campaign.entity' +import { Person } from '../../person/entities/person.entity' +import { IrregularityFile } from '../../irregularityFile/entities/irregularityFile.entity' export class Irregularity { - id: string ; -campaignId: string ; -personId: string ; -createdAt: Date ; -updatedAt: Date | null; -status: IrregularityStatus ; -reason: IrregularityReason ; -description: string ; -notifierType: NotifierType ; -campaign?: Campaign ; -person?: Person ; -files?: IrregularityFile[] ; + id: string + campaignId: string + personId: string + createdAt: Date + updatedAt: Date | null + status: IrregularityStatus + reason: IrregularityReason + description: string + notifierType: NotifierType + campaign?: Campaign + person?: Person + files?: IrregularityFile[] } diff --git a/apps/api/src/domain/generated/irregularityFile/dto/connect-irregularityFile.dto.ts b/apps/api/src/domain/generated/irregularityFile/dto/connect-irregularityFile.dto.ts index 7204df495..cb3ce82fc 100644 --- a/apps/api/src/domain/generated/irregularityFile/dto/connect-irregularityFile.dto.ts +++ b/apps/api/src/domain/generated/irregularityFile/dto/connect-irregularityFile.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectIrregularityFileDto { - id: string; - } - \ No newline at end of file +export class ConnectIrregularityFileDto { + id: string +} diff --git a/apps/api/src/domain/generated/irregularityFile/dto/create-irregularityFile.dto.ts b/apps/api/src/domain/generated/irregularityFile/dto/create-irregularityFile.dto.ts index ca6f20e8e..c14303b3f 100644 --- a/apps/api/src/domain/generated/irregularityFile/dto/create-irregularityFile.dto.ts +++ b/apps/api/src/domain/generated/irregularityFile/dto/create-irregularityFile.dto.ts @@ -1,10 +1,4 @@ - - - - - - export class CreateIrregularityFileDto { - filename: string; -mimetype: string; + filename: string + mimetype: string } diff --git a/apps/api/src/domain/generated/irregularityFile/dto/index.ts b/apps/api/src/domain/generated/irregularityFile/dto/index.ts index c001d3b5b..b45d1392e 100644 --- a/apps/api/src/domain/generated/irregularityFile/dto/index.ts +++ b/apps/api/src/domain/generated/irregularityFile/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-irregularityFile.dto'; -export * from './create-irregularityFile.dto'; -export * from './update-irregularityFile.dto'; \ No newline at end of file +export * from './connect-irregularityFile.dto' +export * from './create-irregularityFile.dto' +export * from './update-irregularityFile.dto' diff --git a/apps/api/src/domain/generated/irregularityFile/dto/update-irregularityFile.dto.ts b/apps/api/src/domain/generated/irregularityFile/dto/update-irregularityFile.dto.ts index e43884a7d..22d768766 100644 --- a/apps/api/src/domain/generated/irregularityFile/dto/update-irregularityFile.dto.ts +++ b/apps/api/src/domain/generated/irregularityFile/dto/update-irregularityFile.dto.ts @@ -1,10 +1,4 @@ - - - - - - export class UpdateIrregularityFileDto { - filename?: string; -mimetype?: string; + filename?: string + mimetype?: string } diff --git a/apps/api/src/domain/generated/irregularityFile/entities/index.ts b/apps/api/src/domain/generated/irregularityFile/entities/index.ts index 95ce5229f..9bba8bd90 100644 --- a/apps/api/src/domain/generated/irregularityFile/entities/index.ts +++ b/apps/api/src/domain/generated/irregularityFile/entities/index.ts @@ -1,2 +1 @@ - -export * from './irregularityFile.entity'; \ No newline at end of file +export * from './irregularityFile.entity' diff --git a/apps/api/src/domain/generated/irregularityFile/entities/irregularityFile.entity.ts b/apps/api/src/domain/generated/irregularityFile/entities/irregularityFile.entity.ts index 58cc1e972..27eca21f7 100644 --- a/apps/api/src/domain/generated/irregularityFile/entities/irregularityFile.entity.ts +++ b/apps/api/src/domain/generated/irregularityFile/entities/irregularityFile.entity.ts @@ -1,14 +1,12 @@ - -import {Irregularity} from '../../irregularity/entities/irregularity.entity' -import {Person} from '../../person/entities/person.entity' - +import { Irregularity } from '../../irregularity/entities/irregularity.entity' +import { Person } from '../../person/entities/person.entity' export class IrregularityFile { - id: string ; -filename: string ; -mimetype: string ; -irregularityId: string ; -uploaderId: string ; -irregularity?: Irregularity ; -uploadedBy?: Person ; + id: string + filename: string + mimetype: string + irregularityId: string + uploaderId: string + irregularity?: Irregularity + uploadedBy?: Person } diff --git a/apps/api/src/domain/generated/marketingTemplates/dto/connect-marketingTemplates.dto.ts b/apps/api/src/domain/generated/marketingTemplates/dto/connect-marketingTemplates.dto.ts index 910b6c9a5..bcc941c0c 100644 --- a/apps/api/src/domain/generated/marketingTemplates/dto/connect-marketingTemplates.dto.ts +++ b/apps/api/src/domain/generated/marketingTemplates/dto/connect-marketingTemplates.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectMarketingTemplatesDto { - id: string; - } - \ No newline at end of file +export class ConnectMarketingTemplatesDto { + id: string +} diff --git a/apps/api/src/domain/generated/marketingTemplates/dto/create-marketingTemplates.dto.ts b/apps/api/src/domain/generated/marketingTemplates/dto/create-marketingTemplates.dto.ts index 5767a4657..8310e9b1b 100644 --- a/apps/api/src/domain/generated/marketingTemplates/dto/create-marketingTemplates.dto.ts +++ b/apps/api/src/domain/generated/marketingTemplates/dto/create-marketingTemplates.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class CreateMarketingTemplatesDto { - name?: string; + name?: string } diff --git a/apps/api/src/domain/generated/marketingTemplates/dto/index.ts b/apps/api/src/domain/generated/marketingTemplates/dto/index.ts index af827e5fb..621f172cb 100644 --- a/apps/api/src/domain/generated/marketingTemplates/dto/index.ts +++ b/apps/api/src/domain/generated/marketingTemplates/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-marketingTemplates.dto'; -export * from './create-marketingTemplates.dto'; -export * from './update-marketingTemplates.dto'; \ No newline at end of file +export * from './connect-marketingTemplates.dto' +export * from './create-marketingTemplates.dto' +export * from './update-marketingTemplates.dto' diff --git a/apps/api/src/domain/generated/marketingTemplates/dto/update-marketingTemplates.dto.ts b/apps/api/src/domain/generated/marketingTemplates/dto/update-marketingTemplates.dto.ts index 4a6b8b140..fa84f793f 100644 --- a/apps/api/src/domain/generated/marketingTemplates/dto/update-marketingTemplates.dto.ts +++ b/apps/api/src/domain/generated/marketingTemplates/dto/update-marketingTemplates.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class UpdateMarketingTemplatesDto { - name?: string; + name?: string } diff --git a/apps/api/src/domain/generated/marketingTemplates/entities/index.ts b/apps/api/src/domain/generated/marketingTemplates/entities/index.ts index 58b078804..a9bdf5ee6 100644 --- a/apps/api/src/domain/generated/marketingTemplates/entities/index.ts +++ b/apps/api/src/domain/generated/marketingTemplates/entities/index.ts @@ -1,2 +1 @@ - -export * from './marketingTemplates.entity'; \ No newline at end of file +export * from './marketingTemplates.entity' diff --git a/apps/api/src/domain/generated/marketingTemplates/entities/marketingTemplates.entity.ts b/apps/api/src/domain/generated/marketingTemplates/entities/marketingTemplates.entity.ts index 7372d7851..4d7dbad23 100644 --- a/apps/api/src/domain/generated/marketingTemplates/entities/marketingTemplates.entity.ts +++ b/apps/api/src/domain/generated/marketingTemplates/entities/marketingTemplates.entity.ts @@ -1,8 +1,4 @@ - - - - export class MarketingTemplates { - id: string ; -name: string | null; + id: string + name: string | null } diff --git a/apps/api/src/domain/generated/notificationList/dto/connect-notificationList.dto.ts b/apps/api/src/domain/generated/notificationList/dto/connect-notificationList.dto.ts index 29dd92148..f20cfc90e 100644 --- a/apps/api/src/domain/generated/notificationList/dto/connect-notificationList.dto.ts +++ b/apps/api/src/domain/generated/notificationList/dto/connect-notificationList.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectNotificationListDto { - id: string; - } - \ No newline at end of file +export class ConnectNotificationListDto { + id: string +} diff --git a/apps/api/src/domain/generated/notificationList/dto/create-notificationList.dto.ts b/apps/api/src/domain/generated/notificationList/dto/create-notificationList.dto.ts index 565dff201..9cb19eed4 100644 --- a/apps/api/src/domain/generated/notificationList/dto/create-notificationList.dto.ts +++ b/apps/api/src/domain/generated/notificationList/dto/create-notificationList.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class CreateNotificationListDto { - name?: string; + name?: string } diff --git a/apps/api/src/domain/generated/notificationList/dto/index.ts b/apps/api/src/domain/generated/notificationList/dto/index.ts index 234cf6bf8..4e5cb6306 100644 --- a/apps/api/src/domain/generated/notificationList/dto/index.ts +++ b/apps/api/src/domain/generated/notificationList/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-notificationList.dto'; -export * from './create-notificationList.dto'; -export * from './update-notificationList.dto'; \ No newline at end of file +export * from './connect-notificationList.dto' +export * from './create-notificationList.dto' +export * from './update-notificationList.dto' diff --git a/apps/api/src/domain/generated/notificationList/dto/update-notificationList.dto.ts b/apps/api/src/domain/generated/notificationList/dto/update-notificationList.dto.ts index b795511ce..b77c0d362 100644 --- a/apps/api/src/domain/generated/notificationList/dto/update-notificationList.dto.ts +++ b/apps/api/src/domain/generated/notificationList/dto/update-notificationList.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class UpdateNotificationListDto { - name?: string; + name?: string } diff --git a/apps/api/src/domain/generated/notificationList/entities/index.ts b/apps/api/src/domain/generated/notificationList/entities/index.ts index f0a6fba3e..44f8d2805 100644 --- a/apps/api/src/domain/generated/notificationList/entities/index.ts +++ b/apps/api/src/domain/generated/notificationList/entities/index.ts @@ -1,2 +1 @@ - -export * from './notificationList.entity'; \ No newline at end of file +export * from './notificationList.entity' diff --git a/apps/api/src/domain/generated/notificationList/entities/notificationList.entity.ts b/apps/api/src/domain/generated/notificationList/entities/notificationList.entity.ts index 01c02af0d..4164094a5 100644 --- a/apps/api/src/domain/generated/notificationList/entities/notificationList.entity.ts +++ b/apps/api/src/domain/generated/notificationList/entities/notificationList.entity.ts @@ -1,10 +1,8 @@ - -import {Campaign} from '../../campaign/entities/campaign.entity' - +import { Campaign } from '../../campaign/entities/campaign.entity' export class NotificationList { - id: string ; -campaignId: string ; -name: string | null; -campaign?: Campaign ; + id: string + campaignId: string + name: string | null + campaign?: Campaign } diff --git a/apps/api/src/domain/generated/organizer/dto/connect-organizer.dto.ts b/apps/api/src/domain/generated/organizer/dto/connect-organizer.dto.ts index e76265e8d..0912ea81b 100644 --- a/apps/api/src/domain/generated/organizer/dto/connect-organizer.dto.ts +++ b/apps/api/src/domain/generated/organizer/dto/connect-organizer.dto.ts @@ -1,6 +1,4 @@ - - export class ConnectOrganizerDto { - id?: string; -personId?: string; - } - \ No newline at end of file +export class ConnectOrganizerDto { + id?: string + personId?: string +} diff --git a/apps/api/src/domain/generated/organizer/dto/create-organizer.dto.ts b/apps/api/src/domain/generated/organizer/dto/create-organizer.dto.ts index c73a10796..a64aa07d6 100644 --- a/apps/api/src/domain/generated/organizer/dto/create-organizer.dto.ts +++ b/apps/api/src/domain/generated/organizer/dto/create-organizer.dto.ts @@ -1,9 +1 @@ - - - - - - -export class CreateOrganizerDto { - -} +export class CreateOrganizerDto {} diff --git a/apps/api/src/domain/generated/organizer/dto/index.ts b/apps/api/src/domain/generated/organizer/dto/index.ts index 9d5057716..488fe3a2f 100644 --- a/apps/api/src/domain/generated/organizer/dto/index.ts +++ b/apps/api/src/domain/generated/organizer/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-organizer.dto'; -export * from './create-organizer.dto'; -export * from './update-organizer.dto'; \ No newline at end of file +export * from './connect-organizer.dto' +export * from './create-organizer.dto' +export * from './update-organizer.dto' diff --git a/apps/api/src/domain/generated/organizer/dto/update-organizer.dto.ts b/apps/api/src/domain/generated/organizer/dto/update-organizer.dto.ts index db8e6fa3f..b334c4f2f 100644 --- a/apps/api/src/domain/generated/organizer/dto/update-organizer.dto.ts +++ b/apps/api/src/domain/generated/organizer/dto/update-organizer.dto.ts @@ -1,9 +1 @@ - - - - - - -export class UpdateOrganizerDto { - -} +export class UpdateOrganizerDto {} diff --git a/apps/api/src/domain/generated/organizer/entities/index.ts b/apps/api/src/domain/generated/organizer/entities/index.ts index 38cb2c301..4df8a09c3 100644 --- a/apps/api/src/domain/generated/organizer/entities/index.ts +++ b/apps/api/src/domain/generated/organizer/entities/index.ts @@ -1,2 +1 @@ - -export * from './organizer.entity'; \ No newline at end of file +export * from './organizer.entity' diff --git a/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts b/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts index c9aa03e4e..0380fd930 100644 --- a/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts +++ b/apps/api/src/domain/generated/organizer/entities/organizer.entity.ts @@ -1,15 +1,13 @@ - -import {Person} from '../../person/entities/person.entity' -import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' -import {Campaign} from '../../campaign/entities/campaign.entity' - +import { Person } from '../../person/entities/person.entity' +import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' +import { Campaign } from '../../campaign/entities/campaign.entity' export class Organizer { - id: string ; -personId: string ; -createdAt: Date ; -updatedAt: Date | null; -person?: Person ; -beneficiaries?: Beneficiary[] ; -campaigns?: Campaign[] ; + id: string + personId: string + createdAt: Date + updatedAt: Date | null + person?: Person + beneficiaries?: Beneficiary[] + campaigns?: Campaign[] } diff --git a/apps/api/src/domain/generated/person/dto/connect-person.dto.ts b/apps/api/src/domain/generated/person/dto/connect-person.dto.ts index ed4bd668e..cf8af9224 100644 --- a/apps/api/src/domain/generated/person/dto/connect-person.dto.ts +++ b/apps/api/src/domain/generated/person/dto/connect-person.dto.ts @@ -1,10 +1,8 @@ - - export class ConnectPersonDto { - id?: string; -email?: string; -personalNumber?: string; -companyId?: string; -keycloakId?: string; -stripeCustomerId?: string; - } - \ No newline at end of file +export class ConnectPersonDto { + id?: string + email?: string + personalNumber?: string + companyId?: string + keycloakId?: string + stripeCustomerId?: string +} diff --git a/apps/api/src/domain/generated/person/dto/create-person.dto.ts b/apps/api/src/domain/generated/person/dto/create-person.dto.ts index ab6a7ef8c..d96ba291e 100644 --- a/apps/api/src/domain/generated/person/dto/create-person.dto.ts +++ b/apps/api/src/domain/generated/person/dto/create-person.dto.ts @@ -1,20 +1,14 @@ - - - - - - export class CreatePersonDto { - firstName: string; -lastName: string; -email?: string; -phone?: string; -newsletter?: boolean; -address?: string; -birthday?: Date; -emailConfirmed?: boolean; -personalNumber?: string; -keycloakId?: string; -stripeCustomerId?: string; -picture?: string; + firstName: string + lastName: string + email?: string + phone?: string + newsletter?: boolean + address?: string + birthday?: Date + emailConfirmed?: boolean + personalNumber?: string + keycloakId?: string + stripeCustomerId?: string + picture?: string } diff --git a/apps/api/src/domain/generated/person/dto/index.ts b/apps/api/src/domain/generated/person/dto/index.ts index 7dba19b87..bfa27bbeb 100644 --- a/apps/api/src/domain/generated/person/dto/index.ts +++ b/apps/api/src/domain/generated/person/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-person.dto'; -export * from './create-person.dto'; -export * from './update-person.dto'; \ No newline at end of file +export * from './connect-person.dto' +export * from './create-person.dto' +export * from './update-person.dto' diff --git a/apps/api/src/domain/generated/person/dto/update-person.dto.ts b/apps/api/src/domain/generated/person/dto/update-person.dto.ts index 32a5db863..b171e7db8 100644 --- a/apps/api/src/domain/generated/person/dto/update-person.dto.ts +++ b/apps/api/src/domain/generated/person/dto/update-person.dto.ts @@ -1,20 +1,14 @@ - - - - - - export class UpdatePersonDto { - firstName?: string; -lastName?: string; -email?: string; -phone?: string; -newsletter?: boolean; -address?: string; -birthday?: Date; -emailConfirmed?: boolean; -personalNumber?: string; -keycloakId?: string; -stripeCustomerId?: string; -picture?: string; + firstName?: string + lastName?: string + email?: string + phone?: string + newsletter?: boolean + address?: string + birthday?: Date + emailConfirmed?: boolean + personalNumber?: string + keycloakId?: string + stripeCustomerId?: string + picture?: string } diff --git a/apps/api/src/domain/generated/person/entities/index.ts b/apps/api/src/domain/generated/person/entities/index.ts index ec47361d3..5b9ca3f82 100644 --- a/apps/api/src/domain/generated/person/entities/index.ts +++ b/apps/api/src/domain/generated/person/entities/index.ts @@ -1,2 +1 @@ - -export * from './person.entity'; \ No newline at end of file +export * from './person.entity' diff --git a/apps/api/src/domain/generated/person/entities/person.entity.ts b/apps/api/src/domain/generated/person/entities/person.entity.ts index 1a1d2149d..fa0e3872a 100644 --- a/apps/api/src/domain/generated/person/entities/person.entity.ts +++ b/apps/api/src/domain/generated/person/entities/person.entity.ts @@ -1,64 +1,62 @@ - -import {Benefactor} from '../../benefactor/entities/benefactor.entity' -import {Beneficiary} from '../../beneficiary/entities/beneficiary.entity' -import {CampaignFile} from '../../campaignFile/entities/campaignFile.entity' -import {Campaign} from '../../campaign/entities/campaign.entity' -import {Coordinator} from '../../coordinator/entities/coordinator.entity' -import {Document} from '../../document/entities/document.entity' -import {DonationWish} from '../../donationWish/entities/donationWish.entity' -import {Donation} from '../../donation/entities/donation.entity' -import {Expense} from '../../expense/entities/expense.entity' -import {InfoRequest} from '../../infoRequest/entities/infoRequest.entity' -import {Irregularity} from '../../irregularity/entities/irregularity.entity' -import {IrregularityFile} from '../../irregularityFile/entities/irregularityFile.entity' -import {ExpenseFile} from '../../expenseFile/entities/expenseFile.entity' -import {Organizer} from '../../organizer/entities/organizer.entity' -import {RecurringDonation} from '../../recurringDonation/entities/recurringDonation.entity' -import {Supporter} from '../../supporter/entities/supporter.entity' -import {Transfer} from '../../transfer/entities/transfer.entity' -import {Withdrawal} from '../../withdrawal/entities/withdrawal.entity' -import {CampaignNews} from '../../campaignNews/entities/campaignNews.entity' -import {CampaignNewsFile} from '../../campaignNewsFile/entities/campaignNewsFile.entity' -import {Company} from '../../company/entities/company.entity' - +import { Benefactor } from '../../benefactor/entities/benefactor.entity' +import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' +import { CampaignFile } from '../../campaignFile/entities/campaignFile.entity' +import { Campaign } from '../../campaign/entities/campaign.entity' +import { Coordinator } from '../../coordinator/entities/coordinator.entity' +import { Document } from '../../document/entities/document.entity' +import { DonationWish } from '../../donationWish/entities/donationWish.entity' +import { Donation } from '../../donation/entities/donation.entity' +import { Expense } from '../../expense/entities/expense.entity' +import { InfoRequest } from '../../infoRequest/entities/infoRequest.entity' +import { Irregularity } from '../../irregularity/entities/irregularity.entity' +import { IrregularityFile } from '../../irregularityFile/entities/irregularityFile.entity' +import { ExpenseFile } from '../../expenseFile/entities/expenseFile.entity' +import { Organizer } from '../../organizer/entities/organizer.entity' +import { RecurringDonation } from '../../recurringDonation/entities/recurringDonation.entity' +import { Supporter } from '../../supporter/entities/supporter.entity' +import { Transfer } from '../../transfer/entities/transfer.entity' +import { Withdrawal } from '../../withdrawal/entities/withdrawal.entity' +import { CampaignNews } from '../../campaignNews/entities/campaignNews.entity' +import { CampaignNewsFile } from '../../campaignNewsFile/entities/campaignNewsFile.entity' +import { Company } from '../../company/entities/company.entity' export class Person { - id: string ; -firstName: string ; -lastName: string ; -email: string | null; -phone: string | null; -createdAt: Date ; -updatedAt: Date | null; -newsletter: boolean | null; -address: string | null; -birthday: Date | null; -emailConfirmed: boolean | null; -personalNumber: string | null; -companyId: string | null; -keycloakId: string | null; -stripeCustomerId: string | null; -picture: string | null; -profileEnabled: boolean ; -benefactors?: Benefactor[] ; -beneficiaries?: Beneficiary[] ; -campaignFiles?: CampaignFile[] ; -campaigns?: Campaign[] ; -coordinators?: Coordinator | null; -documents?: Document[] ; -donationWish?: DonationWish[] ; -Donation?: Donation[] ; -expenses?: Expense[] ; -infoRequests?: InfoRequest[] ; -irregularities?: Irregularity[] ; -irregularityFiles?: IrregularityFile[] ; -expenseFiles?: ExpenseFile[] ; -organizer?: Organizer | null; -recurringDonations?: RecurringDonation[] ; -supporters?: Supporter[] ; -transfers?: Transfer[] ; -withdrawals?: Withdrawal[] ; -publishedNews?: CampaignNews[] ; -newsFiles?: CampaignNewsFile[] ; -company?: Company | null; + id: string + firstName: string + lastName: string + email: string | null + phone: string | null + createdAt: Date + updatedAt: Date | null + newsletter: boolean | null + address: string | null + birthday: Date | null + emailConfirmed: boolean | null + personalNumber: string | null + companyId: string | null + keycloakId: string | null + stripeCustomerId: string | null + picture: string | null + profileEnabled: boolean + benefactors?: Benefactor[] + beneficiaries?: Beneficiary[] + campaignFiles?: CampaignFile[] + campaigns?: Campaign[] + coordinators?: Coordinator | null + documents?: Document[] + donationWish?: DonationWish[] + Donation?: Donation[] + expenses?: Expense[] + infoRequests?: InfoRequest[] + irregularities?: Irregularity[] + irregularityFiles?: IrregularityFile[] + expenseFiles?: ExpenseFile[] + organizer?: Organizer | null + recurringDonations?: RecurringDonation[] + supporters?: Supporter[] + transfers?: Transfer[] + withdrawals?: Withdrawal[] + publishedNews?: CampaignNews[] + newsFiles?: CampaignNewsFile[] + company?: Company | null } diff --git a/apps/api/src/domain/generated/recurringDonation/dto/connect-recurringDonation.dto.ts b/apps/api/src/domain/generated/recurringDonation/dto/connect-recurringDonation.dto.ts index c8381e96b..e7c8b1ee2 100644 --- a/apps/api/src/domain/generated/recurringDonation/dto/connect-recurringDonation.dto.ts +++ b/apps/api/src/domain/generated/recurringDonation/dto/connect-recurringDonation.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectRecurringDonationDto { - id: string; - } - \ No newline at end of file +export class ConnectRecurringDonationDto { + id: string +} diff --git a/apps/api/src/domain/generated/recurringDonation/dto/create-recurringDonation.dto.ts b/apps/api/src/domain/generated/recurringDonation/dto/create-recurringDonation.dto.ts index 9fb01dee4..38f5fb77e 100644 --- a/apps/api/src/domain/generated/recurringDonation/dto/create-recurringDonation.dto.ts +++ b/apps/api/src/domain/generated/recurringDonation/dto/create-recurringDonation.dto.ts @@ -1,13 +1,9 @@ - -import {RecurringDonationStatus} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { RecurringDonationStatus } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateRecurringDonationDto { - @ApiProperty({ enum: RecurringDonationStatus}) -status: RecurringDonationStatus; -extSubscriptionId: string; -extCustomerId?: string; + @ApiProperty({ enum: RecurringDonationStatus }) + status: RecurringDonationStatus + extSubscriptionId: string + extCustomerId?: string } diff --git a/apps/api/src/domain/generated/recurringDonation/dto/index.ts b/apps/api/src/domain/generated/recurringDonation/dto/index.ts index 06d6c41cb..cef88b511 100644 --- a/apps/api/src/domain/generated/recurringDonation/dto/index.ts +++ b/apps/api/src/domain/generated/recurringDonation/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-recurringDonation.dto'; -export * from './create-recurringDonation.dto'; -export * from './update-recurringDonation.dto'; \ No newline at end of file +export * from './connect-recurringDonation.dto' +export * from './create-recurringDonation.dto' +export * from './update-recurringDonation.dto' diff --git a/apps/api/src/domain/generated/recurringDonation/dto/update-recurringDonation.dto.ts b/apps/api/src/domain/generated/recurringDonation/dto/update-recurringDonation.dto.ts index dc833d941..32b6b324a 100644 --- a/apps/api/src/domain/generated/recurringDonation/dto/update-recurringDonation.dto.ts +++ b/apps/api/src/domain/generated/recurringDonation/dto/update-recurringDonation.dto.ts @@ -1,13 +1,9 @@ - -import {RecurringDonationStatus} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { RecurringDonationStatus } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateRecurringDonationDto { - @ApiProperty({ enum: RecurringDonationStatus}) -status?: RecurringDonationStatus; -extSubscriptionId?: string; -extCustomerId?: string; + @ApiProperty({ enum: RecurringDonationStatus }) + status?: RecurringDonationStatus + extSubscriptionId?: string + extCustomerId?: string } diff --git a/apps/api/src/domain/generated/recurringDonation/entities/index.ts b/apps/api/src/domain/generated/recurringDonation/entities/index.ts index 758fcb4c3..1c3896c43 100644 --- a/apps/api/src/domain/generated/recurringDonation/entities/index.ts +++ b/apps/api/src/domain/generated/recurringDonation/entities/index.ts @@ -1,2 +1 @@ - -export * from './recurringDonation.entity'; \ No newline at end of file +export * from './recurringDonation.entity' diff --git a/apps/api/src/domain/generated/recurringDonation/entities/recurringDonation.entity.ts b/apps/api/src/domain/generated/recurringDonation/entities/recurringDonation.entity.ts index f4ab5c6f2..efe07a4cf 100644 --- a/apps/api/src/domain/generated/recurringDonation/entities/recurringDonation.entity.ts +++ b/apps/api/src/domain/generated/recurringDonation/entities/recurringDonation.entity.ts @@ -1,20 +1,18 @@ - -import {RecurringDonationStatus,Currency} from '@prisma/client' -import {Person} from '../../person/entities/person.entity' -import {Vault} from '../../vault/entities/vault.entity' - +import { RecurringDonationStatus, Currency } from '@prisma/client' +import { Person } from '../../person/entities/person.entity' +import { Vault } from '../../vault/entities/vault.entity' export class RecurringDonation { - id: string ; -status: RecurringDonationStatus ; -vaultId: string ; -personId: string ; -extSubscriptionId: string ; -extCustomerId: string | null; -createdAt: Date ; -updatedAt: Date | null; -amount: number ; -currency: Currency ; -person?: Person ; -sourceVault?: Vault ; + id: string + status: RecurringDonationStatus + vaultId: string + personId: string + extSubscriptionId: string + extCustomerId: string | null + createdAt: Date + updatedAt: Date | null + amount: number + currency: Currency + person?: Person + sourceVault?: Vault } diff --git a/apps/api/src/domain/generated/supporter/dto/connect-supporter.dto.ts b/apps/api/src/domain/generated/supporter/dto/connect-supporter.dto.ts index 38ad6fc21..d31620c7f 100644 --- a/apps/api/src/domain/generated/supporter/dto/connect-supporter.dto.ts +++ b/apps/api/src/domain/generated/supporter/dto/connect-supporter.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectSupporterDto { - id: string; - } - \ No newline at end of file +export class ConnectSupporterDto { + id: string +} diff --git a/apps/api/src/domain/generated/supporter/dto/create-supporter.dto.ts b/apps/api/src/domain/generated/supporter/dto/create-supporter.dto.ts index 75ad30ffc..d7f05942d 100644 --- a/apps/api/src/domain/generated/supporter/dto/create-supporter.dto.ts +++ b/apps/api/src/domain/generated/supporter/dto/create-supporter.dto.ts @@ -1,12 +1,6 @@ - - - - - - export class CreateSupporterDto { - deletedAt?: Date; -comment?: string; -companyOtherText?: string; -partnerOtherText?: string; + deletedAt?: Date + comment?: string + companyOtherText?: string + partnerOtherText?: string } diff --git a/apps/api/src/domain/generated/supporter/dto/index.ts b/apps/api/src/domain/generated/supporter/dto/index.ts index 66a26f281..172086739 100644 --- a/apps/api/src/domain/generated/supporter/dto/index.ts +++ b/apps/api/src/domain/generated/supporter/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-supporter.dto'; -export * from './create-supporter.dto'; -export * from './update-supporter.dto'; \ No newline at end of file +export * from './connect-supporter.dto' +export * from './create-supporter.dto' +export * from './update-supporter.dto' diff --git a/apps/api/src/domain/generated/supporter/dto/update-supporter.dto.ts b/apps/api/src/domain/generated/supporter/dto/update-supporter.dto.ts index 490949427..decdb280d 100644 --- a/apps/api/src/domain/generated/supporter/dto/update-supporter.dto.ts +++ b/apps/api/src/domain/generated/supporter/dto/update-supporter.dto.ts @@ -1,12 +1,6 @@ - - - - - - export class UpdateSupporterDto { - deletedAt?: Date; -comment?: string; -companyOtherText?: string; -partnerOtherText?: string; + deletedAt?: Date + comment?: string + companyOtherText?: string + partnerOtherText?: string } diff --git a/apps/api/src/domain/generated/supporter/entities/index.ts b/apps/api/src/domain/generated/supporter/entities/index.ts index 96ec7848b..bc0137560 100644 --- a/apps/api/src/domain/generated/supporter/entities/index.ts +++ b/apps/api/src/domain/generated/supporter/entities/index.ts @@ -1,2 +1 @@ - -export * from './supporter.entity'; \ No newline at end of file +export * from './supporter.entity' diff --git a/apps/api/src/domain/generated/supporter/entities/supporter.entity.ts b/apps/api/src/domain/generated/supporter/entities/supporter.entity.ts index cea9df0f1..7d56bd057 100644 --- a/apps/api/src/domain/generated/supporter/entities/supporter.entity.ts +++ b/apps/api/src/domain/generated/supporter/entities/supporter.entity.ts @@ -1,37 +1,35 @@ - -import {Person} from '../../person/entities/person.entity' - +import { Person } from '../../person/entities/person.entity' export class Supporter { - id: string ; -personId: string ; -createdAt: Date ; -updatedAt: Date | null; -deletedAt: Date | null; -comment: string | null; -associationMember: boolean ; -benefactorCampaign: boolean ; -benefactorPlatform: boolean ; -companyOtherText: string | null; -companySponsor: boolean ; -companyVolunteer: boolean ; -partnerBussiness: boolean ; -partnerNpo: boolean ; -partnerOtherText: string | null; -roleAssociationMember: boolean ; -roleBenefactor: boolean ; -roleCompany: boolean ; -rolePartner: boolean ; -roleVolunteer: boolean ; -volunteerBackend: boolean ; -volunteerDesigner: boolean ; -volunteerDevOps: boolean ; -volunteerFinancesAndAccounts: boolean ; -volunteerFrontend: boolean ; -volunteerLawyer: boolean ; -volunteerMarketing: boolean ; -volunteerProjectManager: boolean ; -volunteerQa: boolean ; -volunteerSecurity: boolean ; -person?: Person ; + id: string + personId: string + createdAt: Date + updatedAt: Date | null + deletedAt: Date | null + comment: string | null + associationMember: boolean + benefactorCampaign: boolean + benefactorPlatform: boolean + companyOtherText: string | null + companySponsor: boolean + companyVolunteer: boolean + partnerBussiness: boolean + partnerNpo: boolean + partnerOtherText: string | null + roleAssociationMember: boolean + roleBenefactor: boolean + roleCompany: boolean + rolePartner: boolean + roleVolunteer: boolean + volunteerBackend: boolean + volunteerDesigner: boolean + volunteerDevOps: boolean + volunteerFinancesAndAccounts: boolean + volunteerFrontend: boolean + volunteerLawyer: boolean + volunteerMarketing: boolean + volunteerProjectManager: boolean + volunteerQa: boolean + volunteerSecurity: boolean + person?: Person } diff --git a/apps/api/src/domain/generated/transfer/dto/connect-transfer.dto.ts b/apps/api/src/domain/generated/transfer/dto/connect-transfer.dto.ts index 25ed941d6..72390a1a1 100644 --- a/apps/api/src/domain/generated/transfer/dto/connect-transfer.dto.ts +++ b/apps/api/src/domain/generated/transfer/dto/connect-transfer.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectTransferDto { - id: string; - } - \ No newline at end of file +export class ConnectTransferDto { + id: string +} diff --git a/apps/api/src/domain/generated/transfer/dto/create-transfer.dto.ts b/apps/api/src/domain/generated/transfer/dto/create-transfer.dto.ts index 4e2e5e94b..31205e070 100644 --- a/apps/api/src/domain/generated/transfer/dto/create-transfer.dto.ts +++ b/apps/api/src/domain/generated/transfer/dto/create-transfer.dto.ts @@ -1,14 +1,10 @@ - -import {Currency} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { Currency } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateTransferDto { - @ApiProperty({ enum: Currency}) -currency: Currency; -reason: string; -documentId?: string; -targetDate?: Date; + @ApiProperty({ enum: Currency }) + currency: Currency + reason: string + documentId?: string + targetDate?: Date } diff --git a/apps/api/src/domain/generated/transfer/dto/index.ts b/apps/api/src/domain/generated/transfer/dto/index.ts index 2b6eeb644..a63c3138d 100644 --- a/apps/api/src/domain/generated/transfer/dto/index.ts +++ b/apps/api/src/domain/generated/transfer/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-transfer.dto'; -export * from './create-transfer.dto'; -export * from './update-transfer.dto'; \ No newline at end of file +export * from './connect-transfer.dto' +export * from './create-transfer.dto' +export * from './update-transfer.dto' diff --git a/apps/api/src/domain/generated/transfer/dto/update-transfer.dto.ts b/apps/api/src/domain/generated/transfer/dto/update-transfer.dto.ts index 899e35287..254083e1c 100644 --- a/apps/api/src/domain/generated/transfer/dto/update-transfer.dto.ts +++ b/apps/api/src/domain/generated/transfer/dto/update-transfer.dto.ts @@ -1,14 +1,10 @@ - -import {Currency} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { Currency } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateTransferDto { - @ApiProperty({ enum: Currency}) -currency?: Currency; -reason?: string; -documentId?: string; -targetDate?: Date; + @ApiProperty({ enum: Currency }) + currency?: Currency + reason?: string + documentId?: string + targetDate?: Date } diff --git a/apps/api/src/domain/generated/transfer/entities/index.ts b/apps/api/src/domain/generated/transfer/entities/index.ts index 96b88004b..350bb7593 100644 --- a/apps/api/src/domain/generated/transfer/entities/index.ts +++ b/apps/api/src/domain/generated/transfer/entities/index.ts @@ -1,2 +1 @@ - -export * from './transfer.entity'; \ No newline at end of file +export * from './transfer.entity' diff --git a/apps/api/src/domain/generated/transfer/entities/transfer.entity.ts b/apps/api/src/domain/generated/transfer/entities/transfer.entity.ts index 67c1f2503..060e116ec 100644 --- a/apps/api/src/domain/generated/transfer/entities/transfer.entity.ts +++ b/apps/api/src/domain/generated/transfer/entities/transfer.entity.ts @@ -1,28 +1,26 @@ - -import {TransferStatus,Currency} from '@prisma/client' -import {Person} from '../../person/entities/person.entity' -import {Campaign} from '../../campaign/entities/campaign.entity' -import {Vault} from '../../vault/entities/vault.entity' - +import { TransferStatus, Currency } from '@prisma/client' +import { Person } from '../../person/entities/person.entity' +import { Campaign } from '../../campaign/entities/campaign.entity' +import { Vault } from '../../vault/entities/vault.entity' export class Transfer { - id: string ; -status: TransferStatus ; -currency: Currency ; -amount: number ; -reason: string ; -sourceVaultId: string ; -sourceCampaignId: string ; -targetVaultId: string ; -targetCampaignId: string ; -approvedById: string | null; -documentId: string | null; -targetDate: Date | null; -createdAt: Date ; -updatedAt: Date | null; -approvedBy?: Person | null; -sourceCampaign?: Campaign ; -sourceVault?: Vault ; -targetCampaign?: Campaign ; -targetVault?: Vault ; + id: string + status: TransferStatus + currency: Currency + amount: number + reason: string + sourceVaultId: string + sourceCampaignId: string + targetVaultId: string + targetCampaignId: string + approvedById: string | null + documentId: string | null + targetDate: Date | null + createdAt: Date + updatedAt: Date | null + approvedBy?: Person | null + sourceCampaign?: Campaign + sourceVault?: Vault + targetCampaign?: Campaign + targetVault?: Vault } diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/connect-unregisteredNotificationConsent.dto.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/connect-unregisteredNotificationConsent.dto.ts index ea932916e..a8394c60e 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/connect-unregisteredNotificationConsent.dto.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/connect-unregisteredNotificationConsent.dto.ts @@ -1,6 +1,4 @@ - - export class ConnectUnregisteredNotificationConsentDto { - id?: string; -email?: string; - } - \ No newline at end of file +export class ConnectUnregisteredNotificationConsentDto { + id?: string + email?: string +} diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/create-unregisteredNotificationConsent.dto.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/create-unregisteredNotificationConsent.dto.ts index 6d3de41d1..e98f8c99a 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/create-unregisteredNotificationConsent.dto.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/create-unregisteredNotificationConsent.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class CreateUnregisteredNotificationConsentDto { - email: string; + email: string } diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/index.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/index.ts index 8a9b1be22..30a4e73e3 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/index.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-unregisteredNotificationConsent.dto'; -export * from './create-unregisteredNotificationConsent.dto'; -export * from './update-unregisteredNotificationConsent.dto'; \ No newline at end of file +export * from './connect-unregisteredNotificationConsent.dto' +export * from './create-unregisteredNotificationConsent.dto' +export * from './update-unregisteredNotificationConsent.dto' diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/update-unregisteredNotificationConsent.dto.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/update-unregisteredNotificationConsent.dto.ts index db882d048..05e37e79f 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/update-unregisteredNotificationConsent.dto.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/dto/update-unregisteredNotificationConsent.dto.ts @@ -1,9 +1,3 @@ - - - - - - export class UpdateUnregisteredNotificationConsentDto { - email?: string; + email?: string } diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/index.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/index.ts index 2282fb8e6..4c26022e8 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/index.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/index.ts @@ -1,2 +1 @@ - -export * from './unregisteredNotificationConsent.entity'; \ No newline at end of file +export * from './unregisteredNotificationConsent.entity' diff --git a/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/unregisteredNotificationConsent.entity.ts b/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/unregisteredNotificationConsent.entity.ts index c8244d67b..173955999 100644 --- a/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/unregisteredNotificationConsent.entity.ts +++ b/apps/api/src/domain/generated/unregisteredNotificationConsent/entities/unregisteredNotificationConsent.entity.ts @@ -1,9 +1,5 @@ - - - - export class UnregisteredNotificationConsent { - id: string ; -email: string ; -consent: boolean ; + id: string + email: string + consent: boolean } diff --git a/apps/api/src/domain/generated/vault/dto/connect-vault.dto.ts b/apps/api/src/domain/generated/vault/dto/connect-vault.dto.ts index 4e4502295..73327627b 100644 --- a/apps/api/src/domain/generated/vault/dto/connect-vault.dto.ts +++ b/apps/api/src/domain/generated/vault/dto/connect-vault.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectVaultDto { - id: string; - } - \ No newline at end of file +export class ConnectVaultDto { + id: string +} diff --git a/apps/api/src/domain/generated/vault/dto/create-vault.dto.ts b/apps/api/src/domain/generated/vault/dto/create-vault.dto.ts index 403b00ac8..48b2ddb78 100644 --- a/apps/api/src/domain/generated/vault/dto/create-vault.dto.ts +++ b/apps/api/src/domain/generated/vault/dto/create-vault.dto.ts @@ -1,9 +1 @@ - - - - - - -export class CreateVaultDto { - -} +export class CreateVaultDto {} diff --git a/apps/api/src/domain/generated/vault/dto/index.ts b/apps/api/src/domain/generated/vault/dto/index.ts index 47c6d1100..8a655273b 100644 --- a/apps/api/src/domain/generated/vault/dto/index.ts +++ b/apps/api/src/domain/generated/vault/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-vault.dto'; -export * from './create-vault.dto'; -export * from './update-vault.dto'; \ No newline at end of file +export * from './connect-vault.dto' +export * from './create-vault.dto' +export * from './update-vault.dto' diff --git a/apps/api/src/domain/generated/vault/dto/update-vault.dto.ts b/apps/api/src/domain/generated/vault/dto/update-vault.dto.ts index dd8a83a83..0110a3058 100644 --- a/apps/api/src/domain/generated/vault/dto/update-vault.dto.ts +++ b/apps/api/src/domain/generated/vault/dto/update-vault.dto.ts @@ -1,9 +1 @@ - - - - - - -export class UpdateVaultDto { - -} +export class UpdateVaultDto {} diff --git a/apps/api/src/domain/generated/vault/entities/index.ts b/apps/api/src/domain/generated/vault/entities/index.ts index 10628d9cd..6b947cc5e 100644 --- a/apps/api/src/domain/generated/vault/entities/index.ts +++ b/apps/api/src/domain/generated/vault/entities/index.ts @@ -1,2 +1 @@ - -export * from './vault.entity'; \ No newline at end of file +export * from './vault.entity' diff --git a/apps/api/src/domain/generated/vault/entities/vault.entity.ts b/apps/api/src/domain/generated/vault/entities/vault.entity.ts index 4af8a1991..83d9b3692 100644 --- a/apps/api/src/domain/generated/vault/entities/vault.entity.ts +++ b/apps/api/src/domain/generated/vault/entities/vault.entity.ts @@ -1,27 +1,25 @@ - -import {Currency} from '@prisma/client' -import {Campaign} from '../../campaign/entities/campaign.entity' -import {Donation} from '../../donation/entities/donation.entity' -import {Expense} from '../../expense/entities/expense.entity' -import {RecurringDonation} from '../../recurringDonation/entities/recurringDonation.entity' -import {Transfer} from '../../transfer/entities/transfer.entity' -import {Withdrawal} from '../../withdrawal/entities/withdrawal.entity' - +import { Currency } from '@prisma/client' +import { Campaign } from '../../campaign/entities/campaign.entity' +import { Donation } from '../../donation/entities/donation.entity' +import { Expense } from '../../expense/entities/expense.entity' +import { RecurringDonation } from '../../recurringDonation/entities/recurringDonation.entity' +import { Transfer } from '../../transfer/entities/transfer.entity' +import { Withdrawal } from '../../withdrawal/entities/withdrawal.entity' export class Vault { - id: string ; -currency: Currency ; -amount: number ; -campaignId: string ; -createdAt: Date ; -updatedAt: Date | null; -name: string ; -blockedAmount: number ; -campaign?: Campaign ; -donations?: Donation[] ; -expenses?: Expense[] ; -recurringDonations?: RecurringDonation[] ; -sourceTransfers?: Transfer[] ; -targetTransfers?: Transfer[] ; -withdraws?: Withdrawal[] ; + id: string + currency: Currency + amount: number + campaignId: string + createdAt: Date + updatedAt: Date | null + name: string + blockedAmount: number + campaign?: Campaign + donations?: Donation[] + expenses?: Expense[] + recurringDonations?: RecurringDonation[] + sourceTransfers?: Transfer[] + targetTransfers?: Transfer[] + withdraws?: Withdrawal[] } diff --git a/apps/api/src/domain/generated/withdrawal/dto/connect-withdrawal.dto.ts b/apps/api/src/domain/generated/withdrawal/dto/connect-withdrawal.dto.ts index 701535cb9..0076282d6 100644 --- a/apps/api/src/domain/generated/withdrawal/dto/connect-withdrawal.dto.ts +++ b/apps/api/src/domain/generated/withdrawal/dto/connect-withdrawal.dto.ts @@ -1,5 +1,3 @@ - - export class ConnectWithdrawalDto { - id: string; - } - \ No newline at end of file +export class ConnectWithdrawalDto { + id: string +} diff --git a/apps/api/src/domain/generated/withdrawal/dto/create-withdrawal.dto.ts b/apps/api/src/domain/generated/withdrawal/dto/create-withdrawal.dto.ts index 872db5eb6..45972ac91 100644 --- a/apps/api/src/domain/generated/withdrawal/dto/create-withdrawal.dto.ts +++ b/apps/api/src/domain/generated/withdrawal/dto/create-withdrawal.dto.ts @@ -1,14 +1,10 @@ - -import {Currency} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { Currency } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class CreateWithdrawalDto { - @ApiProperty({ enum: Currency}) -currency: Currency; -reason: string; -documentId?: string; -targetDate?: Date; + @ApiProperty({ enum: Currency }) + currency: Currency + reason: string + documentId?: string + targetDate?: Date } diff --git a/apps/api/src/domain/generated/withdrawal/dto/index.ts b/apps/api/src/domain/generated/withdrawal/dto/index.ts index 0850f1280..09efa0678 100644 --- a/apps/api/src/domain/generated/withdrawal/dto/index.ts +++ b/apps/api/src/domain/generated/withdrawal/dto/index.ts @@ -1,4 +1,3 @@ - -export * from './connect-withdrawal.dto'; -export * from './create-withdrawal.dto'; -export * from './update-withdrawal.dto'; \ No newline at end of file +export * from './connect-withdrawal.dto' +export * from './create-withdrawal.dto' +export * from './update-withdrawal.dto' diff --git a/apps/api/src/domain/generated/withdrawal/dto/update-withdrawal.dto.ts b/apps/api/src/domain/generated/withdrawal/dto/update-withdrawal.dto.ts index 32d048ab3..d74c388fe 100644 --- a/apps/api/src/domain/generated/withdrawal/dto/update-withdrawal.dto.ts +++ b/apps/api/src/domain/generated/withdrawal/dto/update-withdrawal.dto.ts @@ -1,14 +1,10 @@ - -import {Currency} from '@prisma/client' -import {ApiProperty} from '@nestjs/swagger' - - - +import { Currency } from '@prisma/client' +import { ApiProperty } from '@nestjs/swagger' export class UpdateWithdrawalDto { - @ApiProperty({ enum: Currency}) -currency?: Currency; -reason?: string; -documentId?: string; -targetDate?: Date; + @ApiProperty({ enum: Currency }) + currency?: Currency + reason?: string + documentId?: string + targetDate?: Date } diff --git a/apps/api/src/domain/generated/withdrawal/entities/index.ts b/apps/api/src/domain/generated/withdrawal/entities/index.ts index f9504dcee..a167ff4f9 100644 --- a/apps/api/src/domain/generated/withdrawal/entities/index.ts +++ b/apps/api/src/domain/generated/withdrawal/entities/index.ts @@ -1,2 +1 @@ - -export * from './withdrawal.entity'; \ No newline at end of file +export * from './withdrawal.entity' diff --git a/apps/api/src/domain/generated/withdrawal/entities/withdrawal.entity.ts b/apps/api/src/domain/generated/withdrawal/entities/withdrawal.entity.ts index 26d3b50e2..eeb74f327 100644 --- a/apps/api/src/domain/generated/withdrawal/entities/withdrawal.entity.ts +++ b/apps/api/src/domain/generated/withdrawal/entities/withdrawal.entity.ts @@ -1,27 +1,25 @@ - -import {WithdrawStatus,Currency} from '@prisma/client' -import {Person} from '../../person/entities/person.entity' -import {BankAccount} from '../../bankAccount/entities/bankAccount.entity' -import {Campaign} from '../../campaign/entities/campaign.entity' -import {Vault} from '../../vault/entities/vault.entity' - +import { WithdrawStatus, Currency } from '@prisma/client' +import { Person } from '../../person/entities/person.entity' +import { BankAccount } from '../../bankAccount/entities/bankAccount.entity' +import { Campaign } from '../../campaign/entities/campaign.entity' +import { Vault } from '../../vault/entities/vault.entity' export class Withdrawal { - id: string ; -status: WithdrawStatus ; -currency: Currency ; -amount: number ; -reason: string ; -sourceVaultId: string ; -sourceCampaignId: string ; -bankAccountId: string ; -documentId: string | null; -approvedById: string | null; -targetDate: Date | null; -createdAt: Date ; -updatedAt: Date | null; -approvedBy?: Person | null; -bankAccount?: BankAccount ; -sourceCampaign?: Campaign ; -sourceVault?: Vault ; + id: string + status: WithdrawStatus + currency: Currency + amount: number + reason: string + sourceVaultId: string + sourceCampaignId: string + bankAccountId: string + documentId: string | null + approvedById: string | null + targetDate: Date | null + createdAt: Date + updatedAt: Date | null + approvedBy?: Person | null + bankAccount?: BankAccount + sourceCampaign?: Campaign + sourceVault?: Vault } From 3b443fb1a547b431473020b3055e2713aceb97d3 Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Tue, 21 Nov 2023 11:10:02 +0100 Subject: [PATCH 12/15] FIX: check for corporate profile to use companyId. --- apps/api/src/auth/auth.service.spec.ts | 12 +++++------- apps/api/src/auth/auth.service.ts | 2 +- apps/api/src/person/person.service.ts | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index ff6eb6217..5547cd861 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -23,7 +23,6 @@ import { TemplateService } from '../email/template.service' import { SendGridNotificationsProvider } from '../notifications/providers/notifications.sendgrid.provider' import { NotificationsProviderInterface } from '../notifications/providers/notifications.interface.providers' import { MarketingNotificationsModule } from '../notifications/notifications.module' -import { Organizer } from '../domain/generated/organizer/entities' import { PersonService } from '../person/person.service' jest.mock('@keycloak/keycloak-admin-client') @@ -506,7 +505,7 @@ describe('AuthService', () => { }) }) - describe('permanentDeleteUser', () => { + describe('deleteUser', () => { const corporatePerson: any = { id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', firstName: 'Admin', @@ -526,7 +525,6 @@ describe('AuthService', () => { stripeCustomerId: null, profileEnabled: false, beneficiaries: [], - organizer: null, } it('should delete user successfully', async () => { @@ -610,8 +608,8 @@ describe('AuthService', () => { expect(personSpy).toHaveBeenCalledOnce() }) - it('should throw when corporate user is organizer', async () => { - corporatePerson.organizer = [{ id: '123' } as Organizer] + it('should throw when user has company id', async () => { + corporatePerson.companyId = '123' const personSpy = jest .spyOn(personService, 'findOneByKeycloakId') .mockResolvedValue(corporatePerson) @@ -620,8 +618,8 @@ describe('AuthService', () => { expect(personSpy).toHaveBeenCalledOnce() }) - it('should throw when corporate user is organizer & has beneficiaries', async () => { - corporatePerson.organizer = [{ id: '123' } as Organizer] + it('should throw when corporate user has companyId & beneficiaries', async () => { + corporatePerson.companyId = '123' corporatePerson.beneficiaries = [{ id: '123' } as Beneficiary] const personSpy = jest diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index 1b57dffa9..2c10e83a5 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -433,7 +433,7 @@ export class AuthService { const user = await this.personService.findOneByKeycloakId(keycloakId) //Check and throw if user is a corporate profile - if (user?.beneficiaries?.length || user?.organizer) { + if (user?.beneficiaries?.length || user?.companyId) { throw new InternalServerErrorException('Cannot delete a corporate profile') } diff --git a/apps/api/src/person/person.service.ts b/apps/api/src/person/person.service.ts index f0ac0cb54..0d908a52d 100644 --- a/apps/api/src/person/person.service.ts +++ b/apps/api/src/person/person.service.ts @@ -123,7 +123,6 @@ export class PersonService { include: { company: true, beneficiaries: { select: { id: true } }, - organizer: { select: { id: true } }, }, }) } From 3d9782bb17e8eec5fc508f730e737441331089b9 Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Tue, 21 Nov 2023 21:48:30 +0100 Subject: [PATCH 13/15] FIX: return organizer in the if statement & adjust tests --- apps/api/src/auth/auth.service.spec.ts | 27 +++++++++++++++++++++++++- apps/api/src/auth/auth.service.ts | 6 ++++-- apps/api/src/person/person.service.ts | 1 + 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index 5547cd861..48c61e8be 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -525,16 +525,20 @@ describe('AuthService', () => { stripeCustomerId: null, profileEnabled: false, beneficiaries: [], + organizer: null, } it('should delete user successfully', async () => { const keycloakId = '123' + const personSpy = jest .spyOn(personService, 'findOneByKeycloakId') .mockResolvedValue(corporatePerson) + const authenticateAdminSpy = jest .spyOn(service as any, 'authenticateAdmin') .mockResolvedValueOnce('') + const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce() const prismaDeleteSpy = jest.spyOn(prismaMock.person, 'delete').mockResolvedValueOnce(person) const loggerLogSpy = jest.spyOn(Logger, 'log') @@ -552,15 +556,19 @@ describe('AuthService', () => { it('should handle admin client rejection', async () => { const keycloakId = '123' + const personSpy = jest .spyOn(personService, 'findOneByKeycloakId') .mockResolvedValue(corporatePerson) + const authenticateAdminSpy = jest .spyOn(service as any, 'authenticateAdmin') .mockResolvedValueOnce('') + const adminDeleteSpy = jest .spyOn(admin.users, 'del') .mockRejectedValueOnce(new Error('Admin Client Rejection!')) + const loggerLogSpy = jest.spyOn(Logger, 'error') await expect(service.deleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException) @@ -578,13 +586,17 @@ describe('AuthService', () => { const personSpy = jest .spyOn(personService, 'findOneByKeycloakId') .mockResolvedValue(corporatePerson) + const authenticateAdminSpy = jest .spyOn(service as any, 'authenticateAdmin') .mockResolvedValueOnce('') + const adminDeleteSpy = jest.spyOn(admin.users, 'del').mockResolvedValueOnce() + const prismaDeleteSpy = jest .spyOn(prismaMock.person, 'delete') .mockRejectedValueOnce(new Error('Prisma Rejection!')) + const loggerLogSpy = jest.spyOn(Logger, 'error') await expect(service.deleteUser(keycloakId)).rejects.toThrow(InternalServerErrorException) @@ -600,6 +612,7 @@ describe('AuthService', () => { it('should throw when corporate user has beneficiaries', async () => { corporatePerson.beneficiaries = [{ id: '123' } as Beneficiary] + const personSpy = jest .spyOn(personService, 'findOneByKeycloakId') .mockResolvedValue(corporatePerson) @@ -610,6 +623,17 @@ describe('AuthService', () => { it('should throw when user has company id', async () => { corporatePerson.companyId = '123' + + const personSpy = jest + .spyOn(personService, 'findOneByKeycloakId') + .mockResolvedValue(corporatePerson) + + await expect(service.deleteUser('123')).rejects.toThrow(InternalServerErrorException) + expect(personSpy).toHaveBeenCalledOnce() + }) + + it('should throw when user is organizer', async () => { + corporatePerson.organizer = { id: '123' } const personSpy = jest .spyOn(personService, 'findOneByKeycloakId') .mockResolvedValue(corporatePerson) @@ -618,9 +642,10 @@ describe('AuthService', () => { expect(personSpy).toHaveBeenCalledOnce() }) - it('should throw when corporate user has companyId & beneficiaries', async () => { + it('should throw when corporate user has companyId & beneficiaries & is organizer', async () => { corporatePerson.companyId = '123' corporatePerson.beneficiaries = [{ id: '123' } as Beneficiary] + corporatePerson.organizer = { id: '123' } const personSpy = jest .spyOn(personService, 'findOneByKeycloakId') diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index 2c10e83a5..80f5b6d79 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -433,8 +433,10 @@ export class AuthService { const user = await this.personService.findOneByKeycloakId(keycloakId) //Check and throw if user is a corporate profile - if (user?.beneficiaries?.length || user?.companyId) { - throw new InternalServerErrorException('Cannot delete a corporate profile') + if (user?.beneficiaries?.length || user?.organizer || user?.companyId) { + throw new InternalServerErrorException( + 'Cannot delete a beneficiary, organizer or corporate profile', + ) } return this.authenticateAdmin() diff --git a/apps/api/src/person/person.service.ts b/apps/api/src/person/person.service.ts index 0d908a52d..f0ac0cb54 100644 --- a/apps/api/src/person/person.service.ts +++ b/apps/api/src/person/person.service.ts @@ -123,6 +123,7 @@ export class PersonService { include: { company: true, beneficiaries: { select: { id: true } }, + organizer: { select: { id: true } }, }, }) } From 53b89df1f9dfed46f81b48e194887029a57ba9f2 Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Tue, 21 Nov 2023 21:51:49 +0100 Subject: [PATCH 14/15] CHORE: update comment --- apps/api/src/auth/auth.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index 80f5b6d79..6cc5360f8 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -432,7 +432,7 @@ export class AuthService { async deleteUser(keycloakId: string) { const user = await this.personService.findOneByKeycloakId(keycloakId) - //Check and throw if user is a corporate profile + //Check and throw if user is a beneficiary, organizer or corporate profile if (user?.beneficiaries?.length || user?.organizer || user?.companyId) { throw new InternalServerErrorException( 'Cannot delete a beneficiary, organizer or corporate profile', From 562ed30032352e1a7a9db51236beeffa4665eccf Mon Sep 17 00:00:00 2001 From: Petar Dimitrov Date: Wed, 22 Nov 2023 20:30:58 +0100 Subject: [PATCH 15/15] FIX: made if in deleteUser() more readable --- apps/api/src/auth/auth.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index 6cc5360f8..2f058e8e6 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -433,7 +433,7 @@ export class AuthService { const user = await this.personService.findOneByKeycloakId(keycloakId) //Check and throw if user is a beneficiary, organizer or corporate profile - if (user?.beneficiaries?.length || user?.organizer || user?.companyId) { + if (!!user && user.beneficiaries.length > 0 || user?.organizer || user?.companyId) { throw new InternalServerErrorException( 'Cannot delete a beneficiary, organizer or corporate profile', )