From 48bbbac46befc32dd5206cf3f5e7dcae670bb4d3 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 9 Oct 2023 15:55:18 +0300 Subject: [PATCH 01/79] auth: Allow for corporate registrations The corporate registrations will be manually verified, and activated by podkrepi.bg administrator. --- apps/api/src/auth/auth.service.ts | 35 ++++++++++++++++--- apps/api/src/auth/dto/register.dto.ts | 18 +++++++++- apps/api/src/auth/register.controller.ts | 12 +++++-- db/seed/company/factory.ts | 1 + .../migration.sql | 14 ++++++++ schema.prisma | 3 ++ 6 files changed, 74 insertions(+), 9 deletions(-) create mode 100644 migrations/20231009123833_link_company_to_person/migration.sql diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index 0035171d3..304075b30 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -20,7 +20,7 @@ import { TokenResponseRaw } from '@keycloak/keycloak-admin-client/lib/utils/auth import { Person } from '@prisma/client' import { PrismaService } from '../prisma/prisma.service' import { LoginDto } from './dto/login.dto' -import { RegisterDto } from './dto/register.dto' +import { CompanyRegisterDto, RegisterDto } from './dto/register.dto' import { RefreshDto } from './dto/refresh.dto' import { KeycloakTokenParsed } from './keycloak' import { ProviderDto } from './dto/provider.dto' @@ -177,14 +177,20 @@ export class AuthService { } } - async createUser(registerDto: RegisterDto): Promise { + async createUser( + registerDto: RegisterDto, + isCorporateReg: boolean = false, + ): Promise { let person: Person try { await this.authenticateAdmin() // Create user in Keycloak - const user = await this.createKeycloakUser(registerDto, false) + const user = await this.createKeycloakUser(registerDto, false, !isCorporateReg) // Insert or connect person in app db person = await this.createPerson(registerDto, user.id) + if (isCorporateReg) { + await this.createCompany(registerDto as CompanyRegisterDto, person.id) + } } catch (error) { const response = { error: error.message, @@ -225,13 +231,17 @@ export class AuthService { }) } - private async createKeycloakUser(registerDto: RegisterDto, verifyEmail: boolean) { + private async createKeycloakUser( + registerDto: RegisterDto, + verifyEmail: boolean, + activeProfile: boolean = true, + ) { return await this.admin.users.create({ username: registerDto.email, email: registerDto.email, firstName: registerDto.firstName, lastName: registerDto.lastName, - enabled: true, + enabled: activeProfile, emailVerified: true, groups: [], requiredActions: verifyEmail ? [RequiredActionAlias.VERIFY_EMAIL] : [], @@ -277,6 +287,21 @@ export class AuthService { }) } + private async createCompany(registerDto: CompanyRegisterDto, personId: string) { + return await this.prismaService.company.upsert({ + // Create a person with the provided keycloakId + create: { + personId: personId, + companyNumber: registerDto.companyNumber, + companyName: registerDto.companyName, + legalPersonName: registerDto.firstName + registerDto.lastName, + }, + // Store keycloakId to the person with same email + update: { personId }, + where: { personId }, + }) + } + async updateUser(keycloakId: string, updateDto: UpdatePersonDto) { await this.authenticateAdmin() await this.admin.users.update( diff --git a/apps/api/src/auth/dto/register.dto.ts b/apps/api/src/auth/dto/register.dto.ts index d2614dc87..b214b9063 100644 --- a/apps/api/src/auth/dto/register.dto.ts +++ b/apps/api/src/auth/dto/register.dto.ts @@ -1,6 +1,6 @@ import { ApiProperty } from '@nestjs/swagger' import { Expose } from 'class-transformer' -import { IsBoolean, IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator' +import { IsBoolean, IsEmail, IsNotEmpty, IsOptional, IsString, MaxLength } from 'class-validator' export class RegisterDto { @ApiProperty() @@ -33,3 +33,19 @@ export class RegisterDto { @IsBoolean() public readonly newsletter?: boolean } + +export class CompanyRegisterDto extends RegisterDto { + @Expose() + @IsString() + @ApiProperty() + @MaxLength(100) + companyName: string + + @Expose() + @IsString() + @ApiProperty({ + description: + 'BULSTAT Unified Identification Code (UIC) https://psc.egov.bg/en/psc-starting-a-business-bulstat', + }) + companyNumber: string +} diff --git a/apps/api/src/auth/register.controller.ts b/apps/api/src/auth/register.controller.ts index 8eefa5a67..3284c1f90 100644 --- a/apps/api/src/auth/register.controller.ts +++ b/apps/api/src/auth/register.controller.ts @@ -1,7 +1,7 @@ import { Body, Controller, Post } from '@nestjs/common' import { Public, Resource, Scopes } from 'nest-keycloak-connect' import { AuthService } from './auth.service' -import { RegisterDto } from './dto/register.dto' +import { CompanyRegisterDto, RegisterDto } from './dto/register.dto' import { ApiTags } from '@nestjs/swagger' @ApiTags('register') @@ -10,10 +10,16 @@ import { ApiTags } from '@nestjs/swagger' export class RegisterController { constructor(private readonly authService: AuthService) {} - @Post() + @Post('individual') @Public() @Scopes('view') - async register(@Body() registerDto: RegisterDto) { + async registerIndividual(@Body() registerDto: RegisterDto) { return await this.authService.createUser(registerDto) } + @Post('corporate') + @Public() + @Scopes('view') + async registerCorporate(@Body() registerDto: CompanyRegisterDto) { + return await this.authService.createUser(registerDto, true) + } } diff --git a/db/seed/company/factory.ts b/db/seed/company/factory.ts index 3b737f37d..224f8ffd3 100644 --- a/db/seed/company/factory.ts +++ b/db/seed/company/factory.ts @@ -8,6 +8,7 @@ export const companyFactory = Factory.define(({ associations }) => ({ companyName: faker.company.name(), companyNumber: faker.finance.account(9), legalPersonName: faker.name.fullName(), + personId: null, countryCode: faker.address.countryCode(), cityId: associations.cityId || faker.datatype.uuid(), createdAt: faker.date.past(), diff --git a/migrations/20231009123833_link_company_to_person/migration.sql b/migrations/20231009123833_link_company_to_person/migration.sql new file mode 100644 index 000000000..b1e15f5eb --- /dev/null +++ b/migrations/20231009123833_link_company_to_person/migration.sql @@ -0,0 +1,14 @@ +/* + Warnings: + + - A unique constraint covering the columns `[personId]` on the table `companies` will be added. If there are existing duplicate values, this will fail. + +*/ +-- AlterTable +ALTER TABLE "companies" ADD COLUMN "personId" UUID; + +-- CreateIndex +CREATE UNIQUE INDEX "companies_personId_key" ON "companies"("personId"); + +-- AddForeignKey +ALTER TABLE "companies" ADD CONSTRAINT "companies_personId_fkey" FOREIGN KEY ("personId") REFERENCES "people"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/schema.prisma b/schema.prisma index a2868c97e..62a2b2f1e 100644 --- a/schema.prisma +++ b/schema.prisma @@ -71,6 +71,7 @@ model Person { withdrawals Withdrawal[] publishedNews CampaignNews[] newsFiles CampaignNewsFile[] + Company Company? @@index([keycloakId], map: "keycloak_id_idx") @@index([stripeCustomerId], map: "stripe_customer_id_idx") @@ -86,10 +87,12 @@ model Company { legalPersonName String? @map("legal_person_name") countryCode String? @map("country_code") @db.Citext cityId String? @map("city_id") @db.Uuid + personId String? @unique @db.Uuid createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6) updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) beneficiaries Beneficiary[] Campaign Campaign[] + person Person? @relation(fields: [personId], references: [id]) @@map("companies") } From e1c0be378f35e3ef2ac7af00249169a7d7860268 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 9 Oct 2023 16:42:29 +0300 Subject: [PATCH 02/79] auth: Don't create new corporate profile if company exists --- apps/api/src/auth/auth.module.ts | 2 ++ apps/api/src/auth/register.controller.ts | 11 +++++++++-- apps/api/src/company/company.module.ts | 1 + apps/api/src/company/company.service.ts | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/api/src/auth/auth.module.ts b/apps/api/src/auth/auth.module.ts index 88df6f22b..ad5aa565e 100644 --- a/apps/api/src/auth/auth.module.ts +++ b/apps/api/src/auth/auth.module.ts @@ -14,6 +14,7 @@ import { JwtModule, JwtService } from '@nestjs/jwt' import { EmailService } from '../email/email.service' import { TemplateService } from '../email/template.service' import { MarketingNotificationsModule } from '../notifications/notifications.module' +import { CompanyModule } from '../company/company.module' @Module({ controllers: [LoginController, RegisterController, RefreshController, ProviderLoginController], @@ -27,6 +28,7 @@ import { MarketingNotificationsModule } from '../notifications/notifications.mod imports: [AppConfigModule], }), MarketingNotificationsModule, + CompanyModule, ], exports: [AuthService], }) diff --git a/apps/api/src/auth/register.controller.ts b/apps/api/src/auth/register.controller.ts index 3284c1f90..c8ad5facc 100644 --- a/apps/api/src/auth/register.controller.ts +++ b/apps/api/src/auth/register.controller.ts @@ -1,14 +1,18 @@ -import { Body, Controller, Post } from '@nestjs/common' +import { Body, ConflictException, Controller, Post } from '@nestjs/common' import { Public, Resource, Scopes } from 'nest-keycloak-connect' import { AuthService } from './auth.service' import { CompanyRegisterDto, RegisterDto } from './dto/register.dto' import { ApiTags } from '@nestjs/swagger' +import { CompanyService } from '../company/company.service' @ApiTags('register') @Controller('register') @Resource('register') export class RegisterController { - constructor(private readonly authService: AuthService) {} + constructor( + private readonly authService: AuthService, + private readonly companyService: CompanyService, + ) {} @Post('individual') @Public() @@ -20,6 +24,9 @@ export class RegisterController { @Public() @Scopes('view') async registerCorporate(@Body() registerDto: CompanyRegisterDto) { + const company = await this.companyService.findOneByEIK(registerDto.companyNumber) + if (company) throw new ConflictException('Company with this number has been registered already') + return await this.authService.createUser(registerDto, true) } } diff --git a/apps/api/src/company/company.module.ts b/apps/api/src/company/company.module.ts index 1c466e2d9..a64abcf44 100644 --- a/apps/api/src/company/company.module.ts +++ b/apps/api/src/company/company.module.ts @@ -6,5 +6,6 @@ import { PrismaService } from '../prisma/prisma.service' @Module({ controllers: [CompanyController], providers: [CompanyService, PrismaService], + exports: [CompanyService], }) export class CompanyModule {} diff --git a/apps/api/src/company/company.service.ts b/apps/api/src/company/company.service.ts index d665b8ea8..9e7828015 100644 --- a/apps/api/src/company/company.service.ts +++ b/apps/api/src/company/company.service.ts @@ -42,6 +42,10 @@ export class CompanyService { return company } + async findOneByEIK(companyNumber: string) { + return await this.prisma.company.findUnique({ where: { companyNumber } }) + } + async update(id: string, updateCompanyDto: UpdateCompanyDto) { try { const company = await this.prisma.company.update({ From 310e19cef7d86a64caa2cc73a7366055fe39ac04 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 10 Oct 2023 16:35:59 +0300 Subject: [PATCH 03/79] Affiliate Program: Initial changes -Added Affiliate model -Removed company field from Person model. That information will now be received from the company relation -Added endpoints to handle adding new affiliates, and updating their status --- .../api/src/affiliate/affiliate.controller.ts | 58 +++++++++++++++++++ apps/api/src/affiliate/affiliate.module.ts | 12 ++++ apps/api/src/affiliate/affiliate.service.ts | 31 ++++++++++ .../dto/affiliate-status-update.dto.ts | 12 ++++ apps/api/src/app/app.module.ts | 2 + .../affiliate/dto/connect-affiliate.dto.ts | 7 +++ .../affiliate/dto/create-affiliate.dto.ts | 9 +++ .../domain/generated/affiliate/dto/index.ts | 4 ++ .../affiliate/dto/update-affiliate.dto.ts | 9 +++ .../affiliate/entities/affiliate.entity.ts | 12 ++++ .../generated/affiliate/entities/index.ts | 2 + apps/api/src/person/dto/create-person.dto.ts | 6 -- apps/api/src/person/dto/update-person.dto.ts | 5 -- apps/api/src/person/person.service.ts | 2 +- .../api/src/support/dto/create-inquiry.dto.ts | 2 - db/seed/person/data.ts | 5 -- .../src/lib/person/create-person.dto.ts | 7 --- .../migration.sql | 48 +++++++++++++++ podkrepi.dbml | 24 +++++++- schema.prisma | 35 ++++++++--- 20 files changed, 256 insertions(+), 36 deletions(-) create mode 100644 apps/api/src/affiliate/affiliate.controller.ts create mode 100644 apps/api/src/affiliate/affiliate.module.ts create mode 100644 apps/api/src/affiliate/affiliate.service.ts create mode 100644 apps/api/src/affiliate/dto/affiliate-status-update.dto.ts create mode 100644 apps/api/src/domain/generated/affiliate/dto/connect-affiliate.dto.ts create mode 100644 apps/api/src/domain/generated/affiliate/dto/create-affiliate.dto.ts create mode 100644 apps/api/src/domain/generated/affiliate/dto/index.ts create mode 100644 apps/api/src/domain/generated/affiliate/dto/update-affiliate.dto.ts create mode 100644 apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts create mode 100644 apps/api/src/domain/generated/affiliate/entities/index.ts create mode 100644 migrations/20231009151309_affiliate_program_initial_changes/migration.sql diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts new file mode 100644 index 000000000..7ebf32736 --- /dev/null +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -0,0 +1,58 @@ +import { + BadRequestException, + Body, + ConflictException, + Controller, + ForbiddenException, + NotFoundException, + Param, + Patch, + Post, +} from '@nestjs/common' +import { ApiTags } from '@nestjs/swagger' +import { PersonService } from '../person/person.service' +import { KeycloakTokenParsed, isAdmin } from '../auth/keycloak' +import { AuthenticatedUser } from 'nest-keycloak-connect' +import { AffiliateService } from './affiliate.service' +import { AffiliateStatusUpdateDto } from './dto/affiliate-status-update.dto' +import { getPaymentReference } from '../campaign/helpers/payment-reference' + +@Controller('affiliate') +@ApiTags('affiliate') +export class AffiliateController { + constructor( + private readonly personService: PersonService, + private readonly affiliateService: AffiliateService, + ) {} + + @Post('join') + async joinAffiliateProgramRequest(@AuthenticatedUser() user: KeycloakTokenParsed) { + const person = await this.personService.findOneByKeycloakId(user.sub) + if (!person) throw new NotFoundException('User is not found') + if (!person.company) throw new BadRequestException('Must be corporate profile') + return await this.affiliateService.create(person.company.id) + } + + @Patch(':affiliateId/status-update') + async updateAffiliateStatus( + @Param('affiliateId') affiliateId: string, + @Body() { newStatus }: AffiliateStatusUpdateDto, + @AuthenticatedUser() user: KeycloakTokenParsed, + ) { + if (!isAdmin(user)) throw new ForbiddenException('Must be an admin ') + const affiliate = await this.affiliateService.findOneById(affiliateId) + + if (!affiliate) throw new NotFoundException('Affiliate not found') + + if (affiliate.status === newStatus) { + throw new ConflictException('Status is the same') + } + + if (affiliate.status === 'pending' && newStatus === 'active') { + const affiliateCode = getPaymentReference() + return await this.affiliateService.updateStatus(affiliateId, newStatus, affiliateCode) + } + + return await this.affiliateService.updateStatus(affiliateId, newStatus, affiliate.affiliateCode) + } +} diff --git a/apps/api/src/affiliate/affiliate.module.ts b/apps/api/src/affiliate/affiliate.module.ts new file mode 100644 index 000000000..42383eaab --- /dev/null +++ b/apps/api/src/affiliate/affiliate.module.ts @@ -0,0 +1,12 @@ +import { Module } from '@nestjs/common' +import { AffiliateController } from './affiliate.controller' +import { AffiliateService } from './affiliate.service' +import { PersonModule } from '../person/person.module' +import { PrismaService } from '../prisma/prisma.service' + +@Module({ + controllers: [AffiliateController], + providers: [AffiliateService, PrismaService], + imports: [PersonModule], +}) +export class AffiliateModule {} diff --git a/apps/api/src/affiliate/affiliate.service.ts b/apps/api/src/affiliate/affiliate.service.ts new file mode 100644 index 000000000..e6625f858 --- /dev/null +++ b/apps/api/src/affiliate/affiliate.service.ts @@ -0,0 +1,31 @@ +import { Injectable } from '@nestjs/common' +import { PrismaService } from '../prisma/prisma.service' +import { AffiliateStatus } from '@prisma/client' + +@Injectable() +export class AffiliateService { + constructor(private readonly prismaService: PrismaService) {} + + async create(companyId: string) { + const affiliate = await this.prismaService.affiliate.create({ + data: { companyId }, + }) + return affiliate + } + + async findOneById(id: string) { + return await this.prismaService.affiliate.findUnique({ where: { id } }) + } + + async updateStatus( + affiliateId: string, + status: AffiliateStatus, + affiliateCode: string | null = null, + ) { + const affiliate = await this.prismaService.affiliate.update({ + where: { id: affiliateId }, + data: { status, affiliateCode }, + }) + return affiliate + } +} diff --git a/apps/api/src/affiliate/dto/affiliate-status-update.dto.ts b/apps/api/src/affiliate/dto/affiliate-status-update.dto.ts new file mode 100644 index 000000000..f0bb8e0b3 --- /dev/null +++ b/apps/api/src/affiliate/dto/affiliate-status-update.dto.ts @@ -0,0 +1,12 @@ +import { ApiProperty } from '@nestjs/swagger' +import { AffiliateStatus } from '@prisma/client' +import { Expose } from 'class-transformer' +import { IsEnum, IsString } from 'class-validator' + +export class AffiliateStatusUpdateDto { + @ApiProperty() + @IsString() + @Expose() + @IsEnum(AffiliateStatus) + newStatus: AffiliateStatus +} diff --git a/apps/api/src/app/app.module.ts b/apps/api/src/app/app.module.ts index e3d8985e6..555aa4f86 100644 --- a/apps/api/src/app/app.module.ts +++ b/apps/api/src/app/app.module.ts @@ -56,6 +56,7 @@ import { CacheModule } from '@nestjs/cache-manager' import { CampaignNewsModule } from '../campaign-news/campaign-news.module' import { CampaignNewsFileModule } from '../campaign-news-file/campaign-news-file.module' import { MarketingNotificationsModule } from '../notifications/notifications.module' +import { AffiliateModule } from '../affiliate/affiliate.module' @Module({ imports: [ @@ -75,6 +76,7 @@ import { MarketingNotificationsModule } from '../notifications/notifications.mod TasksModule, /* Internal modules */ AuthModule, + AffiliateModule, AccountModule, CampaignModule, CampaignFileModule, 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 new file mode 100644 index 000000000..b69cf7398 --- /dev/null +++ b/apps/api/src/domain/generated/affiliate/dto/connect-affiliate.dto.ts @@ -0,0 +1,7 @@ + + 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 new file mode 100644 index 000000000..066932149 --- /dev/null +++ b/apps/api/src/domain/generated/affiliate/dto/create-affiliate.dto.ts @@ -0,0 +1,9 @@ + + + + + + +export class CreateAffiliateDto { + affiliateCode?: string; +} diff --git a/apps/api/src/domain/generated/affiliate/dto/index.ts b/apps/api/src/domain/generated/affiliate/dto/index.ts new file mode 100644 index 000000000..eecad5a60 --- /dev/null +++ b/apps/api/src/domain/generated/affiliate/dto/index.ts @@ -0,0 +1,4 @@ + +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 new file mode 100644 index 000000000..249e8598a --- /dev/null +++ b/apps/api/src/domain/generated/affiliate/dto/update-affiliate.dto.ts @@ -0,0 +1,9 @@ + + + + + + +export class UpdateAffiliateDto { + 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 new file mode 100644 index 000000000..e9e5e6de5 --- /dev/null +++ b/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts @@ -0,0 +1,12 @@ + +import {AffiliateStatus} from '@prisma/client' +import {Company} from '../../company/entities/company.entity' + + +export class Affiliate { + id: string ; +status: AffiliateStatus ; +affiliateCode: string | null; +companyId: string | null; +company?: Company | null; +} diff --git a/apps/api/src/domain/generated/affiliate/entities/index.ts b/apps/api/src/domain/generated/affiliate/entities/index.ts new file mode 100644 index 000000000..159cc623d --- /dev/null +++ b/apps/api/src/domain/generated/affiliate/entities/index.ts @@ -0,0 +1,2 @@ + +export * from './affiliate.entity'; \ No newline at end of file diff --git a/apps/api/src/person/dto/create-person.dto.ts b/apps/api/src/person/dto/create-person.dto.ts index 64b3b25ac..267d78a81 100644 --- a/apps/api/src/person/dto/create-person.dto.ts +++ b/apps/api/src/person/dto/create-person.dto.ts @@ -31,12 +31,6 @@ export class CreatePersonDto { @IsOptional() phone?: string - @ApiProperty() - @Expose() - @IsString() - @IsOptional() - company?: string - @ApiProperty() @Expose() @IsBoolean() diff --git a/apps/api/src/person/dto/update-person.dto.ts b/apps/api/src/person/dto/update-person.dto.ts index b2b10ec4a..c679771bc 100644 --- a/apps/api/src/person/dto/update-person.dto.ts +++ b/apps/api/src/person/dto/update-person.dto.ts @@ -27,11 +27,6 @@ export class UpdatePersonDto { @IsOptional() phone?: string - @ApiProperty() - @Expose() - @IsOptional() - company?: string - @ApiProperty() @Expose() @IsBoolean() diff --git a/apps/api/src/person/person.service.ts b/apps/api/src/person/person.service.ts index a7d4ae702..1e99e7e20 100644 --- a/apps/api/src/person/person.service.ts +++ b/apps/api/src/person/person.service.ts @@ -115,7 +115,7 @@ export class PersonService { } async findOneByKeycloakId(keycloakId: string) { - return await this.prisma.person.findFirst({ where: { keycloakId } }) + return await this.prisma.person.findFirst({ where: { keycloakId }, include: { company: true } }) } async update(id: string, updatePersonDto: UpdatePersonDto) { diff --git a/apps/api/src/support/dto/create-inquiry.dto.ts b/apps/api/src/support/dto/create-inquiry.dto.ts index 19ec5a748..8bc1c304b 100644 --- a/apps/api/src/support/dto/create-inquiry.dto.ts +++ b/apps/api/src/support/dto/create-inquiry.dto.ts @@ -10,7 +10,6 @@ export class CreateInquiryDto extends PickType(CreatePersonDto, [ 'lastName', 'email', 'phone', - 'company', 'newsletter', ]) { @ApiProperty() @@ -28,7 +27,6 @@ export class CreateInquiryDto extends PickType(CreatePersonDto, [ lastName: this.lastName, email: this.email, phone: this.phone, - company: this.company, }, where: { email: this.email }, }, diff --git a/db/seed/person/data.ts b/db/seed/person/data.ts index e76582749..7429be5fa 100644 --- a/db/seed/person/data.ts +++ b/db/seed/person/data.ts @@ -9,7 +9,6 @@ export const adminUser: Person = personFactory.build({ firstName: 'Admin', lastName: 'Dev', email: 'admin@podkrepi.bg', - company: 'Podkrepi.bg', keycloakId: '6892fe15-d116-4aec-a417-82ebd990b63a', }) @@ -17,7 +16,6 @@ export const coordinatorUser: Person = personFactory.build({ firstName: 'Coordinator', lastName: 'Dev', email: 'coordinator@podkrepi.bg', - company: 'Podkrepi.bg', keycloakId: '81d93c73-db28-4402-8ec0-a5b1709ed1cf', }) @@ -25,7 +23,6 @@ export const giverUser: Person = personFactory.build({ firstName: 'Giver', lastName: 'Dev', email: 'giver@podkrepi.bg', - company: 'Podkrepi.bg', keycloakId: '190486ff-7f0e-4e28-94ca-b624726b5389', }) @@ -33,7 +30,6 @@ export const receiverUser: Person = personFactory.build({ firstName: 'Receiver', lastName: 'Dev', email: 'receiver@podkrepi.bg', - company: 'Podkrepi.bg', keycloakId: '6c688460-73ec-414c-8252-986b0658002b', }) @@ -41,6 +37,5 @@ export const reviewerUser: Person = personFactory.build({ firstName: 'Reviewer', lastName: 'Dev', email: 'reviewer@podkrepi.bg', - company: 'Podkrepi.bg', keycloakId: '36bec201-b203-46ad-a8c3-43a0128c73e1', }) diff --git a/libs/podkrepi-types/src/lib/person/create-person.dto.ts b/libs/podkrepi-types/src/lib/person/create-person.dto.ts index b4251c277..fa3263903 100644 --- a/libs/podkrepi-types/src/lib/person/create-person.dto.ts +++ b/libs/podkrepi-types/src/lib/person/create-person.dto.ts @@ -29,12 +29,6 @@ export class CreatePersonDto { @IsString() public readonly phone: string - @ApiProperty({ nullable: true, required: false }) - @Expose() - @IsOptional() - @IsString() - public readonly company: string | null - @ApiProperty({ nullable: true, required: false }) @Expose() @IsOptional() @@ -61,7 +55,6 @@ export class CreatePersonDto { email: this.email, phone: this.phone, newsletter: this.newsletter, - company: this.company, address: this.address, birthday: this.birthday, } diff --git a/migrations/20231009151309_affiliate_program_initial_changes/migration.sql b/migrations/20231009151309_affiliate_program_initial_changes/migration.sql new file mode 100644 index 000000000..458dab97f --- /dev/null +++ b/migrations/20231009151309_affiliate_program_initial_changes/migration.sql @@ -0,0 +1,48 @@ +/* + Warnings: + + - You are about to drop the column `personId` on the `companies` table. All the data in the column will be lost. + - You are about to drop the column `company` on the `people` table. All the data in the column will be lost. + - A unique constraint covering the columns `[person_id]` on the table `companies` will be added. If there are existing duplicate values, this will fail. + +*/ +-- CreateEnum +CREATE TYPE "AffiliateStatus" AS ENUM ('active', 'pending', 'cancelled', 'rejected'); + +-- DropForeignKey +ALTER TABLE "companies" DROP CONSTRAINT "companies_personId_fkey"; + +-- DropIndex +DROP INDEX "companies_personId_key"; + +-- AlterTable +ALTER TABLE "companies" DROP COLUMN "personId", +ADD COLUMN "person_id" UUID; + +-- AlterTable +ALTER TABLE "people" DROP COLUMN "company"; + +-- CreateTable +CREATE TABLE "affiliates" ( + "id" UUID NOT NULL DEFAULT gen_random_uuid(), + "status" "AffiliateStatus" NOT NULL DEFAULT 'pending', + "affiliate_code" TEXT, + "company_id" UUID, + + CONSTRAINT "affiliates_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "affiliates_affiliate_code_key" ON "affiliates"("affiliate_code"); + +-- CreateIndex +CREATE UNIQUE INDEX "affiliates_company_id_key" ON "affiliates"("company_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "companies_person_id_key" ON "companies"("person_id"); + +-- AddForeignKey +ALTER TABLE "companies" ADD CONSTRAINT "companies_person_id_fkey" FOREIGN KEY ("person_id") REFERENCES "people"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "affiliates" ADD CONSTRAINT "affiliates_company_id_fkey" FOREIGN KEY ("company_id") REFERENCES "companies"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/podkrepi.dbml b/podkrepi.dbml index 89e170192..f13d23901 100644 --- a/podkrepi.dbml +++ b/podkrepi.dbml @@ -13,7 +13,6 @@ Table people { lastName String [not null] email String [unique] phone String - company String createdAt DateTime [default: `now()`, not null] updatedAt DateTime newsletter Boolean [default: false] @@ -45,6 +44,7 @@ https://en.wikipedia.org/wiki/National_identification_number#Bulgaria'] withdrawals withdrawals [not null] publishedNews campaign_news [not null] newsFiles campaign_news_files [not null] + company companies Note: 'Generic person object' } @@ -57,10 +57,21 @@ https://psc.egov.bg/en/psc-starting-a-business-bulstat'] legalPersonName String countryCode String cityId String + personId String [unique] createdAt DateTime [default: `now()`, not null] updatedAt DateTime beneficiaries beneficiaries [not null] Campaign campaigns [not null] + person people + affiliate affiliates +} + +Table affiliates { + id String [pk] + status AffiliateStatus [not null, default: 'pending'] + affiliateCode String [unique] + companyId String [unique] + company companies } Table organizers { @@ -712,6 +723,13 @@ Enum CampaignTypeCategory { others } +Enum AffiliateStatus { + active + pending + cancelled + rejected +} + Enum CampaignFileRole { background coordinator @@ -764,6 +782,10 @@ Enum EmailType { raised100 } +Ref: companies.personId - people.id + +Ref: affiliates.companyId - companies.id + Ref: organizers.personId - people.id Ref: coordinators.personId - people.id diff --git a/schema.prisma b/schema.prisma index 62a2b2f1e..d2dce3f18 100644 --- a/schema.prisma +++ b/schema.prisma @@ -1,6 +1,6 @@ generator client { - provider = "prisma-client-js" - binaryTargets = ["native"] + provider = "prisma-client-js" + binaryTargets = ["native"] } generator dbml { @@ -36,7 +36,6 @@ model Person { lastName String @map("last_name") @db.VarChar(100) email String? @unique @db.Citext phone String? @db.VarChar(50) - company String? @db.VarChar(50) createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6) updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) // Receive marketing notifications @@ -71,7 +70,7 @@ model Person { withdrawals Withdrawal[] publishedNews CampaignNews[] newsFiles CampaignNewsFile[] - Company Company? + company Company? @@index([keycloakId], map: "keycloak_id_idx") @@index([stripeCustomerId], map: "stripe_customer_id_idx") @@ -87,16 +86,27 @@ model Company { legalPersonName String? @map("legal_person_name") countryCode String? @map("country_code") @db.Citext cityId String? @map("city_id") @db.Uuid - personId String? @unique @db.Uuid + personId String? @unique @map("person_id") @db.Uuid createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6) updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) beneficiaries Beneficiary[] Campaign Campaign[] - person Person? @relation(fields: [personId], references: [id]) + person Person? @relation(fields: [personId], references: [id]) + affiliate Affiliate? @@map("companies") } +model Affiliate { + id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid + status AffiliateStatus @default(pending) + affiliateCode String? @unique @map("affiliate_code") + companyId String? @unique @map("company_id") @db.Uuid + company Company? @relation(fields: [companyId], references: [id]) + + @@map("affiliates") +} + /// Organizer is the person who manages the campaign on behalf of the Beneficiary model Organizer { id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid @@ -262,9 +272,9 @@ model MarketingTemplates { // Stores marketing notifications consents for non-registered emails model UnregisteredNotificationConsent { - id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid - email String @unique @db.Citext - consent Boolean @default(false) + id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid + email String @unique @db.Citext + consent Boolean @default(false) @@map("unregistered_notification_consent") } @@ -882,6 +892,13 @@ enum CampaignTypeCategory { @@map("campaign_type_category") } +enum AffiliateStatus { + active + pending + cancelled + rejected +} + enum CampaignFileRole { background coordinator From 254cca64332dd435a0d4a16b08272625c15215e1 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 10 Oct 2023 16:38:43 +0300 Subject: [PATCH 04/79] Run prisma migrate --- .../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 | 11 +- .../company/dto/create-company.dto.ts | 16 ++- .../src/domain/generated/company/dto/index.ts | 7 +- .../company/dto/update-company.dto.ts | 16 ++- .../company/entities/company.entity.ts | 31 +++-- .../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 | 48 ++++---- .../generated/donation/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 | 16 +-- .../generated/person/dto/create-person.dto.ts | 31 +++-- .../src/domain/generated/person/dto/index.ts | 7 +- .../generated/person/dto/update-person.dto.ts | 31 +++-- .../domain/generated/person/entities/index.ts | 3 +- .../person/entities/person.entity.ts | 115 +++++++++--------- .../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 +++---- 196 files changed, 1647 insertions(+), 1092 deletions(-) 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 6a9934cb6..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,4 +1,7 @@ -export class ConnectCompanyDto { - id?: string - companyNumber?: 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 b07f75937..112541f83 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,7 +1,13 @@ + + + + + + export class CreateCompanyDto { - companyName: string - companyNumber: string - legalPersonName?: string - countryCode?: string - cityId?: string + companyName: string; +companyNumber: string; +legalPersonName?: string; +countryCode?: string; +cityId?: 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 d392ddae9..b80c9f08f 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,7 +1,13 @@ + + + + + + export class UpdateCompanyDto { - companyName?: string - companyNumber?: string - legalPersonName?: string - countryCode?: string - cityId?: string + companyName?: string; +companyNumber?: string; +legalPersonName?: string; +countryCode?: string; +cityId?: 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 d51860fdc..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,15 +1,22 @@ -import { Beneficiary } from '../../beneficiary/entities/beneficiary.entity' -import { Campaign } from '../../campaign/entities/campaign.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 - createdAt: Date - updatedAt: Date | null - beneficiaries?: Beneficiary[] - Campaign?: Campaign[] + 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 d5c61d33e..4ee4aacc1 100644 --- a/apps/api/src/domain/generated/donation/entities/donation.entity.ts +++ b/apps/api/src/domain/generated/donation/entities/donation.entity.ts @@ -1,26 +1,28 @@ -import { DonationType, DonationStatus, PaymentProvider, Currency } from '@prisma/client' -import { Person } from '../../person/entities/person.entity' -import { Vault } from '../../vault/entities/vault.entity' -import { DonationWish } from '../../donationWish/entities/donationWish.entity' + +import {DonationType,DonationStatus,PaymentProvider,Currency} from '@prisma/client' +import {Person} from '../../person/entities/person.entity' +import {Vault} from '../../vault/entities/vault.entity' +import {DonationWish} from '../../donationWish/entities/donationWish.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 - personId: string | null - billingEmail: string | null - billingName: string | null - chargedAmount: number - person?: Person | null - targetVault?: Vault - DonationWish?: DonationWish | 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 ; +personId: string | null; +billingEmail: string | null; +billingName: string | null; +chargedAmount: number ; +person?: Person | null; +targetVault?: Vault ; +DonationWish?: DonationWish | 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/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 d55e53344..86d1a1669 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,7 +1,9 @@ -export class ConnectPersonDto { - id?: string - email?: string - personalNumber?: string - keycloakId?: string - stripeCustomerId?: string -} + + export class ConnectPersonDto { + id?: string; +email?: string; +personalNumber?: 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 a00ddc345..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,15 +1,20 @@ + + + + + + export class CreatePersonDto { - firstName: string - lastName: string - email?: string - phone?: string - company?: 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 8ab942283..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,15 +1,20 @@ + + + + + + export class UpdatePersonDto { - firstName?: string - lastName?: string - email?: string - phone?: string - company?: 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 70484e54e..0c2f4455f 100644 --- a/apps/api/src/domain/generated/person/entities/person.entity.ts +++ b/apps/api/src/domain/generated/person/entities/person.entity.ts @@ -1,59 +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 {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 - company: string | null - createdAt: Date - updatedAt: Date | null - newsletter: boolean | null - address: string | null - birthday: Date | null - emailConfirmed: boolean | null - personalNumber: string | null - keycloakId: string | null - stripeCustomerId: string | null - picture: string | null - 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[] + 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; +keycloakId: string | null; +stripeCustomerId: string | null; +picture: string | null; +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 50024266b7f204ec352f780e98c720d3dabb3a70 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 12 Oct 2023 18:38:06 +0300 Subject: [PATCH 05/79] schema.prisma: Add donation relation to Affiliate model --- .../domain/generated/affiliate/entities/affiliate.entity.ts | 2 ++ .../domain/generated/donation/entities/donation.entity.ts | 3 +++ .../migration.sql | 5 +++++ podkrepi.dbml | 5 +++++ schema.prisma | 3 +++ 5 files changed, 18 insertions(+) create mode 100644 migrations/20231012153756_add_donation_relation_to_affiliate/migration.sql 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 e9e5e6de5..248d71e6c 100644 --- a/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts +++ b/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts @@ -1,6 +1,7 @@ import {AffiliateStatus} from '@prisma/client' import {Company} from '../../company/entities/company.entity' +import {Donation} from '../../donation/entities/donation.entity' export class Affiliate { @@ -9,4 +10,5 @@ status: AffiliateStatus ; affiliateCode: string | null; companyId: string | null; company?: Company | null; +donations?: Donation[] ; } 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 4ee4aacc1..f817a10d4 100644 --- a/apps/api/src/domain/generated/donation/entities/donation.entity.ts +++ b/apps/api/src/domain/generated/donation/entities/donation.entity.ts @@ -2,6 +2,7 @@ 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' @@ -18,11 +19,13 @@ 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; } diff --git a/migrations/20231012153756_add_donation_relation_to_affiliate/migration.sql b/migrations/20231012153756_add_donation_relation_to_affiliate/migration.sql new file mode 100644 index 000000000..9a1aa4ec8 --- /dev/null +++ b/migrations/20231012153756_add_donation_relation_to_affiliate/migration.sql @@ -0,0 +1,5 @@ +-- AlterTable +ALTER TABLE "donations" ADD COLUMN "affiliate_id" UUID; + +-- AddForeignKey +ALTER TABLE "donations" ADD CONSTRAINT "donations_affiliate_id_fkey" FOREIGN KEY ("affiliate_id") REFERENCES "affiliates"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/podkrepi.dbml b/podkrepi.dbml index f13d23901..1f78741f9 100644 --- a/podkrepi.dbml +++ b/podkrepi.dbml @@ -72,6 +72,7 @@ Table affiliates { affiliateCode String [unique] companyId String [unique] company companies + donations donations [not null] } Table organizers { @@ -377,12 +378,14 @@ Table donations { updatedAt DateTime amount Int [not null, default: 0] currency Currency [not null, default: 'BGN'] + affiliateId String personId String billingEmail String billingName String chargedAmount Int [not null, default: 0] person people targetVault vaults [not null] + affiliate affiliates DonationWish donation_wishes } @@ -852,6 +855,8 @@ Ref: donations.personId > people.id Ref: donations.targetVaultId > vaults.id +Ref: donations.affiliateId > affiliates.id + Ref: donation_wishes.campaignId > campaigns.id Ref: donation_wishes.personId > people.id diff --git a/schema.prisma b/schema.prisma index d2dce3f18..b5eb81bfa 100644 --- a/schema.prisma +++ b/schema.prisma @@ -103,6 +103,7 @@ model Affiliate { affiliateCode String? @unique @map("affiliate_code") companyId String? @unique @map("company_id") @db.Uuid company Company? @relation(fields: [companyId], references: [id]) + donations Donation[] @@map("affiliates") } @@ -459,12 +460,14 @@ model Donation { updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) amount Int @default(0) currency Currency @default(BGN) + affiliateId String? @map("affiliate_id") @db.Uuid personId String? @map("person_id") @db.Uuid billingEmail String? @map("billing_email") @db.VarChar billingName String? @map("billing_name") @db.VarChar chargedAmount Int @default(0) person Person? @relation(fields: [personId], references: [id]) targetVault Vault @relation(fields: [targetVaultId], references: [id]) + affiliate Affiliate? @relation(fields: [affiliateId], references: [id]) DonationWish DonationWish? @@map("donations") From a0e658d9f90a7f7b3e1341b1f896967f6cf27092 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Fri, 13 Oct 2023 11:51:55 +0300 Subject: [PATCH 06/79] schema.prisma: Add guaranteed status for donations --- .../20231013085126_add_guaranteed_donation_status/migration.sql | 2 ++ schema.prisma | 1 + 2 files changed, 3 insertions(+) create mode 100644 migrations/20231013085126_add_guaranteed_donation_status/migration.sql diff --git a/migrations/20231013085126_add_guaranteed_donation_status/migration.sql b/migrations/20231013085126_add_guaranteed_donation_status/migration.sql new file mode 100644 index 000000000..0f5752d80 --- /dev/null +++ b/migrations/20231013085126_add_guaranteed_donation_status/migration.sql @@ -0,0 +1,2 @@ +-- AlterEnum +ALTER TYPE "donation_status" ADD VALUE 'guaranteed'; diff --git a/schema.prisma b/schema.prisma index b5eb81bfa..74d1a7898 100644 --- a/schema.prisma +++ b/schema.prisma @@ -792,6 +792,7 @@ enum DonationStatus { declined waiting cancelled + guaranteed succeeded deleted refund From d00ff8196bf42caf328d492e90652049bce2b74f Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 16 Oct 2023 12:31:33 +0300 Subject: [PATCH 07/79] Add affiliateId to testing and seeding scripts --- apps/api/src/campaign/campaign.service.ts | 1 + apps/api/src/donations/events/stripe-payment.service.spec.ts | 2 ++ db/seed/donation/factory.ts | 1 + db/seed/person/factory.ts | 1 - 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/api/src/campaign/campaign.service.ts b/apps/api/src/campaign/campaign.service.ts index e46c60d62..4f676438c 100644 --- a/apps/api/src/campaign/campaign.service.ts +++ b/apps/api/src/campaign/campaign.service.ts @@ -524,6 +524,7 @@ export class CampaignService { id: true, type: true, status: true, + affiliateId: true, provider: true, createdAt: true, updatedAt: true, diff --git a/apps/api/src/donations/events/stripe-payment.service.spec.ts b/apps/api/src/donations/events/stripe-payment.service.spec.ts index 07f4a997b..ab3a7569a 100644 --- a/apps/api/src/donations/events/stripe-payment.service.spec.ts +++ b/apps/api/src/donations/events/stripe-payment.service.spec.ts @@ -267,6 +267,7 @@ describe('StripePaymentService', () => { type: DonationType.donation, status: DonationStatus.waiting, provider: 'stripe', + affiliateId: null, extCustomerId: paymentData.stripeCustomerId ?? '', extPaymentIntentId: paymentData.paymentIntentId, extPaymentMethodId: 'card', @@ -368,6 +369,7 @@ describe('StripePaymentService', () => { type: DonationType.donation, status: DonationStatus.waiting, provider: 'stripe', + affiliateId: '', extCustomerId: paymentData.stripeCustomerId ?? '', extPaymentIntentId: paymentData.paymentIntentId, extPaymentMethodId: 'card', diff --git a/db/seed/donation/factory.ts b/db/seed/donation/factory.ts index c27af5ab1..d0f40799a 100644 --- a/db/seed/donation/factory.ts +++ b/db/seed/donation/factory.ts @@ -6,6 +6,7 @@ import { Currency, DonationStatus, DonationType, PaymentProvider } from '@prisma export const donationFactory = Factory.define(({ associations }) => ({ id: faker.datatype.uuid(), + affiliateId: null, type: faker.helpers.arrayElement(Object.values(DonationType)), status: faker.helpers.arrayElement(Object.values(DonationStatus)), provider: faker.helpers.arrayElement(Object.values(PaymentProvider)), diff --git a/db/seed/person/factory.ts b/db/seed/person/factory.ts index 0792f32e5..0414d1445 100644 --- a/db/seed/person/factory.ts +++ b/db/seed/person/factory.ts @@ -14,7 +14,6 @@ export const personFactory = Factory.define(() => ({ picture: faker.image.imageUrl(), phone: faker.phone.number('+359########'), personalNumber: faker.random.numeric(10), - company: faker.company.name(), address: `${faker.address.street()}, ${faker.address.cityName()}`, birthday: faker.date.birthdate(), newsletter: faker.datatype.boolean(), From f8e72524906da4b0cf3ac5d1ebe9ba78f6916c51 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 16 Oct 2023 14:01:07 +0300 Subject: [PATCH 08/79] validation: Set exposeDefaultValues to true globally Would allow us to set default values to fields directly in the dto, which might result in cleaner code. --- apps/api/src/config/validation.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/api/src/config/validation.config.ts b/apps/api/src/config/validation.config.ts index 7928c67cc..6819acc64 100644 --- a/apps/api/src/config/validation.config.ts +++ b/apps/api/src/config/validation.config.ts @@ -9,6 +9,7 @@ const globalValidationPipe = new ValidationPipe({ transformOptions: { strategy: 'exposeAll', excludeExtraneousValues: true, + exposeDefaultValues: true, }, stopAtFirstError: false, forbidUnknownValues: true, From fc847c353b0937f6a720278f3c2c20d003ddf314 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 17 Oct 2023 12:23:17 +0300 Subject: [PATCH 09/79] src/affiliate: Implement endpoints for creating/cancelling donations Affiliate donations will be marked as guaranteed by default --- .../api/src/affiliate/affiliate.controller.ts | 53 ++++++++++- apps/api/src/affiliate/affiliate.module.ts | 3 +- apps/api/src/affiliate/affiliate.service.ts | 7 ++ .../dto/cancel-affiliate-donation.dto.ts | 11 +++ .../dto/create-affiliate-donation.dto.ts | 92 +++++++++++++++++++ apps/api/src/donations/donations.service.ts | 36 ++++++++ .../helpers/donation-status-updates.ts | 1 + 7 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 apps/api/src/affiliate/dto/cancel-affiliate-donation.dto.ts create mode 100644 apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index 7ebf32736..59d5863e2 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -4,6 +4,7 @@ import { ConflictException, Controller, ForbiddenException, + Get, NotFoundException, Param, Patch, @@ -12,10 +13,14 @@ import { import { ApiTags } from '@nestjs/swagger' import { PersonService } from '../person/person.service' import { KeycloakTokenParsed, isAdmin } from '../auth/keycloak' -import { AuthenticatedUser } from 'nest-keycloak-connect' +import { AuthenticatedUser, Public } from 'nest-keycloak-connect' import { AffiliateService } from './affiliate.service' import { AffiliateStatusUpdateDto } from './dto/affiliate-status-update.dto' import { getPaymentReference } from '../campaign/helpers/payment-reference' +import { CreateAffiliateDonation } from './dto/create-affiliate-donation.dto' +import { DonationsService } from '../donations/donations.service' +import { CancelAffiliateDonation } from './dto/cancel-affiliate-donation.dto' +import { shouldAllowStatusChange } from '../donations/helpers/donation-status-updates' @Controller('affiliate') @ApiTags('affiliate') @@ -23,6 +28,7 @@ export class AffiliateController { constructor( private readonly personService: PersonService, private readonly affiliateService: AffiliateService, + private readonly donationService: DonationsService, ) {} @Post('join') @@ -55,4 +61,49 @@ export class AffiliateController { return await this.affiliateService.updateStatus(affiliateId, newStatus, affiliate.affiliateCode) } + + @Get(':affiliateCode') + @Public() + async affiliateSummary(@Param('affiliateCode') affilliateCode: string) { + return await this.affiliateService.findOneByCode(affilliateCode) + } + + @Post(':affiliateCode/donations/create') + @Public() + async createAffiliateDonation( + @Param('affiliateCode') affiliateCode: string, + @Body() donation: CreateAffiliateDonation, + ) { + const affiliate = await this.affiliateService.findOneByCode(affiliateCode) + if (!affiliate || !affiliate.company || !affiliate.company.person) + throw new NotFoundException('Affiliate not found') + + const affiliateDonationDto: CreateAffiliateDonation = { + ...donation, + affiliateId: affiliate.id, + personId: donation.isAnonymous ? null : affiliate.company.person!.id, + billingEmail: affiliate.company.person!.email, + toEntity: donation.toEntity, + } + + return await this.donationService.createAffiliateDonation(affiliateDonationDto) + } + + @Patch(':affiliateCode/donations/cancel') + @Public() + async cancelAffiliateDonation( + @Param('affiliateCode') affiliateCode: string, + @Body() donationDto: CancelAffiliateDonation, + ) { + const donation = await this.donationService.getAffiliateDonationById( + donationDto.donationId, + affiliateCode, + ) + if (!donation) throw new NotFoundException('Donation with this id is not found') + + if (!shouldAllowStatusChange(donation.status, 'cancelled')) + throw new BadRequestException("Donation status can't be updated") + + return await this.donationService.update(donation.id, { status: 'cancelled' }) + } } diff --git a/apps/api/src/affiliate/affiliate.module.ts b/apps/api/src/affiliate/affiliate.module.ts index 42383eaab..0f081100f 100644 --- a/apps/api/src/affiliate/affiliate.module.ts +++ b/apps/api/src/affiliate/affiliate.module.ts @@ -3,10 +3,11 @@ import { AffiliateController } from './affiliate.controller' import { AffiliateService } from './affiliate.service' import { PersonModule } from '../person/person.module' import { PrismaService } from '../prisma/prisma.service' +import { DonationsModule } from '../donations/donations.module' @Module({ controllers: [AffiliateController], providers: [AffiliateService, PrismaService], - imports: [PersonModule], + imports: [PersonModule, DonationsModule], }) export class AffiliateModule {} diff --git a/apps/api/src/affiliate/affiliate.service.ts b/apps/api/src/affiliate/affiliate.service.ts index e6625f858..7994a96cd 100644 --- a/apps/api/src/affiliate/affiliate.service.ts +++ b/apps/api/src/affiliate/affiliate.service.ts @@ -17,6 +17,13 @@ export class AffiliateService { return await this.prismaService.affiliate.findUnique({ where: { id } }) } + async findOneByCode(affiliateCode: string) { + return await this.prismaService.affiliate.findUnique({ + where: { affiliateCode }, + include: { donations: true, company: { select: { person: true } } }, + }) + } + async updateStatus( affiliateId: string, status: AffiliateStatus, diff --git a/apps/api/src/affiliate/dto/cancel-affiliate-donation.dto.ts b/apps/api/src/affiliate/dto/cancel-affiliate-donation.dto.ts new file mode 100644 index 000000000..08eecf672 --- /dev/null +++ b/apps/api/src/affiliate/dto/cancel-affiliate-donation.dto.ts @@ -0,0 +1,11 @@ +import { ApiProperty } from '@nestjs/swagger' +import { Expose } from 'class-transformer' +import { IsString, IsUUID } from 'class-validator' + +export class CancelAffiliateDonation { + @ApiProperty() + @Expose() + @IsUUID() + @IsString() + donationId: string +} diff --git a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts new file mode 100644 index 000000000..60aa749b2 --- /dev/null +++ b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts @@ -0,0 +1,92 @@ +import { ApiProperty } from '@nestjs/swagger' +import { Currency, DonationStatus, DonationType, PaymentProvider, Prisma } from '@prisma/client' +import { Expose } from 'class-transformer' +import { Equals, IsBoolean, IsEnum, IsNumber, IsOptional, IsString, IsUUID } from 'class-validator' +import { randomUUID } from 'crypto' + +export class CreateAffiliateDonation { + @ApiProperty() + @Expose() + @IsUUID() + @IsString() + campaignId: string + + @ApiProperty() + @Expose() + @IsUUID() + @IsString() + @IsOptional() + affiliateId: string | null = null + + @IsUUID() + @IsString() + @IsOptional() + personId: string | null = null + + @IsString() + extPaymentIntentId: string = 'pi_' + randomUUID() + + @IsString() + @IsOptional() + extPaymentMethodId: string = 'pm_' + randomUUID() + + @ApiProperty() + @Expose() + @IsEnum(Currency) + //Only BGN is accepted for now + @Equals(Currency.BGN) + @IsOptional() + @IsString() + currency: Currency = Currency.BGN + + @ApiProperty() + @Expose() + @IsNumber() + amount: number + + @ApiProperty() + @Expose() + @IsString() + billingName: string + + @IsString() + @IsOptional() + billingEmail: string | null + + @ApiProperty() + @Expose() + @IsBoolean() + isAnonymous: boolean + + @ApiProperty() + @Expose() + @IsUUID() + @IsString() + @IsOptional() + extCustomerId: string + + public toEntity(targetVaultId: string): Prisma.DonationCreateInput { + return { + type: DonationType.donation, + status: DonationStatus.guaranteed, + provider: PaymentProvider.bank, + currency: this.currency, + amount: this.amount, + extCustomerId: this.extCustomerId ?? '', + extPaymentIntentId: this.extPaymentIntentId, + extPaymentMethodId: this.extPaymentMethodId ?? '', + billingEmail: this.billingEmail, + billingName: this.billingName, + targetVault: { + connect: { + id: targetVaultId, + }, + }, + affiliate: this.affiliateId ? { connect: { id: this.affiliateId } } : {}, + person: + this.isAnonymous === false && this.billingEmail + ? { connect: { email: this.billingEmail } } + : {}, + } + } +} diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index ed6eb1f0f..1ae9a7e38 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -3,6 +3,7 @@ import { ConfigService } from '@nestjs/config' import { InjectStripeClient } from '@golevelup/nestjs-stripe' import { BadRequestException, Injectable, Logger, NotFoundException } from '@nestjs/common' import { + AffiliateStatus, Campaign, Donation, DonationStatus, @@ -27,6 +28,7 @@ import { donationWithPerson, DonationWithPerson } from './queries/donation.valid import { CreateStripePaymentDto } from './dto/create-stripe-payment.dto' import { ImportStatus } from '../bank-transactions-file/dto/bank-transactions-import-status.dto' import { DonationQueryDto } from '../common/dto/donation-query-dto' +import { CreateAffiliateDonation } from '../affiliate/dto/create-affiliate-donation.dto' @Injectable() export class DonationsService { @@ -318,6 +320,16 @@ export class DonationsService { return result } + async createAffiliateDonation(donation: CreateAffiliateDonation) { + const vault = await this.vaultService.findByCampaignId(donation.campaignId) + + if (!vault) throw new NotFoundException('Vault not found') + + return await this.prisma.donation.create({ + data: donation.toEntity(vault[0].id), + }) + } + /** * Lists all donations with all fields only for admin roles * @param campaignId (Optional) Filter by campaign id @@ -414,6 +426,18 @@ export class DonationsService { } } + async getAffiliateDonationById(donationId: string, affiliateCode: string) { + try { + const donation = await this.prisma.donation.findFirstOrThrow({ + where: { id: donationId, affiliate: { affiliateCode: affiliateCode } }, + }) + return donation + } catch (err) { + const msg = 'No Donation record with ID: ' + donationId + Logger.warn(msg) + throw new NotFoundException(msg) + } + } /** * Get donation by id with person data attached * @param id Donation id @@ -537,6 +561,18 @@ export class DonationsService { }) } + async updateAffiliateDonations(donationId: string, affiliateId: string, status: DonationStatus) { + const donation = await this.prisma.donation.update({ + where: { + id: donationId, + affiliateId: affiliateId, + }, + data: { + status, + }, + }) + return donation + } /** * Updates the donation's status or donor. Note: completed donations cannot have status updates. * @param id diff --git a/apps/api/src/donations/helpers/donation-status-updates.ts b/apps/api/src/donations/helpers/donation-status-updates.ts index c49a11d08..65c297fec 100644 --- a/apps/api/src/donations/helpers/donation-status-updates.ts +++ b/apps/api/src/donations/helpers/donation-status-updates.ts @@ -5,6 +5,7 @@ const changeable: DonationStatus[] = [ DonationStatus.incomplete, DonationStatus.paymentRequested, DonationStatus.waiting, + DonationStatus.guaranteed, ] const final: DonationStatus[] = [ DonationStatus.succeeded, From 7c7ea9449b37db87aca179dc8a78f478a0a55b7b Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 17 Oct 2023 13:09:53 +0300 Subject: [PATCH 10/79] src/campaign: Include guaranteedAmount in campaign's summary --- apps/api/src/campaign/campaign.service.ts | 11 ++++++++++- apps/api/src/campaign/dto/campaign-summary.dto.ts | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/api/src/campaign/campaign.service.ts b/apps/api/src/campaign/campaign.service.ts index 4f676438c..ad35f25f3 100644 --- a/apps/api/src/campaign/campaign.service.ts +++ b/apps/api/src/campaign/campaign.service.ts @@ -101,10 +101,11 @@ export class CampaignService { const result = await this.prisma.$queryRaw`SELECT SUM(d.reached)::INTEGER as "reachedAmount", + SUM(g.guaranteed)::INTEGER as "guaranteedAmount", (SUM(v.amount) - SUM(v."blockedAmount"))::INTEGER as "currentAmount", SUM(v."blockedAmount")::INTEGER as "blockedAmount", SUM(w."withdrawnAmount")::INTEGER as "withdrawnAmount", - SUM(d.donors)::INTEGER as donors, + SUM(COALESCE(g.donors, 0) + COALESCE(d.donors, 0))::INTEGER as donors, v.campaign_id as id FROM api.vaults v LEFT JOIN ( @@ -114,6 +115,13 @@ export class CampaignService { GROUP BY target_vault_id ) as d ON d.target_vault_id = v.id + LEFT JOIN ( + SELECT target_vault_id, sum(amount) as guaranteed, count(id) as donors + FROM api.donations d + WHERE status = 'guaranteed' + GROUP BY target_vault_id + ) as g + ON g.target_vault_id = v.id LEFT JOIN ( SELECT source_vault_id, sum(amount) as "withdrawnAmount" FROM api.withdrawals w @@ -1110,6 +1118,7 @@ export class CampaignService { currentAmount: csum?.currentAmount || 0, blockedAmount: csum?.blockedAmount || 0, withdrawnAmount: csum?.withdrawnAmount || 0, + guaranteedAmount: csum?.guaranteedAmount || 0, donors: csum?.donors || 0, } } diff --git a/apps/api/src/campaign/dto/campaign-summary.dto.ts b/apps/api/src/campaign/dto/campaign-summary.dto.ts index 63af3e73f..1950a9743 100644 --- a/apps/api/src/campaign/dto/campaign-summary.dto.ts +++ b/apps/api/src/campaign/dto/campaign-summary.dto.ts @@ -9,6 +9,9 @@ export class CampaignSummaryDto { @ApiProperty() reachedAmount: number + @ApiProperty() + guaranteedAmount: number + @ApiProperty() currentAmount: number From 8782e23a1b06010cdc62c489d2659caf5753f312 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Wed, 18 Oct 2023 16:07:50 +0300 Subject: [PATCH 11/79] tasks/bank-import: Handle affiliate donations --- .../bank-transactions-import-status.dto.ts | 1 + apps/api/src/donations/donations.service.ts | 12 +++ .../bank-import/import-transactions.task.ts | 79 ++++++++++++++++--- .../migration.sql | 2 + schema.prisma | 1 + 5 files changed, 85 insertions(+), 10 deletions(-) create mode 100644 migrations/20231017120302_add_incomplete_bank_donation_status/migration.sql diff --git a/apps/api/src/bank-transactions-file/dto/bank-transactions-import-status.dto.ts b/apps/api/src/bank-transactions-file/dto/bank-transactions-import-status.dto.ts index 439d48ce7..281a5c880 100644 --- a/apps/api/src/bank-transactions-file/dto/bank-transactions-import-status.dto.ts +++ b/apps/api/src/bank-transactions-file/dto/bank-transactions-import-status.dto.ts @@ -3,6 +3,7 @@ export enum ImportStatus { SUCCESS = 'SUCCESS', FAILED = 'FAILED', UPDATED = 'UPDATED', + INCOMPLETE = 'INCOMPLETE', } export type BankImportResult = { diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index 1ae9a7e38..dd319f8fd 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -561,6 +561,18 @@ export class DonationsService { }) } + async updateAffiliateBankPayment(donationDto: Donation) { + return await this.prisma.$transaction(async (tx) => { + await Promise.all([ + this.vaultService.incrementVaultAmount(donationDto.targetVaultId, donationDto.amount, tx), + tx.donation.update({ + where: { id: donationDto.id }, + data: { status: DonationStatus.succeeded }, + }), + ]) + }) + } + async updateAffiliateDonations(donationId: string, affiliateId: string, status: DonationStatus) { const donation = await this.prisma.donation.update({ where: { diff --git a/apps/api/src/tasks/bank-import/import-transactions.task.ts b/apps/api/src/tasks/bank-import/import-transactions.task.ts index 990d06327..8867634c6 100644 --- a/apps/api/src/tasks/bank-import/import-transactions.task.ts +++ b/apps/api/src/tasks/bank-import/import-transactions.task.ts @@ -31,8 +31,12 @@ import { ExpiringIrisConsentEmailDto, UnrecognizedDonationEmailDto, } from '../../email/template.interface' +import { ImportStatus } from '../../bank-transactions-file/dto/bank-transactions-import-status.dto' type filteredTransaction = Prisma.BankTransactionCreateManyInput +type AffiliatePayload = Prisma.AffiliateGetPayload<{ + include: { donations: true } +}> @Injectable() export class IrisTasks { @@ -269,7 +273,7 @@ export class IrisTasks { ibanAccount: IrisIbanAccountInfo, ) { const filteredTransactions: filteredTransaction[] = [] - + let matchedRef: string | null for (const trx of transactions) { // We're interested in parsing only incoming trx's if (trx.creditDebitIndicator !== 'CREDIT') { @@ -281,11 +285,16 @@ export class IrisTasks { continue } + if (trx.remittanceInformationUnstructured.startsWith('af_')) { + matchedRef = trx.remittanceInformationUnstructured + } else { + matchedRef = + trx.remittanceInformationUnstructured + ?.trim() + .replace(/[ _]+/g, '-') + .match(this.regexPaymentRef)![0] ?? null + } // Try to recognize campaign payment reference - let matchedRef = trx.remittanceInformationUnstructured - ?.trim() - .replace(/[ _]+/g, '-') - .match(this.regexPaymentRef) const transactionAmount = { amount: trx.transactionAmount?.amount, @@ -320,7 +329,7 @@ export class IrisTasks { currency: transactionAmount.currency, description: trx.remittanceInformationUnstructured?.trim(), // Not saved in the DB, it's added only for convinience and efficiency - matchedRef: matchedRef ? matchedRef[0] : null, + matchedRef: matchedRef ? matchedRef : null, }) } @@ -328,9 +337,33 @@ export class IrisTasks { } private async processDonations(bankTransactions: filteredTransaction[]) { - const matchedPaymentRef: string[] = [] + const campaignPaymentRef: string[] = [] + const affiliatePaymentRef: string[] = [] bankTransactions.forEach((trx) => { - if (trx.matchedRef) matchedPaymentRef.push(trx.matchedRef) + if (trx.matchedRef) { + trx.matchedRef.startsWith('af_') + ? affiliatePaymentRef.push(trx.matchedRef) + : campaignPaymentRef.push(trx.matchedRef) + } + }) + + const affiliates = await this.prisma.affiliate.findMany({ + where: { + affiliateCode: { + in: affiliatePaymentRef, + }, + }, + include: { + donations: { + where: { + status: DonationStatus.guaranteed, + }, + orderBy: { + createdAt: 'asc', + }, + include: { targetVault: true }, + }, + }, }) /* @@ -338,10 +371,11 @@ export class IrisTasks { than execute a separate one for each transaction - more performent and reliable approach */ + const campaigns = await this.prisma.campaign.findMany({ where: { paymentReference: { - in: matchedPaymentRef, + in: campaignPaymentRef, }, }, include: { @@ -359,7 +393,13 @@ export class IrisTasks { const campaign = campaigns.find((cmpgn) => cmpgn.paymentReference === trx.matchedRef) if (!campaign) { - trx.bankDonationStatus = BankDonationStatus.unrecognized + //Campaign not found by paymentReference. Check if it is affiliate donation + const affiliate = affiliates.find((affiliate) => affiliate.affiliateCode === trx.matchedRef) + if (!affiliate) { + trx.bankDonationStatus = BankDonationStatus.unrecognized + continue + } + await this.processAffiliateDonations(affiliate, trx) continue } @@ -377,6 +417,25 @@ export class IrisTasks { return bankTransactions } + private async processAffiliateDonations(affiliate: AffiliatePayload, trx: filteredTransaction) { + let totalDonated = 0 + let updatedDonations = 0 + if (!trx.amount) return + for (const donation of affiliate.donations) { + if (trx.amount - totalDonated < donation.amount) continue + await this.donationsService.updateAffiliateBankPayment(donation) + totalDonated += donation.amount + updatedDonations++ + } + if (trx.amount - totalDonated > 0 || updatedDonations < affiliate.donations.length) { + trx.bankDonationStatus = BankDonationStatus.incomplete + return ImportStatus.INCOMPLETE + } + + trx.bankDonationStatus = BankDonationStatus.imported + return ImportStatus.SUCCESS + } + private prepareBankPaymentObject( bankTransaction: Prisma.BankTransactionCreateManyInput, vault: Vault, diff --git a/migrations/20231017120302_add_incomplete_bank_donation_status/migration.sql b/migrations/20231017120302_add_incomplete_bank_donation_status/migration.sql new file mode 100644 index 000000000..dc956e7df --- /dev/null +++ b/migrations/20231017120302_add_incomplete_bank_donation_status/migration.sql @@ -0,0 +1,2 @@ +-- AlterEnum +ALTER TYPE "bank_donation_status" ADD VALUE 'incomplete'; diff --git a/schema.prisma b/schema.prisma index 74d1a7898..ce1de6aa8 100644 --- a/schema.prisma +++ b/schema.prisma @@ -874,6 +874,7 @@ enum BankTransactionType { enum BankDonationStatus { unrecognized imported + incomplete reImported @map("re_imported") importFailed @map("import_failed") From a8337a3b2be4c09b2cb257c6b7f30d47d3092c5d Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 19 Oct 2023 15:00:03 +0300 Subject: [PATCH 12/79] bank-transactions: Add endpoint to simulate IRIS transactions. Available only on development/staging enviroment --- apps/api/src/affiliate/affiliate.module.ts | 1 + apps/api/src/affiliate/affiliate.service.ts | 6 ++ .../bank-transactions.controller.ts | 27 +++++- .../bank-transactions.module.ts | 10 ++- .../bank-transactions.service.ts | 10 +++ .../bank-transactions-iris-simulate.dto.ts | 22 +++++ .../dto/iris-bank-account-info.dto.ts | 35 ++++++++ .../dto/iris-bank-transaction-info.dto.ts | 83 +++++++++++++++++++ .../bank-import/import-transactions.task.ts | 55 ++++++++++-- 9 files changed, 239 insertions(+), 10 deletions(-) create mode 100644 apps/api/src/bank-transactions/dto/bank-transactions-iris-simulate.dto.ts create mode 100644 apps/api/src/bank-transactions/dto/iris-bank-account-info.dto.ts create mode 100644 apps/api/src/bank-transactions/dto/iris-bank-transaction-info.dto.ts diff --git a/apps/api/src/affiliate/affiliate.module.ts b/apps/api/src/affiliate/affiliate.module.ts index 0f081100f..0e074e0e7 100644 --- a/apps/api/src/affiliate/affiliate.module.ts +++ b/apps/api/src/affiliate/affiliate.module.ts @@ -9,5 +9,6 @@ import { DonationsModule } from '../donations/donations.module' controllers: [AffiliateController], providers: [AffiliateService, PrismaService], imports: [PersonModule, DonationsModule], + exports: [AffiliateService], }) export class AffiliateModule {} diff --git a/apps/api/src/affiliate/affiliate.service.ts b/apps/api/src/affiliate/affiliate.service.ts index 7994a96cd..79f3b30e6 100644 --- a/apps/api/src/affiliate/affiliate.service.ts +++ b/apps/api/src/affiliate/affiliate.service.ts @@ -17,6 +17,12 @@ export class AffiliateService { return await this.prismaService.affiliate.findUnique({ where: { id } }) } + async findAffiliateByKecloakId(keycloakId: string) { + return await this.prismaService.affiliate.findFirst({ + where: { company: { person: { keycloakId } } }, + }) + } + async findOneByCode(affiliateCode: string) { return await this.prismaService.affiliate.findUnique({ where: { affiliateCode }, diff --git a/apps/api/src/bank-transactions/bank-transactions.controller.ts b/apps/api/src/bank-transactions/bank-transactions.controller.ts index 813e3bc6e..b8115e5f6 100644 --- a/apps/api/src/bank-transactions/bank-transactions.controller.ts +++ b/apps/api/src/bank-transactions/bank-transactions.controller.ts @@ -3,6 +3,7 @@ import { BadRequestException, Body, Controller, + ForbiddenException, Get, Logger, NotFoundException, @@ -14,7 +15,7 @@ import { } from '@nestjs/common' import { ApiQuery, ApiTags } from '@nestjs/swagger' import { RealmViewSupporters, ViewSupporters } from '@podkrepi-bg/podkrepi-types' -import { Roles, RoleMatchingMode, AuthenticatedUser } from 'nest-keycloak-connect' +import { Roles, RoleMatchingMode, AuthenticatedUser, Public } from 'nest-keycloak-connect' import { KeycloakTokenParsed, isAdmin } from '../auth/keycloak' import { BankTransactionsService } from './bank-transactions.service' import { @@ -24,6 +25,9 @@ import { import { CampaignService } from '../campaign/campaign.service' import { BankDonationStatus } from '@prisma/client' import { DateTime, Interval } from 'luxon' +import { ConfigService } from '@nestjs/config' +import { IrisBankTransactionSimulationDto } from './dto/bank-transactions-iris-simulate.dto' +import { AffiliateService } from '../affiliate/affiliate.service' @ApiTags('bank-transaction') @Controller('bank-transaction') @@ -31,6 +35,8 @@ export class BankTransactionsController { constructor( private readonly bankTransactionsService: BankTransactionsService, private readonly campaignService: CampaignService, + private readonly configService: ConfigService, + private readonly affiliateService: AffiliateService, ) {} @Get('list') @@ -145,4 +151,23 @@ export class BankTransactionsController { await this.bankTransactionsService.rerunBankTransactionsForDate(new Date(d.start.toISODate())) }) } + + @Post('iris-transaction-test') + async testIrisInsertion( + @Body() irisDto: IrisBankTransactionSimulationDto, + @AuthenticatedUser() user: KeycloakTokenParsed, + ) { + const appEnv = this.configService.get('APP_ENV') + const isDev = appEnv === 'development' || appEnv === 'staging' + if (!isDev) throw new ForbiddenException('Endpoint available only for testing enviroments') + + const affiliate = await this.affiliateService.findAffiliateByKecloakId(user.sub) + if (!isAdmin(user) && !affiliate) + throw new ForbiddenException('Must be either an admin or active affiliate') + + return await this.bankTransactionsService.simulateIrisTask( + irisDto.irisIbanAccountInfo, + irisDto.irisTransactionInfo, + ) + } } diff --git a/apps/api/src/bank-transactions/bank-transactions.module.ts b/apps/api/src/bank-transactions/bank-transactions.module.ts index 844e8f183..319d36820 100644 --- a/apps/api/src/bank-transactions/bank-transactions.module.ts +++ b/apps/api/src/bank-transactions/bank-transactions.module.ts @@ -10,9 +10,17 @@ import { IrisTasks } from '../tasks/bank-import/import-transactions.task' import { HttpModule } from '@nestjs/axios' import { EmailService } from '../email/email.service' import { TemplateService } from '../email/template.service' +import { AffiliateModule } from '../affiliate/affiliate.module' @Module({ - imports: [CampaignModule, DonationsModule, ConfigModule, ExportModule, HttpModule], + imports: [ + CampaignModule, + DonationsModule, + ConfigModule, + ExportModule, + HttpModule, + AffiliateModule, + ], controllers: [BankTransactionsController], providers: [BankTransactionsService, PrismaService, IrisTasks, EmailService, TemplateService], //TODO: Create Email module to not need to import each service exports: [BankTransactionsService], diff --git a/apps/api/src/bank-transactions/bank-transactions.service.ts b/apps/api/src/bank-transactions/bank-transactions.service.ts index aa08b9535..11d7b835c 100644 --- a/apps/api/src/bank-transactions/bank-transactions.service.ts +++ b/apps/api/src/bank-transactions/bank-transactions.service.ts @@ -17,6 +17,9 @@ import { Response } from 'express' import { CreateBankPaymentDto } from '../donations/dto/create-bank-payment.dto' import { DonationsService } from '../donations/donations.service' import { IrisTasks } from '../tasks/bank-import/import-transactions.task' +import { IrisIbanAccountInfo, IrisTransactionInfo } from '../tasks/bank-import/dto/response.dto' +import { IrisIbanAccountInfoDto } from './dto/iris-bank-account-info.dto' +import { IrisTransactionInfoDto } from './dto/iris-bank-transaction-info.dto' @Injectable() export class BankTransactionsService { @@ -165,4 +168,11 @@ export class BankTransactionsService { async rerunBankTransactionsForDate(transactionsDate: Date) { await this.irisBankImport.importBankTransactionsTASK(transactionsDate) } + + async simulateIrisTask( + ibanAccount: IrisIbanAccountInfoDto, + transactions: IrisTransactionInfoDto[], + ) { + await this.irisBankImport.simulateBankTransactionImportTask(ibanAccount, transactions) + } } diff --git a/apps/api/src/bank-transactions/dto/bank-transactions-iris-simulate.dto.ts b/apps/api/src/bank-transactions/dto/bank-transactions-iris-simulate.dto.ts new file mode 100644 index 000000000..100491ea6 --- /dev/null +++ b/apps/api/src/bank-transactions/dto/bank-transactions-iris-simulate.dto.ts @@ -0,0 +1,22 @@ +import { ApiProperty } from '@nestjs/swagger' +import { Expose, Type } from 'class-transformer' +import { IsArray, IsObject, ValidateNested } from 'class-validator' + +import { IrisIbanAccountInfoDto } from './iris-bank-account-info.dto' +import { IrisTransactionInfoDto } from './iris-bank-transaction-info.dto' + +export class IrisBankTransactionSimulationDto { + @ApiProperty() + @Expose() + @IsObject() + @ValidateNested({ each: true }) + @Type(() => IrisIbanAccountInfoDto) + irisIbanAccountInfo: IrisIbanAccountInfoDto + + @ApiProperty() + @Expose() + @IsArray() + @ValidateNested({ each: true }) + @Type(() => IrisTransactionInfoDto) + irisTransactionInfo: IrisTransactionInfoDto[] +} diff --git a/apps/api/src/bank-transactions/dto/iris-bank-account-info.dto.ts b/apps/api/src/bank-transactions/dto/iris-bank-account-info.dto.ts new file mode 100644 index 000000000..f2e9a2ee8 --- /dev/null +++ b/apps/api/src/bank-transactions/dto/iris-bank-account-info.dto.ts @@ -0,0 +1,35 @@ +import { Currency } from '@prisma/client' +import { Expose } from 'class-transformer' +import { IsIBAN, IsString } from 'class-validator' + +class ConsentDTO { + consents: [{ status: string }] + errorCodes: unknown +} + +export class IrisIbanAccountInfoDto { + id: number + + name: string + + @IsString() + @IsIBAN() + @Expose() + iban: string + + currency: Currency + + hasAuthorization: boolean + + bankHash: string + + @IsString() + @Expose() + bankName: string + + country: string + + dateCreate: number + + consents: ConsentDTO +} diff --git a/apps/api/src/bank-transactions/dto/iris-bank-transaction-info.dto.ts b/apps/api/src/bank-transactions/dto/iris-bank-transaction-info.dto.ts new file mode 100644 index 000000000..cf832605c --- /dev/null +++ b/apps/api/src/bank-transactions/dto/iris-bank-transaction-info.dto.ts @@ -0,0 +1,83 @@ +import { Currency } from '@prisma/client' +import { Expose, Type } from 'class-transformer' +import { + IsEnum, + IsIBAN, + IsNumber, + IsObject, + IsOptional, + IsString, + ValidateNested, +} from 'class-validator' + +class bankAccountDto { + @IsString() + @IsIBAN() + @Expose() + iban: string +} + +class transactionAmountDto { + @IsNumber() + @Expose() + amount: number + + @IsEnum(Currency) + @Expose() + currency: Currency +} + +export class IrisTransactionInfoDto { + @IsString() + @Expose() + transactionId: string + + @IsString() + @Expose() + bookingDate: string + + @IsObject() + @Expose() + @Type(() => bankAccountDto) + @ValidateNested({ each: true }) + debtorAccount: bankAccountDto + + @IsObject() + @Expose() + @Type(() => bankAccountDto) + @ValidateNested({ each: true }) + creditorAccount: bankAccountDto + + @IsOptional() + @IsString() + @Expose() + creditorName: string | null + + @IsOptional() + @IsString() + @Expose() + debtorName: string | null + + @IsString() + @Expose() + remittanceInformationUnstructured: string + + @IsObject() + @Expose() + @Type(() => transactionAmountDto) + @ValidateNested({ each: true }) + transactionAmount: transactionAmountDto + + @IsOptional() + @IsNumber() + @Expose() + exchangeRate: number | null + + @Expose() + @IsString() + valueDate: string + + @Expose() + @IsString() + creditDebitIndicator: 'DEBIT' | 'CREDIT' +} diff --git a/apps/api/src/tasks/bank-import/import-transactions.task.ts b/apps/api/src/tasks/bank-import/import-transactions.task.ts index 8867634c6..76e4fc4f5 100644 --- a/apps/api/src/tasks/bank-import/import-transactions.task.ts +++ b/apps/api/src/tasks/bank-import/import-transactions.task.ts @@ -32,6 +32,8 @@ import { UnrecognizedDonationEmailDto, } from '../../email/template.interface' import { ImportStatus } from '../../bank-transactions-file/dto/bank-transactions-import-status.dto' +import { IrisIbanAccountInfoDto } from '../../bank-transactions/dto/iris-bank-account-info.dto' +import { IrisTransactionInfoDto } from '../../bank-transactions/dto/iris-bank-transaction-info.dto' type filteredTransaction = Prisma.BankTransactionCreateManyInput type AffiliatePayload = Prisma.AffiliateGetPayload<{ @@ -125,6 +127,44 @@ export class IrisTasks { } } + async simulateBankTransactionImportTask( + ibanAccount: IrisIbanAccountInfoDto, + transactions: IrisTransactionInfoDto[], + ) { + let bankTrxRecords: filteredTransaction[] + try { + bankTrxRecords = this.prepareBankTransactionRecords(transactions, ibanAccount) + Logger.debug(`Transactions for import after filtering: ${bankTrxRecords.length}`) + } catch (e) { + return Logger.error('Error while preparing BankTransaction records') + } + + // 5. Parse transactions and create the donations + let processedBankTrxRecords: filteredTransaction[] + try { + processedBankTrxRecords = await this.processDonations(bankTrxRecords) + } catch (e) { + return Logger.error('Failed to process transaction donations' + e.message) + } + + // 6. Save BankTransactions to DB + try { + const savedTransactions = await this.saveBankTrxRecords(processedBankTrxRecords) + Logger.debug('Saved transactions count: ' + savedTransactions.count) + } catch (e) { + return Logger.error('Failed to import transactions into DB: ' + e.message) + } + + //7. Notify about unrecognized donations + try { + await this.sendUnrecognizedDonationsMail(processedBankTrxRecords) + } catch (e) { + return Logger.error('Failed to notify about bad transaction donations ' + e.message) + } + + return + } + async importBankTransactionsTASK(transactionsDate: Date) { // De-register the task, so that it doesn't waste server resources if (!this.canRun) { @@ -288,14 +328,13 @@ export class IrisTasks { if (trx.remittanceInformationUnstructured.startsWith('af_')) { matchedRef = trx.remittanceInformationUnstructured } else { - matchedRef = - trx.remittanceInformationUnstructured - ?.trim() - .replace(/[ _]+/g, '-') - .match(this.regexPaymentRef)![0] ?? null + const ref = trx.remittanceInformationUnstructured + ?.trim() + .replace(/[ _]+/g, '-') + .match(this.regexPaymentRef) + matchedRef = ref ? ref[0] : null } // Try to recognize campaign payment reference - const transactionAmount = { amount: trx.transactionAmount?.amount, currency: trx.transactionAmount?.currency, @@ -332,7 +371,6 @@ export class IrisTasks { matchedRef: matchedRef ? matchedRef : null, }) } - return filteredTransactions } @@ -420,7 +458,8 @@ export class IrisTasks { private async processAffiliateDonations(affiliate: AffiliatePayload, trx: filteredTransaction) { let totalDonated = 0 let updatedDonations = 0 - if (!trx.amount) return + if (!trx.amount || affiliate.donations.length === 0) return + for (const donation of affiliate.donations) { if (trx.amount - totalDonated < donation.amount) continue await this.donationsService.updateAffiliateBankPayment(donation) From 39b7f7aacd9a5f468670ba77be9ff2291f68cafe Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 19 Oct 2023 15:29:29 +0300 Subject: [PATCH 13/79] src/affiliate: Change affiliateCode structure --- apps/api/src/affiliate/affiliate.controller.ts | 3 ++- apps/api/src/affiliate/utils/affiliateCodeGenerator.ts | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 apps/api/src/affiliate/utils/affiliateCodeGenerator.ts diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index 59d5863e2..838c79583 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -21,6 +21,7 @@ import { CreateAffiliateDonation } from './dto/create-affiliate-donation.dto' import { DonationsService } from '../donations/donations.service' import { CancelAffiliateDonation } from './dto/cancel-affiliate-donation.dto' import { shouldAllowStatusChange } from '../donations/helpers/donation-status-updates' +import { affiliateCodeGenerator } from './utils/affiliateCodeGenerator' @Controller('affiliate') @ApiTags('affiliate') @@ -55,7 +56,7 @@ export class AffiliateController { } if (affiliate.status === 'pending' && newStatus === 'active') { - const affiliateCode = getPaymentReference() + const affiliateCode = affiliateCodeGenerator(affiliate.id) return await this.affiliateService.updateStatus(affiliateId, newStatus, affiliateCode) } diff --git a/apps/api/src/affiliate/utils/affiliateCodeGenerator.ts b/apps/api/src/affiliate/utils/affiliateCodeGenerator.ts new file mode 100644 index 000000000..219be8d2f --- /dev/null +++ b/apps/api/src/affiliate/utils/affiliateCodeGenerator.ts @@ -0,0 +1,6 @@ +import crypto from 'crypto' + +export function affiliateCodeGenerator(affiliateId: string) { + const uniqueHash = crypto.createHash('sha256').update(affiliateId).digest('hex').slice(0, 5) + return 'af_' + uniqueHash +} From ed56cfc7d2f23bca51dfe101bb1cf3e60d8bf480 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 19 Oct 2023 15:44:19 +0300 Subject: [PATCH 14/79] affiliate: Make affiliateCode available only for active affiliates --- apps/api/src/affiliate/affiliate.controller.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index 838c79583..f932733a1 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -51,16 +51,23 @@ export class AffiliateController { if (!affiliate) throw new NotFoundException('Affiliate not found') + let affiliateCode: string | null = affiliate.affiliateCode + if (affiliate.status === newStatus) { throw new ConflictException('Status is the same') } - if (affiliate.status === 'pending' && newStatus === 'active') { - const affiliateCode = affiliateCodeGenerator(affiliate.id) - return await this.affiliateService.updateStatus(affiliateId, newStatus, affiliateCode) + if ( + (affiliate.status === 'pending' || affiliate.status === 'cancelled') && + newStatus === 'active' + ) { + affiliateCode = affiliateCodeGenerator(affiliate.id) } - return await this.affiliateService.updateStatus(affiliateId, newStatus, affiliate.affiliateCode) + if (affiliate.status === 'active' && newStatus !== 'active') { + affiliateCode = null + } + return await this.affiliateService.updateStatus(affiliateId, newStatus, affiliateCode) } @Get(':affiliateCode') From 3f48f56f967a81e4b8e1bdf461dce061db106094 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 19 Oct 2023 17:41:42 +0300 Subject: [PATCH 15/79] jest: Fix test breakage --- apps/api/src/auth/auth.service.spec.ts | 3 --- apps/api/src/auth/register.controller.spec.ts | 4 +++- .../bank-transactions/bank-transactions.controller.spec.ts | 2 ++ apps/api/src/campaign/campaign.controller.spec.ts | 5 ++++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index 483dcf72d..8659ddc55 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -41,7 +41,6 @@ describe('AuthService', () => { email: 'test@podkrepi.bg', emailConfirmed: false, phone: null, - company: null, picture: null, createdAt: new Date('2021-10-07T13:38:11.097Z'), updatedAt: new Date('2021-10-07T13:38:11.097Z'), @@ -424,7 +423,6 @@ describe('AuthService', () => { email, emailConfirmed: false, phone: null, - company: null, picture: null, createdAt: new Date('2021-10-07T13:38:11.097Z'), updatedAt: new Date('2021-10-07T13:38:11.097Z'), @@ -473,7 +471,6 @@ describe('AuthService', () => { email, emailConfirmed: false, phone: null, - company: null, picture: null, createdAt: new Date('2021-10-07T13:38:11.097Z'), updatedAt: new Date('2021-10-07T13:38:11.097Z'), diff --git a/apps/api/src/auth/register.controller.spec.ts b/apps/api/src/auth/register.controller.spec.ts index 735130993..f7c630bb7 100644 --- a/apps/api/src/auth/register.controller.spec.ts +++ b/apps/api/src/auth/register.controller.spec.ts @@ -3,6 +3,7 @@ import { Test, TestingModule } from '@nestjs/testing' import { AuthService } from './auth.service' import { RegisterController } from './register.controller' import { RegisterDto } from './dto/register.dto' +import { CompanyModule } from '../company/company.module' describe('RegisterController', () => { let controller: RegisterController @@ -21,6 +22,7 @@ describe('RegisterController', () => { const module: TestingModule = await Test.createTestingModule({ controllers: [RegisterController], providers: [AuthService, AuthServiceProvider], + imports: [CompanyModule], }).compile() controller = module.get(RegisterController) @@ -34,7 +36,7 @@ describe('RegisterController', () => { describe('createUser', () => { const registerDto = new RegisterDto() it('should call createUser', async () => { - expect(await controller.register(registerDto)) + expect(await controller.registerIndividual(registerDto)) expect(spyService.createUser).toHaveBeenCalled() expect(spyService.createUser).toHaveBeenCalledWith(registerDto) }) diff --git a/apps/api/src/bank-transactions/bank-transactions.controller.spec.ts b/apps/api/src/bank-transactions/bank-transactions.controller.spec.ts index dd18fd892..1fe099d13 100644 --- a/apps/api/src/bank-transactions/bank-transactions.controller.spec.ts +++ b/apps/api/src/bank-transactions/bank-transactions.controller.spec.ts @@ -25,6 +25,7 @@ import { SchedulerRegistry } from '@nestjs/schedule' import { EmailService } from '../email/email.service' import { TemplateService } from '../email/template.service' import { MarketingNotificationsModule } from '../notifications/notifications.module' +import { AffiliateService } from '../affiliate/affiliate.service' const bankTransactionsMock = [ { @@ -145,6 +146,7 @@ describe('BankTransactionsController', () => { SchedulerRegistry, EmailService, TemplateService, + AffiliateService, ], }).compile() diff --git a/apps/api/src/campaign/campaign.controller.spec.ts b/apps/api/src/campaign/campaign.controller.spec.ts index 4220c0fc6..d7f863492 100644 --- a/apps/api/src/campaign/campaign.controller.spec.ts +++ b/apps/api/src/campaign/campaign.controller.spec.ts @@ -59,7 +59,6 @@ describe('CampaignController', () => { email: 'user@email.com', emailConfirmed: false, phone: null, - company: null, picture: null, createdAt: new Date('2021-10-07T13:38:11.097Z'), updatedAt: new Date('2021-10-07T13:38:11.097Z'), @@ -226,6 +225,7 @@ describe('CampaignController', () => { blockedAmount: 0, withdrawnAmount: 0, donors: 2, + guaranteedAmount: 0, }, }, ]) @@ -263,6 +263,7 @@ describe('CampaignController', () => { blockedAmount: 0, withdrawnAmount: 0, donors: 2, + guaranteedAmount: 0, }, }, ]) @@ -287,6 +288,7 @@ describe('CampaignController', () => { reachedAmount: 110, currentAmount: 0, blockedAmount: 0, + guaranteedAmount: 0, withdrawnAmount: 0, donors: 2, }, @@ -325,6 +327,7 @@ describe('CampaignController', () => { blockedAmount: 0, withdrawnAmount: 0, donors: 2, + guaranteedAmount: 0, }, }, }) From 764731d99a5056fc5718d2a690ba563e908420c3 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Fri, 20 Oct 2023 14:08:49 +0300 Subject: [PATCH 16/79] src/donations: Include guaranteed donations in listPublic Removed unnecessary count query. Replaced with the length of the findMany query --- apps/api/src/donations/donations.service.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index dd319f8fd..3e93fa493 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -290,7 +290,10 @@ export class DonationsService { pageSize?: number, ): Promise> { const data = await this.prisma.donation.findMany({ - where: { status, targetVault: { campaign: { id: campaignId } } }, + where: { + OR: [{ status: status }, { status: DonationStatus.guaranteed }], + targetVault: { campaign: { id: campaignId } }, + }, orderBy: [{ updatedAt: 'desc' }], select: { id: true, @@ -308,13 +311,9 @@ export class DonationsService { take: pageSize ? pageSize : undefined, }) - const count = await this.prisma.donation.count({ - where: { status, targetVault: { campaign: { id: campaignId } } }, - }) - const result = { items: data, - total: count, + total: data.length, } return result From b187047f14f94ef5728f876f731ef9e20af58710 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Fri, 20 Oct 2023 15:06:49 +0300 Subject: [PATCH 17/79] eslint: Address errors and warnings --- apps/api/src/affiliate/affiliate.controller.ts | 5 ++--- apps/api/src/auth/auth.service.ts | 4 ++-- .../src/bank-transactions/bank-transactions.controller.ts | 2 +- apps/api/src/bank-transactions/bank-transactions.service.ts | 1 - apps/api/src/donations/donations.service.ts | 1 - 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index f932733a1..c566cc113 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -16,7 +16,6 @@ import { KeycloakTokenParsed, isAdmin } from '../auth/keycloak' import { AuthenticatedUser, Public } from 'nest-keycloak-connect' import { AffiliateService } from './affiliate.service' import { AffiliateStatusUpdateDto } from './dto/affiliate-status-update.dto' -import { getPaymentReference } from '../campaign/helpers/payment-reference' import { CreateAffiliateDonation } from './dto/create-affiliate-donation.dto' import { DonationsService } from '../donations/donations.service' import { CancelAffiliateDonation } from './dto/cancel-affiliate-donation.dto' @@ -89,8 +88,8 @@ export class AffiliateController { const affiliateDonationDto: CreateAffiliateDonation = { ...donation, affiliateId: affiliate.id, - personId: donation.isAnonymous ? null : affiliate.company.person!.id, - billingEmail: affiliate.company.person!.email, + personId: donation.isAnonymous ? null : affiliate.company.person.id, + billingEmail: affiliate.company.person.email, toEntity: donation.toEntity, } diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index 304075b30..9bd91a47c 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -179,7 +179,7 @@ export class AuthService { async createUser( registerDto: RegisterDto, - isCorporateReg: boolean = false, + isCorporateReg = false, ): Promise { let person: Person try { @@ -234,7 +234,7 @@ export class AuthService { private async createKeycloakUser( registerDto: RegisterDto, verifyEmail: boolean, - activeProfile: boolean = true, + activeProfile = true, ) { return await this.admin.users.create({ username: registerDto.email, diff --git a/apps/api/src/bank-transactions/bank-transactions.controller.ts b/apps/api/src/bank-transactions/bank-transactions.controller.ts index b8115e5f6..33ce74af0 100644 --- a/apps/api/src/bank-transactions/bank-transactions.controller.ts +++ b/apps/api/src/bank-transactions/bank-transactions.controller.ts @@ -15,7 +15,7 @@ import { } from '@nestjs/common' import { ApiQuery, ApiTags } from '@nestjs/swagger' import { RealmViewSupporters, ViewSupporters } from '@podkrepi-bg/podkrepi-types' -import { Roles, RoleMatchingMode, AuthenticatedUser, Public } from 'nest-keycloak-connect' +import { Roles, RoleMatchingMode, AuthenticatedUser } from 'nest-keycloak-connect' import { KeycloakTokenParsed, isAdmin } from '../auth/keycloak' import { BankTransactionsService } from './bank-transactions.service' import { diff --git a/apps/api/src/bank-transactions/bank-transactions.service.ts b/apps/api/src/bank-transactions/bank-transactions.service.ts index 11d7b835c..cc61ec955 100644 --- a/apps/api/src/bank-transactions/bank-transactions.service.ts +++ b/apps/api/src/bank-transactions/bank-transactions.service.ts @@ -17,7 +17,6 @@ import { Response } from 'express' import { CreateBankPaymentDto } from '../donations/dto/create-bank-payment.dto' import { DonationsService } from '../donations/donations.service' import { IrisTasks } from '../tasks/bank-import/import-transactions.task' -import { IrisIbanAccountInfo, IrisTransactionInfo } from '../tasks/bank-import/dto/response.dto' import { IrisIbanAccountInfoDto } from './dto/iris-bank-account-info.dto' import { IrisTransactionInfoDto } from './dto/iris-bank-transaction-info.dto' diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index 3e93fa493..af876b9b3 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -3,7 +3,6 @@ import { ConfigService } from '@nestjs/config' import { InjectStripeClient } from '@golevelup/nestjs-stripe' import { BadRequestException, Injectable, Logger, NotFoundException } from '@nestjs/common' import { - AffiliateStatus, Campaign, Donation, DonationStatus, From 76c81293777aecce8d9ca18fe7d648010fb2b321 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Fri, 20 Oct 2023 15:55:19 +0300 Subject: [PATCH 18/79] src/donations: Include companyName in listPublic endpoint --- apps/api/src/donations/donations.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index af876b9b3..24e0df249 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -304,7 +304,9 @@ export class DonationsService { amount: true, chargedAmount: true, currency: true, - person: { select: { firstName: true, lastName: true } }, + person: { + select: { firstName: true, lastName: true, company: { select: { companyName: true } } }, + }, }, skip: pageIndex && pageSize ? pageIndex * pageSize : undefined, take: pageSize ? pageSize : undefined, From 1dc7243f9a6e086044651ddd3ba40ee6b71cc165 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Sat, 21 Oct 2023 01:48:10 +0300 Subject: [PATCH 19/79] corporateUser: Add space between first and last name for legalpersonname --- 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 9bd91a47c..bffd695ba 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -294,7 +294,7 @@ export class AuthService { personId: personId, companyNumber: registerDto.companyNumber, companyName: registerDto.companyName, - legalPersonName: registerDto.firstName + registerDto.lastName, + legalPersonName: registerDto.firstName + ' ' + registerDto.lastName, }, // Store keycloakId to the person with same email update: { personId }, From 505a2100a6d0417744c5a59fe50d7f9cd986f4c5 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Sat, 21 Oct 2023 01:53:24 +0300 Subject: [PATCH 20/79] src/affiliate: Generate new code whenever affiliate is set to active --- apps/api/src/affiliate/affiliate.controller.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index c566cc113..cec437a6c 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -56,16 +56,14 @@ export class AffiliateController { throw new ConflictException('Status is the same') } - if ( - (affiliate.status === 'pending' || affiliate.status === 'cancelled') && - newStatus === 'active' - ) { + if (affiliate.status !== 'active' && newStatus === 'active') { affiliateCode = affiliateCodeGenerator(affiliate.id) } if (affiliate.status === 'active' && newStatus !== 'active') { affiliateCode = null } + return await this.affiliateService.updateStatus(affiliateId, newStatus, affiliateCode) } From 9afc6e990b68db8a0eb5b3ee3f09a8463c6f64ef Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Sat, 21 Oct 2023 22:11:29 +0300 Subject: [PATCH 21/79] Run nx 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 | 20 ++- .../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 | 16 +-- .../src/domain/generated/company/dto/index.ts | 7 +- .../company/dto/update-company.dto.ts | 16 +-- .../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 | 54 ++++---- .../generated/donation/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 | 16 ++- .../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 | 116 +++++++++--------- .../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 ++++--- 202 files changed, 1120 insertions(+), 1688 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 248d71e6c..3b9e70f74 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,12 @@ - -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 | null; -company?: Company | null; -donations?: Donation[] ; + id: string + status: AffiliateStatus + affiliateCode: string | null + companyId: string | null + company?: Company | null + 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 112541f83..b07f75937 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,13 +1,7 @@ - - - - - - export class CreateCompanyDto { - companyName: string; -companyNumber: string; -legalPersonName?: string; -countryCode?: string; -cityId?: string; + companyName: string + companyNumber: string + legalPersonName?: string + countryCode?: string + cityId?: 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 b80c9f08f..d392ddae9 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,13 +1,7 @@ - - - - - - export class UpdateCompanyDto { - companyName?: string; -companyNumber?: string; -legalPersonName?: string; -countryCode?: string; -cityId?: string; + companyName?: string + companyNumber?: string + legalPersonName?: string + countryCode?: string + cityId?: 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 f817a10d4..33ef5929f 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,29 @@ - -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 { 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' 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; + 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 } 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/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 86d1a1669..d55e53344 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,9 +1,7 @@ - - export class ConnectPersonDto { - id?: string; -email?: string; -personalNumber?: string; -keycloakId?: string; -stripeCustomerId?: string; - } - \ No newline at end of file +export class ConnectPersonDto { + id?: string + email?: string + personalNumber?: 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 0c2f4455f..00ebaddc1 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,60 @@ - -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; -keycloakId: string | null; -stripeCustomerId: string | null; -picture: string | null; -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 + keycloakId: string | null + stripeCustomerId: string | null + picture: string | null + 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 fc1907cb1fa7a48c0d432997a4679cbc49668f97 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Sat, 21 Oct 2023 22:16:22 +0300 Subject: [PATCH 22/79] src/donations:c Add affiliateId to donation mock --- apps/api/src/donations/donations.controller.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/api/src/donations/donations.controller.spec.ts b/apps/api/src/donations/donations.controller.spec.ts index 99fb20391..3d53572a9 100644 --- a/apps/api/src/donations/donations.controller.spec.ts +++ b/apps/api/src/donations/donations.controller.spec.ts @@ -49,6 +49,7 @@ describe('DonationsController', () => { type: DonationType.donation, status: DonationStatus.succeeded, amount: 10, + affiliateId: null, extCustomerId: 'gosho', extPaymentIntentId: 'pm1', extPaymentMethodId: 'bank', From 4ac27a3219007724d90e388ed73af843c945ff56 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 23 Oct 2023 17:14:41 +0300 Subject: [PATCH 23/79] src/affiliates: Add tests --- .../affiliate/affiliate.controller.spec.ts | 353 ++++++++++++++++++ .../src/affiliate/affiliate.service.spec.ts | 19 + 2 files changed, 372 insertions(+) create mode 100644 apps/api/src/affiliate/affiliate.controller.spec.ts create mode 100644 apps/api/src/affiliate/affiliate.service.spec.ts diff --git a/apps/api/src/affiliate/affiliate.controller.spec.ts b/apps/api/src/affiliate/affiliate.controller.spec.ts new file mode 100644 index 000000000..fc92f316f --- /dev/null +++ b/apps/api/src/affiliate/affiliate.controller.spec.ts @@ -0,0 +1,353 @@ +import { Test, TestingModule } from '@nestjs/testing' +import { MockPrismaService, prismaMock } from '../prisma/prisma-client.mock' +import { AffiliateService } from './affiliate.service' +import { AffiliateController } from './affiliate.controller' +import { DonationsService } from '../donations/donations.service' +import { PersonService } from '../person/person.service' +import { STRIPE_CLIENT_TOKEN } from '@golevelup/nestjs-stripe' +import { ConfigService } from '@nestjs/config' +import { CampaignService } from '../campaign/campaign.service' +import { VaultService } from '../vault/vault.service' +import { NotificationModule } from '../sockets/notifications/notification.module' +import { MarketingNotificationsModule } from '../notifications/notifications.module' +import { ExportService } from '../export/export.service' +import { Affiliate, Donation, Person, Prisma, Vault } from '@prisma/client' +import { KeycloakTokenParsed } from '../auth/keycloak' +import { BadRequestException, ConflictException, ForbiddenException } from '@nestjs/common' +import { AffiliateStatusUpdateDto } from './dto/affiliate-status-update.dto' +import * as afCodeGenerator from './utils/affiliateCodeGenerator' +import { CreateAffiliateDonation } from './dto/create-affiliate-donation.dto' +import { CancelAffiliateDonation } from './dto/cancel-affiliate-donation.dto' + +type PersonWithPayload = Prisma.PersonGetPayload<{ include: { company: true } }> +type AffiliateWithPayload = Prisma.AffiliateGetPayload<{ + include: { company: { include: { person: true } }; donations: true } +}> + +describe('AffiliateService', () => { + let controller: AffiliateController + let service: AffiliateService + let donationService: DonationsService + let vaultService: VaultService + const affiliateCodeMock = 'af_12345' + const stripeMock = { + checkout: { sessions: { create: jest.fn() } }, + } + + afterEach(() => { + jest.clearAllMocks() + }) + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + imports: [NotificationModule, MarketingNotificationsModule], + controllers: [AffiliateController], + providers: [ + AffiliateService, + MockPrismaService, + DonationsService, + { + provide: STRIPE_CLIENT_TOKEN, + useValue: stripeMock, + }, + { + provide: ConfigService, + useValue: { + get: jest.fn(), + }, + }, + PersonService, + CampaignService, + VaultService, + ExportService, + ], + }).compile() + + controller = module.get(AffiliateController) + service = module.get(AffiliateService) + donationService = module.get(DonationsService) + vaultService = module.get(VaultService) + }) + + const affiliateUpdateDto: AffiliateStatusUpdateDto = { + newStatus: 'active', + } + + const mockIndividualProfile: PersonWithPayload = { + id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', + firstName: 'Admin', + lastName: 'Dev', + 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, + company: null, + } + + const vaultMock: Vault = { + id: 'vault-id', + currency: 'BGN', + amount: 0, + blockedAmount: 0, + campaignId: 'campaign-id', + createdAt: new Date(), + updatedAt: new Date(), + name: 'vault-name', + } + const affiliateMock: Affiliate = { + id: '1234567', + companyId: '1234572', + affiliateCode: null, + status: 'pending', + } + const activeAffiliateMock: AffiliateWithPayload = { + ...affiliateMock, + status: 'active', + id: '12345', + affiliateCode: affiliateCodeMock, + company: { + id: '12345675', + companyName: 'Podkrepi BG Association', + companyNumber: '123456789', + legalPersonName: 'John Doe', + createdAt: new Date(), + updatedAt: new Date(), + personId: mockIndividualProfile.id, + cityId: null, + countryCode: null, + person: { ...mockIndividualProfile }, + }, + donations: [], + } + + const donationResponseMock: Donation = { + id: 'donation-id', + type: 'donation', + status: 'guaranteed', + amount: 5000, + affiliateId: activeAffiliateMock.id, + personId: null, + extCustomerId: '', + extPaymentIntentId: '123456', + extPaymentMethodId: '1234', + billingEmail: 'test@podkrepi.bg', + billingName: 'John doe', + targetVaultId: vaultMock.id, + chargedAmount: 0, + currency: 'BGN', + createdAt: new Date(), + updatedAt: new Date(), + provider: 'bank', + } + + const userMock = { + sub: 'testKeycloackId', + 'allowed-origins': [], + } as KeycloakTokenParsed + + it('should be defined', () => { + expect(controller).toBeDefined() + }) + + describe('Join program request', () => { + it('should throw error if request is from individual profile', async () => { + const createAffiliateSpy = jest.spyOn(service, 'create') + const findOneSpy = jest + .spyOn(prismaMock.person, 'findFirst') + .mockResolvedValue(mockIndividualProfile) + expect(controller.joinAffiliateProgramRequest(userMock)).rejects.toThrow( + new BadRequestException('Must be corporate profile'), + ) + expect(createAffiliateSpy).not.toHaveBeenCalled() + }) + + it('should pass if request is coming from corporate profile', async () => { + const mockCorporateProfile = { + ...mockIndividualProfile, + company: { + id: '123', + companyName: 'Association Podkrepibg', + companyNumber: '1234', + legalPersonName: 'Podkrepibg Test', + createdAt: new Date(), + updatedAt: new Date(), + personId: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', + cityId: null, + countryCode: null, + }, + } + const createAffiliateSpy = jest.spyOn(service, 'create').mockResolvedValue(affiliateMock) + const findOneSpy = jest + .spyOn(prismaMock.person, 'findFirst') + .mockResolvedValue(mockCorporateProfile) + + expect(await controller.joinAffiliateProgramRequest(userMock)).toEqual(affiliateMock) + expect(createAffiliateSpy).toHaveBeenCalled() + expect(createAffiliateSpy).toHaveBeenCalledWith(mockCorporateProfile.company.id) + }) + }) + + describe('Update affiliate status', () => { + it('should throw error if request is not coming from admin', async () => { + const affiliateSpy = jest.spyOn(service, 'findOneById') + const updateStatusSpy = jest.spyOn(service, 'updateStatus') + expect( + controller.updateAffiliateStatus(affiliateMock.id, affiliateUpdateDto, userMock), + ).rejects.toThrow(new ForbiddenException('Must be an admin')) + expect(affiliateSpy).not.toHaveBeenCalled() + expect(updateStatusSpy).not.toHaveBeenCalled() + }) + it('should generate affiliate code if status is changed to active', async () => { + const adminMock: KeycloakTokenParsed = { + ...userMock, + resource_access: { account: { roles: ['manage-account', 'account-view-supporters'] } }, + } + const findAffiliateSpy = jest.spyOn(service, 'findOneById').mockResolvedValue(affiliateMock) + + const codeGenerationSpy = jest + .spyOn(afCodeGenerator, 'affiliateCodeGenerator') + .mockReturnValue(affiliateCodeMock) + const updateStatusMock = jest.spyOn(service, 'updateStatus') + + await controller.updateAffiliateStatus(affiliateMock.id, affiliateUpdateDto, adminMock) + + expect(codeGenerationSpy).toHaveBeenCalled() + expect(updateStatusMock).toHaveBeenCalledWith( + affiliateMock.id, + affiliateUpdateDto.newStatus, + affiliateCodeMock, + ) + }) + + it('affiliateCode should be null if newStatus is not active', async () => { + const adminMock: KeycloakTokenParsed = { + ...userMock, + resource_access: { account: { roles: ['manage-account', 'account-view-supporters'] } }, + } + + const activeAffiliateMock: Affiliate = { + ...affiliateMock, + status: 'active', + id: '12345', + affiliateCode: affiliateCodeMock, + } + + const mockCancelledStatus: AffiliateStatusUpdateDto = { + newStatus: 'cancelled', + } + const findAffiliateSpy = jest + .spyOn(service, 'findOneById') + .mockResolvedValue(activeAffiliateMock) + + const codeGenerationSpy = jest + .spyOn(afCodeGenerator, 'affiliateCodeGenerator') + .mockReturnValue(affiliateCodeMock) + const updateStatusSpy = jest.spyOn(service, 'updateStatus') + + await controller.updateAffiliateStatus(activeAffiliateMock.id, mockCancelledStatus, adminMock) + + expect(codeGenerationSpy).not.toHaveBeenCalled() + expect(updateStatusSpy).toHaveBeenCalledWith( + activeAffiliateMock.id, + mockCancelledStatus.newStatus, + null, + ) + }) + it('affiliateCode should be null if newStatus is not active', async () => { + const adminMock: KeycloakTokenParsed = { + ...userMock, + resource_access: { account: { roles: ['manage-account', 'account-view-supporters'] } }, + } + + const findAffiliateSpy = jest + .spyOn(service, 'findOneById') + .mockResolvedValue(activeAffiliateMock) + + const updateStatusDto: AffiliateStatusUpdateDto = { + newStatus: 'active', + } + const codeGenerationSpy = jest + .spyOn(afCodeGenerator, 'affiliateCodeGenerator') + .mockReturnValue(affiliateCodeMock) + + const updateStatusSpy = jest.spyOn(service, 'updateStatus') + + expect( + controller.updateAffiliateStatus(activeAffiliateMock.id, updateStatusDto, adminMock), + ).rejects.toThrow(new ConflictException('Status is the same')) + expect(codeGenerationSpy).not.toHaveBeenCalled() + expect(updateStatusSpy).not.toHaveBeenCalled() + }) + }) + + describe('Affiliate donations', () => { + it('should create donation', async () => { + const affiliateDonationDto: CreateAffiliateDonation = { + campaignId: '12345', + amount: 5000, + billingName: 'John doe', + isAnonymous: true, + affiliateId: null, + personId: null, + extCustomerId: '', + extPaymentIntentId: '123456', + extPaymentMethodId: '1234', + billingEmail: 'test@podkrepi.bg', + currency: 'BGN', + toEntity: new CreateAffiliateDonation().toEntity, + } + const prismaSpy = jest.spyOn(service, 'findOneByCode').mockResolvedValue(activeAffiliateMock) + const createAffiliateDonationSpy = jest + .spyOn(donationService, 'createAffiliateDonation') + .mockResolvedValue(donationResponseMock) + const findVaultSpy = jest.spyOn(prismaMock.vault, 'findMany').mockResolvedValue([vaultMock]) + await controller.createAffiliateDonation(affiliateCodeMock, affiliateDonationDto) + expect(createAffiliateDonationSpy).toHaveBeenCalledWith({ + ...affiliateDonationDto, + affiliateId: activeAffiliateMock.id, + }) + expect(await donationService.createAffiliateDonation(affiliateDonationDto)).toEqual( + donationResponseMock, + ) + }) + it('should cancel', async () => { + const cancelledDonationResponse: Donation = { + ...donationResponseMock, + status: 'cancelled', + } + const donationDto: CancelAffiliateDonation = { donationId: donationResponseMock.id } + const affiliateDonationSpy = jest + .spyOn(donationService, 'getAffiliateDonationById') + .mockResolvedValue(donationResponseMock) + const updateDonationStatus = jest + .spyOn(donationService, 'update') + .mockResolvedValue(cancelledDonationResponse) + expect(await controller.cancelAffiliateDonation(affiliateCodeMock, donationDto)).toEqual( + cancelledDonationResponse, + ) + }) + it('should throw error if donation status is succeeded', async () => { + const succeededDonationResponse: Donation = { + ...donationResponseMock, + status: 'succeeded', + } + const donationDto: CancelAffiliateDonation = { donationId: donationResponseMock.id } + const affiliateDonationSpy = jest + .spyOn(donationService, 'getAffiliateDonationById') + .mockResolvedValue(succeededDonationResponse) + const updateDonationStatus = jest.spyOn(donationService, 'update') + expect(controller.cancelAffiliateDonation(affiliateCodeMock, donationDto)).rejects.toThrow( + new BadRequestException("Donation status can't be updated"), + ) + expect(updateDonationStatus).not.toHaveBeenCalled() + }) + }) +}) diff --git a/apps/api/src/affiliate/affiliate.service.spec.ts b/apps/api/src/affiliate/affiliate.service.spec.ts new file mode 100644 index 000000000..595a45d07 --- /dev/null +++ b/apps/api/src/affiliate/affiliate.service.spec.ts @@ -0,0 +1,19 @@ +import { Test, TestingModule } from '@nestjs/testing' +import { MockPrismaService } from '../prisma/prisma-client.mock' +import { AffiliateService } from './affiliate.service' + +describe('AffiliateService', () => { + let service: AffiliateService + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [AffiliateService, MockPrismaService], + }).compile() + + service = module.get(AffiliateService) + }) + + it('should be defined', () => { + expect(service).toBeDefined() + }) +}) From f8a8bce74d4c312db0d0224e1e1b24da6fda1684 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 23 Oct 2023 20:30:50 +0300 Subject: [PATCH 24/79] bank-transaction: Return unprocessed if no guaranteed donations are found for affiliate --- apps/api/src/tasks/bank-import/import-transactions.task.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/api/src/tasks/bank-import/import-transactions.task.ts b/apps/api/src/tasks/bank-import/import-transactions.task.ts index 76e4fc4f5..7eeaf16fe 100644 --- a/apps/api/src/tasks/bank-import/import-transactions.task.ts +++ b/apps/api/src/tasks/bank-import/import-transactions.task.ts @@ -458,7 +458,10 @@ export class IrisTasks { private async processAffiliateDonations(affiliate: AffiliatePayload, trx: filteredTransaction) { let totalDonated = 0 let updatedDonations = 0 - if (!trx.amount || affiliate.donations.length === 0) return + if (!trx.amount || affiliate.donations.length === 0) { + trx.bankDonationStatus = BankDonationStatus.unrecognized + return ImportStatus.UNPROCESSED + } for (const donation of affiliate.donations) { if (trx.amount - totalDonated < donation.amount) continue From b51522ddac1917c5637570a2773f14a37c01244f Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 23 Oct 2023 20:33:56 +0300 Subject: [PATCH 25/79] tasks/bank-import: Set transaction to importFailed if no guaranteed donations are found for affiliate --- apps/api/src/tasks/bank-import/import-transactions.task.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/tasks/bank-import/import-transactions.task.ts b/apps/api/src/tasks/bank-import/import-transactions.task.ts index 7eeaf16fe..8a60bb1b7 100644 --- a/apps/api/src/tasks/bank-import/import-transactions.task.ts +++ b/apps/api/src/tasks/bank-import/import-transactions.task.ts @@ -459,7 +459,7 @@ export class IrisTasks { let totalDonated = 0 let updatedDonations = 0 if (!trx.amount || affiliate.donations.length === 0) { - trx.bankDonationStatus = BankDonationStatus.unrecognized + trx.bankDonationStatus = BankDonationStatus.importFailed return ImportStatus.UNPROCESSED } From ca852254659fba3853f1a5cae29ceffffe5cfcd8 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 23 Oct 2023 20:35:56 +0300 Subject: [PATCH 26/79] tasks/bank-import: Include test for affiliate donations --- .../import-transactions.task.spec.ts | 100 +++++++++++++++++- 1 file changed, 95 insertions(+), 5 deletions(-) diff --git a/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts b/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts index ebdff5032..c56b0d2ef 100644 --- a/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts +++ b/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts @@ -14,7 +14,15 @@ import { CampaignService } from '../../campaign/campaign.service' import { VaultService } from '../../vault/vault.service' import { NotificationModule } from '../../sockets/notifications/notification.module' import { ExportService } from '../../export/export.service' -import { BankDonationStatus, BankTransaction, Campaign, Vault } from '@prisma/client' +import { + Affiliate, + BankDonationStatus, + BankTransaction, + Campaign, + DonationStatus, + Prisma, + Vault, +} from '@prisma/client' import { toMoney } from '../../common/money' import { DateTime } from 'luxon' import { EmailService } from '../../email/email.service' @@ -24,6 +32,9 @@ import { SendGridNotificationsProvider } from '../../notifications/providers/not import { MarketingNotificationsService } from '../../notifications/notifications.service' const IBAN = 'BG77UNCR92900016740920' +type AffiliateWithPayload = Prisma.AffiliateGetPayload<{ + include: { donations: true } +}> class MockIrisTasks extends IrisTasks { protected IBAN = IBAN @@ -53,6 +64,34 @@ describe('ImportTransactionsTask', () => { }, ] as (Campaign & { vaults: Vault[] })[] + const affiliateMock: AffiliateWithPayload = { + id: '1234567', + companyId: '1234572', + affiliateCode: 'af_12345', + status: 'active', + donations: [ + { + id: 'donation-id', + type: 'donation', + status: 'guaranteed', + amount: 5000, + affiliateId: 'affiliate-id', + personId: null, + extCustomerId: '', + extPaymentIntentId: '123456', + extPaymentMethodId: '1234', + billingEmail: 'test@podkrepi.bg', + billingName: 'John doe', + targetVaultId: 'vault-id', + chargedAmount: 0, + currency: 'BGN', + createdAt: new Date(), + updatedAt: new Date(), + provider: 'bank', + }, + ], + } + const mockIrisTransactions: IrisTransactionInfo[] = [ // CORRECT BANK DONATION { @@ -138,6 +177,27 @@ describe('ImportTransactionsTask', () => { valueDate: '2023-03-01', creditDebitIndicator: 'DEBIT', }, + //Affiliate donation + { + transactionId: 'Booked_5954782144_70123543493054963FTRO23073A58G01C2023345440_20230914', + bookingDate: '2023-03-14', + creditorAccount: { + iban: 'BG66UNCR70001524349032', + }, + creditorName: 'СДРУЖЕНИЕ ПОДКРЕПИ БГ', + debtorAccount: { + iban: 'BG77UNCR92900016740920', + }, + debtorName: 'JOHN DOE', + remittanceInformationUnstructured: 'af_12345', + transactionAmount: { + amount: 50, + currency: 'BGN', + }, + exchangeRate: null, + valueDate: '2023-03-14', + creditDebitIndicator: 'CREDIT', + }, ] const irisIBANAccountMock: IrisIbanAccountInfo = { @@ -256,13 +316,17 @@ describe('ImportTransactionsTask', () => { IrisTasks.prototype as any, 'sendUnrecognizedDonationsMail', ) - + const processAffiliateDonationSpy = jest.spyOn( + IrisTasks.prototype as any, + 'processAffiliateDonations', + ) // Spy email sending jest.spyOn(emailService, 'sendFromTemplate').mockImplementation(async () => {}) jest.spyOn(prismaMock.bankTransaction, 'count').mockResolvedValue(0) jest.spyOn(prismaMock, '$transaction').mockResolvedValue('SUCCESS') jest.spyOn(prismaMock.campaign, 'findMany').mockResolvedValue(mockDonatedCampaigns) + jest.spyOn(prismaMock.affiliate, 'findMany').mockResolvedValue([affiliateMock]) jest.spyOn(prismaMock.bankTransaction, 'createMany').mockResolvedValue({ count: 2 }) jest.spyOn(prismaMock.bankTransaction, 'updateMany') jest @@ -286,8 +350,8 @@ describe('ImportTransactionsTask', () => { expect(getTrxSpy).toHaveBeenCalledWith(irisIBANAccountMock, transactionsDate) // 3.Should prepare the bank-transaction records expect(prepareBankTrxSpy).toHaveBeenCalledWith(mockIrisTransactions, irisIBANAccountMock) - // 5.Should process transactions and parse donations + expect(processAffiliateDonationSpy).toHaveBeenCalledOnce() expect(processDonationsSpy).toHaveBeenCalledWith( // Outgoing and Stripe payments should have been filtered expect.arrayContaining( @@ -315,6 +379,30 @@ describe('ImportTransactionsTask', () => { include: { vaults: true }, }), ) + expect(prismaMock.affiliate.findMany).toHaveBeenCalledWith( + expect.objectContaining({ + where: { + affiliateCode: { + in: [ + // VALID Affiliate CODE + mockIrisTransactions[mockIrisTransactions.length - 1] + .remittanceInformationUnstructured, + ], + }, + }, + include: { + donations: { + where: { + status: DonationStatus.guaranteed, + }, + orderBy: { + createdAt: 'asc', + }, + include: { targetVault: true }, + }, + }, + }), + ) // Should be called only once - for the recognized campaign payment ref expect(prepareBankPaymentSpy).toHaveBeenCalledOnce() expect(prepareBankPaymentSpy).toHaveBeenCalledWith( @@ -354,10 +442,12 @@ describe('ImportTransactionsTask', () => { expect(parameters[0].bankDonationStatus).toEqual(BankDonationStatus.imported) // Bank donation 2 expect(parameters[1].bankDonationStatus).toEqual(BankDonationStatus.unrecognized) + // Affiliate donation + expect(parameters[2].bankDonationStatus).toEqual(BankDonationStatus.imported) // STRIPE Payment - expect(parameters[2]).not.toBeDefined() - // OUTGOING Payment expect(parameters[3]).not.toBeDefined() + // OUTGOING Payment + expect(parameters[4]).not.toBeDefined() // Only new transactions should be saved expect(prismaMock.bankTransaction.createMany).toHaveBeenCalledWith( From b4f0824d8ae5dad2a25552d63132462c489004c9 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 23 Oct 2023 20:41:57 +0300 Subject: [PATCH 27/79] src/affiliate: Fix redundant space on ForbiddenException --- apps/api/src/affiliate/affiliate.controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index cec437a6c..dc901d4b9 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -45,7 +45,7 @@ export class AffiliateController { @Body() { newStatus }: AffiliateStatusUpdateDto, @AuthenticatedUser() user: KeycloakTokenParsed, ) { - if (!isAdmin(user)) throw new ForbiddenException('Must be an admin ') + if (!isAdmin(user)) throw new ForbiddenException('Must be an admin') const affiliate = await this.affiliateService.findOneById(affiliateId) if (!affiliate) throw new NotFoundException('Affiliate not found') From df7d3ed595c58f8f0c5beafd94a1b0be0a476c3a Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 10:05:33 +0300 Subject: [PATCH 28/79] affiliate.controller.spec: Rename test to AffiliateController --- apps/api/src/affiliate/affiliate.controller.spec.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.spec.ts b/apps/api/src/affiliate/affiliate.controller.spec.ts index fc92f316f..c53e085ae 100644 --- a/apps/api/src/affiliate/affiliate.controller.spec.ts +++ b/apps/api/src/affiliate/affiliate.controller.spec.ts @@ -11,7 +11,7 @@ import { VaultService } from '../vault/vault.service' import { NotificationModule } from '../sockets/notifications/notification.module' import { MarketingNotificationsModule } from '../notifications/notifications.module' import { ExportService } from '../export/export.service' -import { Affiliate, Donation, Person, Prisma, Vault } from '@prisma/client' +import { Affiliate, Donation, Prisma, Vault } from '@prisma/client' import { KeycloakTokenParsed } from '../auth/keycloak' import { BadRequestException, ConflictException, ForbiddenException } from '@nestjs/common' import { AffiliateStatusUpdateDto } from './dto/affiliate-status-update.dto' @@ -24,11 +24,10 @@ type AffiliateWithPayload = Prisma.AffiliateGetPayload<{ include: { company: { include: { person: true } }; donations: true } }> -describe('AffiliateService', () => { +describe('AffiliateController', () => { let controller: AffiliateController let service: AffiliateService let donationService: DonationsService - let vaultService: VaultService const affiliateCodeMock = 'af_12345' const stripeMock = { checkout: { sessions: { create: jest.fn() } }, @@ -66,7 +65,6 @@ describe('AffiliateService', () => { controller = module.get(AffiliateController) service = module.get(AffiliateService) donationService = module.get(DonationsService) - vaultService = module.get(VaultService) }) const affiliateUpdateDto: AffiliateStatusUpdateDto = { From 15710393339e0b631495fa4357a6556f93110b02 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 13:36:35 +0300 Subject: [PATCH 29/79] schema.prisma: Add companyId to person model --- .../src/affiliate/affiliate.controller.spec.ts | 1 + apps/api/src/auth/auth.service.spec.ts | 17 +++-------------- .../src/campaign/campaign.controller.spec.ts | 1 + .../generated/company/dto/create-company.dto.ts | 1 + .../generated/company/dto/update-company.dto.ts | 1 + .../generated/person/dto/connect-person.dto.ts | 1 + .../generated/person/entities/person.entity.ts | 1 + .../src/donations/donations.controller.spec.ts | 9 +++++---- db/seed/person/factory.ts | 1 + .../migration.sql | 17 +++++++++++++++++ schema.prisma | 5 +++-- 11 files changed, 35 insertions(+), 20 deletions(-) create mode 100644 migrations/20231024102451_add_company_id_to_person_field/migration.sql diff --git a/apps/api/src/affiliate/affiliate.controller.spec.ts b/apps/api/src/affiliate/affiliate.controller.spec.ts index c53e085ae..1b18b9954 100644 --- a/apps/api/src/affiliate/affiliate.controller.spec.ts +++ b/apps/api/src/affiliate/affiliate.controller.spec.ts @@ -75,6 +75,7 @@ describe('AffiliateController', () => { id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', firstName: 'Admin', lastName: 'Dev', + companyId: null, keycloakId: '123', email: 'test@podkrepi.bg', emailConfirmed: false, diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index 8659ddc55..33e284587 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -37,6 +37,7 @@ describe('AuthService', () => { id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', firstName: 'Admin', lastName: 'Dev', + companyId: null, keycloakId: '123', email: 'test@podkrepi.bg', emailConfirmed: false, @@ -123,20 +124,6 @@ describe('AuthService', () => { 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', () => { @@ -419,6 +406,7 @@ describe('AuthService', () => { id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', firstName, lastName, + companyId: null, keycloakId, email, emailConfirmed: false, @@ -467,6 +455,7 @@ describe('AuthService', () => { id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', firstName, lastName, + companyId: null, keycloakId, email, emailConfirmed: false, diff --git a/apps/api/src/campaign/campaign.controller.spec.ts b/apps/api/src/campaign/campaign.controller.spec.ts index d7f863492..a8bdb2427 100644 --- a/apps/api/src/campaign/campaign.controller.spec.ts +++ b/apps/api/src/campaign/campaign.controller.spec.ts @@ -58,6 +58,7 @@ describe('CampaignController', () => { keycloakId: 'some-id', email: 'user@email.com', emailConfirmed: false, + companyId: null, phone: null, picture: null, createdAt: new Date('2021-10-07T13:38:11.097Z'), 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 b07f75937..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 @@ -4,4 +4,5 @@ export class CreateCompanyDto { legalPersonName?: string countryCode?: string cityId?: string + personId?: string } 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 d392ddae9..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 @@ -4,4 +4,5 @@ export class UpdateCompanyDto { legalPersonName?: string countryCode?: string cityId?: string + personId?: string } 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 d55e53344..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 @@ -2,6 +2,7 @@ export class ConnectPersonDto { id?: string email?: string personalNumber?: string + companyId?: string keycloakId?: string stripeCustomerId?: string } 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 00ebaddc1..52898b636 100644 --- a/apps/api/src/domain/generated/person/entities/person.entity.ts +++ b/apps/api/src/domain/generated/person/entities/person.entity.ts @@ -33,6 +33,7 @@ export class Person { birthday: Date | null emailConfirmed: boolean | null personalNumber: string | null + companyId: string | null keycloakId: string | null stripeCustomerId: string | null picture: string | null diff --git a/apps/api/src/donations/donations.controller.spec.ts b/apps/api/src/donations/donations.controller.spec.ts index 3d53572a9..039ff1087 100644 --- a/apps/api/src/donations/donations.controller.spec.ts +++ b/apps/api/src/donations/donations.controller.spec.ts @@ -9,6 +9,7 @@ import { DonationStatus, DonationType, PaymentProvider, + Person, Vault, } from '@prisma/client' import { CampaignService } from '../campaign/campaign.service' @@ -176,13 +177,13 @@ describe('DonationsController', () => { } const existingDonation = { ...mockDonation } - const existingTargetPerson = { + const existingTargetPerson: Person = { id: '2', firstName: 'string', lastName: 'string', email: 'string', phone: 'string', - company: 'string', + companyId: 'string', createdAt: new Date('2022-01-01'), updatedAt: new Date('2022-01-01'), newsletter: false, @@ -227,13 +228,13 @@ describe('DonationsController', () => { billingEmail: mockDonation.billingEmail, } - const existingTargetPerson = { + const existingTargetPerson: Person = { id: mockDonation.personId, firstName: 'string', lastName: 'string', email: mockDonation.billingEmail, phone: 'string', - company: 'string', + companyId: 'string', createdAt: new Date('2022-01-01'), updatedAt: new Date('2022-01-01'), newsletter: false, diff --git a/db/seed/person/factory.ts b/db/seed/person/factory.ts index 0414d1445..518435f0f 100644 --- a/db/seed/person/factory.ts +++ b/db/seed/person/factory.ts @@ -5,6 +5,7 @@ import { Person } from '@prisma/client' export const personFactory = Factory.define(() => ({ id: faker.datatype.uuid(), + companyId: null, keycloakId: null, stripeCustomerId: null, firstName: faker.name.firstName(), diff --git a/migrations/20231024102451_add_company_id_to_person_field/migration.sql b/migrations/20231024102451_add_company_id_to_person_field/migration.sql new file mode 100644 index 000000000..da2a87215 --- /dev/null +++ b/migrations/20231024102451_add_company_id_to_person_field/migration.sql @@ -0,0 +1,17 @@ +/* + Warnings: + + - A unique constraint covering the columns `[company_id]` on the table `people` will be added. If there are existing duplicate values, this will fail. + +*/ +-- DropForeignKey +ALTER TABLE "companies" DROP CONSTRAINT "companies_person_id_fkey"; + +-- AlterTable +ALTER TABLE "people" ADD COLUMN "company_id" UUID; + +-- CreateIndex +CREATE UNIQUE INDEX "people_company_id_key" ON "people"("company_id"); + +-- AddForeignKey +ALTER TABLE "people" ADD CONSTRAINT "people_company_id_fkey" FOREIGN KEY ("company_id") REFERENCES "companies"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/schema.prisma b/schema.prisma index ce1de6aa8..c84df7c0c 100644 --- a/schema.prisma +++ b/schema.prisma @@ -46,6 +46,7 @@ model Person { /// Uniform Civil Number (NCN, EGN) /// https://en.wikipedia.org/wiki/National_identification_number#Bulgaria personalNumber String? @unique @map("personal_number") + companyId String? @unique @map("company_id") @db.Uuid keycloakId String? @unique @map("keycloak_id") @db.Uuid stripeCustomerId String? @unique @map("stripe_customer_id") picture String? @db.VarChar(250) @@ -70,7 +71,7 @@ model Person { withdrawals Withdrawal[] publishedNews CampaignNews[] newsFiles CampaignNewsFile[] - company Company? + company Company? @relation(fields: [companyId], references: [id]) @@index([keycloakId], map: "keycloak_id_idx") @@index([stripeCustomerId], map: "stripe_customer_id_idx") @@ -91,7 +92,7 @@ model Company { updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) beneficiaries Beneficiary[] Campaign Campaign[] - person Person? @relation(fields: [personId], references: [id]) + person Person? affiliate Affiliate? @@map("companies") From e5f106567471b97d6b7c42ba9bf2ad0d1aa2c45c Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 13:46:14 +0300 Subject: [PATCH 30/79] auth.service: Add companyId in createPerson method --- apps/api/src/auth/auth.service.ts | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index bffd695ba..cbf3b5774 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -17,7 +17,7 @@ import { RequiredActionAlias } from '@keycloak/keycloak-admin-client/lib/defs/re import { AxiosResponse } from '@nestjs/terminus/dist/health-indicator/http/axios.interfaces' import { TokenResponseRaw } from '@keycloak/keycloak-admin-client/lib/utils/auth' -import { Person } from '@prisma/client' +import { Company, Person } from '@prisma/client' import { PrismaService } from '../prisma/prisma.service' import { LoginDto } from './dto/login.dto' import { CompanyRegisterDto, RegisterDto } from './dto/register.dto' @@ -161,7 +161,7 @@ export class AuthService { firstName: userData?.firstName ?? '', lastName: userData?.lastName ?? '', } - await this.createPerson(registerDto, user.sub) + await this.createPerson(registerDto, user.sub, undefined) } return { refreshToken: grant.refresh_token?.token, @@ -182,15 +182,16 @@ export class AuthService { isCorporateReg = false, ): Promise { let person: Person + let company: Company | null = null try { await this.authenticateAdmin() // Create user in Keycloak const user = await this.createKeycloakUser(registerDto, false, !isCorporateReg) // Insert or connect person in app db - person = await this.createPerson(registerDto, user.id) if (isCorporateReg) { - await this.createCompany(registerDto as CompanyRegisterDto, person.id) + company = await this.createCompany(registerDto as CompanyRegisterDto) } + person = await this.createPerson(registerDto, user.id, company?.id) } catch (error) { const response = { error: error.message, @@ -271,7 +272,11 @@ export class AuthService { return `${serverUrl}/realms/${realm}/protocol/openid-connect/token` } - private async createPerson(registerDto: RegisterDto, keycloakId: string) { + private async createPerson( + registerDto: RegisterDto, + keycloakId: string, + companyId: string | null | undefined, + ) { return await this.prismaService.person.upsert({ // Create a person with the provided keycloakId create: { @@ -280,6 +285,7 @@ export class AuthService { firstName: registerDto.firstName, lastName: registerDto.lastName, newsletter: registerDto.newsletter ? registerDto.newsletter : false, + companyId: companyId, }, // Store keycloakId to the person with same email update: { keycloakId }, @@ -287,18 +293,15 @@ export class AuthService { }) } - private async createCompany(registerDto: CompanyRegisterDto, personId: string) { - return await this.prismaService.company.upsert({ + private async createCompany(registerDto: CompanyRegisterDto): Promise { + return await this.prismaService.company.create({ // Create a person with the provided keycloakId - create: { - personId: personId, + data: { companyNumber: registerDto.companyNumber, companyName: registerDto.companyName, legalPersonName: registerDto.firstName + ' ' + registerDto.lastName, }, // Store keycloakId to the person with same email - update: { personId }, - where: { personId }, }) } From 9c5f796f5b8633db16e9b0a9e5ce4c64687f061f Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 14:13:15 +0300 Subject: [PATCH 31/79] src/register.controller: Use single endpoint for registration - Removed CompanyRegisterDto, and moved companyNumber and companyName to RegisterDto. - Added type to RegisterDto, to differentiate individual/corporate profiles - Made it so companyName and companyNumber fields will be validated only if profile's type is corporate --- apps/api/src/auth/auth.service.ts | 9 ++++--- apps/api/src/auth/dto/register.dto.ts | 25 ++++++++++++++++--- apps/api/src/auth/register.controller.spec.ts | 2 +- apps/api/src/auth/register.controller.ts | 22 +++++++--------- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index cbf3b5774..fdefb984e 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -20,7 +20,7 @@ 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 { CompanyRegisterDto, RegisterDto } from './dto/register.dto' +import { ProfileType, RegisterDto } from './dto/register.dto' import { RefreshDto } from './dto/refresh.dto' import { KeycloakTokenParsed } from './keycloak' import { ProviderDto } from './dto/provider.dto' @@ -156,10 +156,13 @@ export class AuthService { await this.authenticateAdmin() const userData = await this.admin.users.findOne({ id: user.sub }) const registerDto: RegisterDto = { + type: ProfileType.INDIVIDUAL, email: userData?.email ?? '', password: '', firstName: userData?.firstName ?? '', lastName: userData?.lastName ?? '', + companyName: 'typechecking-hack', + companyNumber: 'typechecking-hack', } await this.createPerson(registerDto, user.sub, undefined) } @@ -189,7 +192,7 @@ export class AuthService { const user = await this.createKeycloakUser(registerDto, false, !isCorporateReg) // Insert or connect person in app db if (isCorporateReg) { - company = await this.createCompany(registerDto as CompanyRegisterDto) + company = await this.createCompany(registerDto) } person = await this.createPerson(registerDto, user.id, company?.id) } catch (error) { @@ -293,7 +296,7 @@ export class AuthService { }) } - private async createCompany(registerDto: CompanyRegisterDto): Promise { + private async createCompany(registerDto: RegisterDto): Promise { return await this.prismaService.company.create({ // Create a person with the provided keycloakId data: { diff --git a/apps/api/src/auth/dto/register.dto.ts b/apps/api/src/auth/dto/register.dto.ts index b214b9063..d654e1aaf 100644 --- a/apps/api/src/auth/dto/register.dto.ts +++ b/apps/api/src/auth/dto/register.dto.ts @@ -1,8 +1,27 @@ import { ApiProperty } from '@nestjs/swagger' import { Expose } from 'class-transformer' -import { IsBoolean, IsEmail, IsNotEmpty, IsOptional, IsString, MaxLength } from 'class-validator' +import { + IsBoolean, + IsEmail, + IsEnum, + IsNotEmpty, + IsOptional, + IsString, + MaxLength, + ValidateIf, +} from 'class-validator' + +export enum ProfileType { + INDIVIDUAL = 'individual', + CORPORATE = 'corporate', +} export class RegisterDto { + @ApiProperty() + @Expose() + @IsEnum(ProfileType) + public readonly type: ProfileType = ProfileType.INDIVIDUAL + @ApiProperty() @Expose() @IsNotEmpty() @@ -32,15 +51,15 @@ export class RegisterDto { @IsOptional() @IsBoolean() public readonly newsletter?: boolean -} -export class CompanyRegisterDto extends RegisterDto { + @ValidateIf((o) => o.type === ProfileType.CORPORATE) @Expose() @IsString() @ApiProperty() @MaxLength(100) companyName: string + @ValidateIf((o) => o.type === ProfileType.CORPORATE) @Expose() @IsString() @ApiProperty({ diff --git a/apps/api/src/auth/register.controller.spec.ts b/apps/api/src/auth/register.controller.spec.ts index f7c630bb7..e819b375a 100644 --- a/apps/api/src/auth/register.controller.spec.ts +++ b/apps/api/src/auth/register.controller.spec.ts @@ -36,7 +36,7 @@ describe('RegisterController', () => { describe('createUser', () => { const registerDto = new RegisterDto() it('should call createUser', async () => { - expect(await controller.registerIndividual(registerDto)) + expect(await controller.register(registerDto)) expect(spyService.createUser).toHaveBeenCalled() expect(spyService.createUser).toHaveBeenCalledWith(registerDto) }) diff --git a/apps/api/src/auth/register.controller.ts b/apps/api/src/auth/register.controller.ts index c8ad5facc..8197fcea1 100644 --- a/apps/api/src/auth/register.controller.ts +++ b/apps/api/src/auth/register.controller.ts @@ -1,7 +1,7 @@ import { Body, ConflictException, Controller, Post } from '@nestjs/common' import { Public, Resource, Scopes } from 'nest-keycloak-connect' import { AuthService } from './auth.service' -import { CompanyRegisterDto, RegisterDto } from './dto/register.dto' +import { RegisterDto, ProfileType } from './dto/register.dto' import { ApiTags } from '@nestjs/swagger' import { CompanyService } from '../company/company.service' @@ -14,19 +14,15 @@ export class RegisterController { private readonly companyService: CompanyService, ) {} - @Post('individual') + @Post() @Public() @Scopes('view') - async registerIndividual(@Body() registerDto: RegisterDto) { - return await this.authService.createUser(registerDto) - } - @Post('corporate') - @Public() - @Scopes('view') - async registerCorporate(@Body() registerDto: CompanyRegisterDto) { - const company = await this.companyService.findOneByEIK(registerDto.companyNumber) - if (company) throw new ConflictException('Company with this number has been registered already') - - return await this.authService.createUser(registerDto, true) + async register(@Body() registerDto: RegisterDto) { + const isCorporateReg = registerDto.type === ProfileType.CORPORATE + if (isCorporateReg) { + const company = await this.companyService.findOneByEIK(registerDto.companyNumber) + if (company) throw new ConflictException('Company with this EIK already exists') + } + return await this.authService.createUser(registerDto, isCorporateReg) } } From fa1a0c1b6ad95237bc2b745d6aceba276d089a0b Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 15:34:54 +0300 Subject: [PATCH 32/79] Consider bank transaction as successfull if no guaranteed donations are found --- .../api/src/tasks/bank-import/import-transactions.task.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/api/src/tasks/bank-import/import-transactions.task.ts b/apps/api/src/tasks/bank-import/import-transactions.task.ts index 8a60bb1b7..c2d3de42f 100644 --- a/apps/api/src/tasks/bank-import/import-transactions.task.ts +++ b/apps/api/src/tasks/bank-import/import-transactions.task.ts @@ -458,10 +458,16 @@ export class IrisTasks { private async processAffiliateDonations(affiliate: AffiliatePayload, trx: filteredTransaction) { let totalDonated = 0 let updatedDonations = 0 - if (!trx.amount || affiliate.donations.length === 0) { + if (!trx.amount) { trx.bankDonationStatus = BankDonationStatus.importFailed return ImportStatus.UNPROCESSED } + //If no guaranteed donations are found for the affiliate + //mark the transaction as imported + if (affiliate.donations.length === 0) { + trx.bankDonationStatus = BankDonationStatus.imported + return ImportStatus.SUCCESS + } for (const donation of affiliate.donations) { if (trx.amount - totalDonated < donation.amount) continue From 7cbe6f721749f9824ea9e89f4524fc66ae197aad Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 15:46:12 +0300 Subject: [PATCH 33/79] affiliate: Rename endpoints --- apps/api/src/affiliate/affiliate.controller.ts | 14 +++++--------- .../affiliate/dto/cancel-affiliate-donation.dto.ts | 11 ----------- .../affiliate/dto/create-affiliate-donation.dto.ts | 2 +- 3 files changed, 6 insertions(+), 21 deletions(-) delete mode 100644 apps/api/src/affiliate/dto/cancel-affiliate-donation.dto.ts diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index dc901d4b9..c1d131162 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -18,7 +18,6 @@ import { AffiliateService } from './affiliate.service' import { AffiliateStatusUpdateDto } from './dto/affiliate-status-update.dto' import { CreateAffiliateDonation } from './dto/create-affiliate-donation.dto' import { DonationsService } from '../donations/donations.service' -import { CancelAffiliateDonation } from './dto/cancel-affiliate-donation.dto' import { shouldAllowStatusChange } from '../donations/helpers/donation-status-updates' import { affiliateCodeGenerator } from './utils/affiliateCodeGenerator' @@ -39,7 +38,7 @@ export class AffiliateController { return await this.affiliateService.create(person.company.id) } - @Patch(':affiliateId/status-update') + @Patch(':affiliateId/status') async updateAffiliateStatus( @Param('affiliateId') affiliateId: string, @Body() { newStatus }: AffiliateStatusUpdateDto, @@ -73,7 +72,7 @@ export class AffiliateController { return await this.affiliateService.findOneByCode(affilliateCode) } - @Post(':affiliateCode/donations/create') + @Post(':affiliateCode/donation') @Public() async createAffiliateDonation( @Param('affiliateCode') affiliateCode: string, @@ -94,16 +93,13 @@ export class AffiliateController { return await this.donationService.createAffiliateDonation(affiliateDonationDto) } - @Patch(':affiliateCode/donations/cancel') + @Patch(':affiliateCode/donations/:donationId/cancel') @Public() async cancelAffiliateDonation( @Param('affiliateCode') affiliateCode: string, - @Body() donationDto: CancelAffiliateDonation, + @Param('donationId') donationId: string, ) { - const donation = await this.donationService.getAffiliateDonationById( - donationDto.donationId, - affiliateCode, - ) + const donation = await this.donationService.getAffiliateDonationById(donationId, affiliateCode) if (!donation) throw new NotFoundException('Donation with this id is not found') if (!shouldAllowStatusChange(donation.status, 'cancelled')) diff --git a/apps/api/src/affiliate/dto/cancel-affiliate-donation.dto.ts b/apps/api/src/affiliate/dto/cancel-affiliate-donation.dto.ts deleted file mode 100644 index 08eecf672..000000000 --- a/apps/api/src/affiliate/dto/cancel-affiliate-donation.dto.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger' -import { Expose } from 'class-transformer' -import { IsString, IsUUID } from 'class-validator' - -export class CancelAffiliateDonation { - @ApiProperty() - @Expose() - @IsUUID() - @IsString() - donationId: string -} diff --git a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts index 60aa749b2..6607af36f 100644 --- a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts +++ b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts @@ -28,7 +28,7 @@ export class CreateAffiliateDonation { @IsString() @IsOptional() - extPaymentMethodId: string = 'pm_' + randomUUID() + extPaymentMethodId: string = 'affiliate' @ApiProperty() @Expose() From 80711dd9e192bbb11608b44af6a8117a698992b0 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 17:16:50 +0300 Subject: [PATCH 34/79] bank-transaction: Update bankDonationStatus on duplicate record --- .../tasks/bank-import/import-transactions.task.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/api/src/tasks/bank-import/import-transactions.task.ts b/apps/api/src/tasks/bank-import/import-transactions.task.ts index c2d3de42f..fb639f276 100644 --- a/apps/api/src/tasks/bank-import/import-transactions.task.ts +++ b/apps/api/src/tasks/bank-import/import-transactions.task.ts @@ -150,7 +150,7 @@ export class IrisTasks { // 6. Save BankTransactions to DB try { const savedTransactions = await this.saveBankTrxRecords(processedBankTrxRecords) - Logger.debug('Saved transactions count: ' + savedTransactions.count) + Logger.debug('Saved transactions count: ' + savedTransactions.length) } catch (e) { return Logger.error('Failed to import transactions into DB: ' + e.message) } @@ -219,7 +219,7 @@ export class IrisTasks { // 6. Save BankTransactions to DB try { const savedTransactions = await this.saveBankTrxRecords(processedBankTrxRecords) - Logger.debug('Saved transactions count: ' + savedTransactions.count) + Logger.debug('Saved transactions count: ' + savedTransactions.length) } catch (e) { return Logger.error('Failed to import transactions into DB: ' + e.message) } @@ -508,7 +508,15 @@ export class IrisTasks { private async saveBankTrxRecords(data: filteredTransaction[]) { // Insert new transactions - const inserted = await this.prisma.bankTransaction.createMany({ data, skipDuplicates: true }) + const inserted = await this.prisma.$transaction( + data.map((trx) => + this.prisma.bankTransaction.upsert({ + where: { id: trx.id }, + update: { bankDonationStatus: trx.bankDonationStatus }, + create: { ...trx }, + }), + ), + ) return inserted } From 4de21dfa4874e56d50f81bbc02d599293a76a52c Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 17:18:35 +0300 Subject: [PATCH 35/79] affiliate: Create endpoint to get donations with pagination --- .../affiliate/affiliate.controller.spec.ts | 16 ++++---- .../api/src/affiliate/affiliate.controller.ts | 23 +++++++++++- apps/api/src/affiliate/affiliate.service.ts | 37 +++++++++++++++++-- 3 files changed, 62 insertions(+), 14 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.spec.ts b/apps/api/src/affiliate/affiliate.controller.spec.ts index 1b18b9954..20ca5c2de 100644 --- a/apps/api/src/affiliate/affiliate.controller.spec.ts +++ b/apps/api/src/affiliate/affiliate.controller.spec.ts @@ -17,7 +17,6 @@ import { BadRequestException, ConflictException, ForbiddenException } from '@nes import { AffiliateStatusUpdateDto } from './dto/affiliate-status-update.dto' import * as afCodeGenerator from './utils/affiliateCodeGenerator' import { CreateAffiliateDonation } from './dto/create-affiliate-donation.dto' -import { CancelAffiliateDonation } from './dto/cancel-affiliate-donation.dto' type PersonWithPayload = Prisma.PersonGetPayload<{ include: { company: true } }> type AffiliateWithPayload = Prisma.AffiliateGetPayload<{ @@ -322,30 +321,29 @@ describe('AffiliateController', () => { ...donationResponseMock, status: 'cancelled', } - const donationDto: CancelAffiliateDonation = { donationId: donationResponseMock.id } const affiliateDonationSpy = jest .spyOn(donationService, 'getAffiliateDonationById') .mockResolvedValue(donationResponseMock) const updateDonationStatus = jest .spyOn(donationService, 'update') .mockResolvedValue(cancelledDonationResponse) - expect(await controller.cancelAffiliateDonation(affiliateCodeMock, donationDto)).toEqual( - cancelledDonationResponse, - ) + expect( + await controller.cancelAffiliateDonation(affiliateCodeMock, donationResponseMock.id), + ).toEqual(cancelledDonationResponse) }) it('should throw error if donation status is succeeded', async () => { const succeededDonationResponse: Donation = { ...donationResponseMock, status: 'succeeded', } - const donationDto: CancelAffiliateDonation = { donationId: donationResponseMock.id } + const affiliateDonationSpy = jest .spyOn(donationService, 'getAffiliateDonationById') .mockResolvedValue(succeededDonationResponse) const updateDonationStatus = jest.spyOn(donationService, 'update') - expect(controller.cancelAffiliateDonation(affiliateCodeMock, donationDto)).rejects.toThrow( - new BadRequestException("Donation status can't be updated"), - ) + expect( + controller.cancelAffiliateDonation(affiliateCodeMock, donationResponseMock.id), + ).rejects.toThrow(new BadRequestException("Donation status can't be updated")) expect(updateDonationStatus).not.toHaveBeenCalled() }) }) diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index c1d131162..6c98ebb2e 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -3,12 +3,15 @@ import { Body, ConflictException, Controller, + DefaultValuePipe, ForbiddenException, Get, NotFoundException, Param, + ParseIntPipe, Patch, Post, + Query, } from '@nestjs/common' import { ApiTags } from '@nestjs/swagger' import { PersonService } from '../person/person.service' @@ -20,6 +23,7 @@ import { CreateAffiliateDonation } from './dto/create-affiliate-donation.dto' import { DonationsService } from '../donations/donations.service' import { shouldAllowStatusChange } from '../donations/helpers/donation-status-updates' import { affiliateCodeGenerator } from './utils/affiliateCodeGenerator' +import { DonationStatus } from '@prisma/client' @Controller('affiliate') @ApiTags('affiliate') @@ -69,7 +73,7 @@ export class AffiliateController { @Get(':affiliateCode') @Public() async affiliateSummary(@Param('affiliateCode') affilliateCode: string) { - return await this.affiliateService.findOneByCode(affilliateCode) + return await this.affiliateService.getAffiliateSummaryByCode(affilliateCode) } @Post(':affiliateCode/donation') @@ -81,7 +85,6 @@ export class AffiliateController { const affiliate = await this.affiliateService.findOneByCode(affiliateCode) if (!affiliate || !affiliate.company || !affiliate.company.person) throw new NotFoundException('Affiliate not found') - const affiliateDonationDto: CreateAffiliateDonation = { ...donation, affiliateId: affiliate.id, @@ -93,6 +96,22 @@ export class AffiliateController { return await this.donationService.createAffiliateDonation(affiliateDonationDto) } + @Get(':affiliateCode/donations') + @Public() + async getAffiliateDonations( + @Param('affiliateCode') affiliateCode: string, + @Query('status') status: DonationStatus | undefined, + @Query('page', new DefaultValuePipe(1), ParseIntPipe) page: number, + @Query('limit', new DefaultValuePipe(10), ParseIntPipe) limit: number, + ) { + return await this.affiliateService.findAffiliateDonationsWithPagination( + affiliateCode, + status, + page, + limit, + ) + } + @Patch(':affiliateCode/donations/:donationId/cancel') @Public() async cancelAffiliateDonation( diff --git a/apps/api/src/affiliate/affiliate.service.ts b/apps/api/src/affiliate/affiliate.service.ts index 79f3b30e6..bc02baca3 100644 --- a/apps/api/src/affiliate/affiliate.service.ts +++ b/apps/api/src/affiliate/affiliate.service.ts @@ -1,11 +1,10 @@ import { Injectable } from '@nestjs/common' import { PrismaService } from '../prisma/prisma.service' -import { AffiliateStatus } from '@prisma/client' +import { AffiliateStatus, DonationStatus } from '@prisma/client' @Injectable() export class AffiliateService { constructor(private readonly prismaService: PrismaService) {} - async create(companyId: string) { const affiliate = await this.prismaService.affiliate.create({ data: { companyId }, @@ -23,10 +22,42 @@ export class AffiliateService { }) } + async findAffiliateDonationsWithPagination( + affiliateCode: string, + status: DonationStatus | undefined, + currentPage: number, + limit: number, + ) { + return await this.prismaService.affiliate.findUnique({ + where: { affiliateCode }, + select: { + donations: { + orderBy: { createdAt: 'desc' }, + where: { status }, + take: limit, + skip: Number((currentPage - 1) * limit), + }, + }, + }) + } + + async getAffiliateSummaryByCode(affiliateCode: string) { + return await this.prismaService.affiliate.findUnique({ + where: { affiliateCode }, + include: { + donations: { + orderBy: { createdAt: 'desc' }, + take: 10, + }, + company: { select: { companyName: true, companyNumber: true, legalPersonName: true } }, + }, + }) + } + async findOneByCode(affiliateCode: string) { return await this.prismaService.affiliate.findUnique({ where: { affiliateCode }, - include: { donations: true, company: { select: { person: true } } }, + include: { company: { select: { person: true } } }, }) } From 480524aafda6b5499d651b496281c999f3b83c59 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 17:21:35 +0300 Subject: [PATCH 36/79] schema.prisma:Affiliate: Make companyId not null --- .../affiliate/entities/affiliate.entity.ts | 4 ++-- .../migration.sql | 14 ++++++++++++++ schema.prisma | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 migrations/20231024142056_affiliate_make_company_id_not_null/migration.sql 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 3b9e70f74..98e2a43cd 100644 --- a/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts +++ b/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts @@ -6,7 +6,7 @@ export class Affiliate { id: string status: AffiliateStatus affiliateCode: string | null - companyId: string | null - company?: Company | null + companyId: string + company?: Company donations?: Donation[] } diff --git a/migrations/20231024142056_affiliate_make_company_id_not_null/migration.sql b/migrations/20231024142056_affiliate_make_company_id_not_null/migration.sql new file mode 100644 index 000000000..aec1f9ec3 --- /dev/null +++ b/migrations/20231024142056_affiliate_make_company_id_not_null/migration.sql @@ -0,0 +1,14 @@ +/* + Warnings: + + - Made the column `company_id` on table `affiliates` required. This step will fail if there are existing NULL values in that column. + +*/ +-- DropForeignKey +ALTER TABLE "affiliates" DROP CONSTRAINT "affiliates_company_id_fkey"; + +-- AlterTable +ALTER TABLE "affiliates" ALTER COLUMN "company_id" SET NOT NULL; + +-- AddForeignKey +ALTER TABLE "affiliates" ADD CONSTRAINT "affiliates_company_id_fkey" FOREIGN KEY ("company_id") REFERENCES "companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/schema.prisma b/schema.prisma index c84df7c0c..0d13801f9 100644 --- a/schema.prisma +++ b/schema.prisma @@ -102,8 +102,8 @@ model Affiliate { id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid status AffiliateStatus @default(pending) affiliateCode String? @unique @map("affiliate_code") - companyId String? @unique @map("company_id") @db.Uuid - company Company? @relation(fields: [companyId], references: [id]) + companyId String @unique @map("company_id") @db.Uuid + company Company @relation(fields: [companyId], references: [id]) donations Donation[] @@map("affiliates") From 7245c78a2f0ff5f97df62470e6a88da23aaf489a Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 17:22:31 +0300 Subject: [PATCH 37/79] affiliateCodeGenerator: Get the first 8 characters --- apps/api/src/affiliate/utils/affiliateCodeGenerator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/affiliate/utils/affiliateCodeGenerator.ts b/apps/api/src/affiliate/utils/affiliateCodeGenerator.ts index 219be8d2f..a82d09e6a 100644 --- a/apps/api/src/affiliate/utils/affiliateCodeGenerator.ts +++ b/apps/api/src/affiliate/utils/affiliateCodeGenerator.ts @@ -1,6 +1,6 @@ import crypto from 'crypto' export function affiliateCodeGenerator(affiliateId: string) { - const uniqueHash = crypto.createHash('sha256').update(affiliateId).digest('hex').slice(0, 5) + const uniqueHash = crypto.createHash('sha256').update(affiliateId).digest('hex').slice(0, 8) return 'af_' + uniqueHash } From 1c09553f44ae56a96ad9dd8ecbd5e78209e00f64 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 17:43:43 +0300 Subject: [PATCH 38/79] eslint: Address error and warnings --- .../affiliate/affiliate.controller.spec.ts | 30 +++++++------------ .../dto/create-affiliate-donation.dto.ts | 2 +- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.spec.ts b/apps/api/src/affiliate/affiliate.controller.spec.ts index 20ca5c2de..b1c341b7b 100644 --- a/apps/api/src/affiliate/affiliate.controller.spec.ts +++ b/apps/api/src/affiliate/affiliate.controller.spec.ts @@ -158,9 +158,7 @@ describe('AffiliateController', () => { describe('Join program request', () => { it('should throw error if request is from individual profile', async () => { const createAffiliateSpy = jest.spyOn(service, 'create') - const findOneSpy = jest - .spyOn(prismaMock.person, 'findFirst') - .mockResolvedValue(mockIndividualProfile) + jest.spyOn(prismaMock.person, 'findFirst').mockResolvedValue(mockIndividualProfile) expect(controller.joinAffiliateProgramRequest(userMock)).rejects.toThrow( new BadRequestException('Must be corporate profile'), ) @@ -183,9 +181,7 @@ describe('AffiliateController', () => { }, } const createAffiliateSpy = jest.spyOn(service, 'create').mockResolvedValue(affiliateMock) - const findOneSpy = jest - .spyOn(prismaMock.person, 'findFirst') - .mockResolvedValue(mockCorporateProfile) + jest.spyOn(prismaMock.person, 'findFirst').mockResolvedValue(mockCorporateProfile) expect(await controller.joinAffiliateProgramRequest(userMock)).toEqual(affiliateMock) expect(createAffiliateSpy).toHaveBeenCalled() @@ -208,7 +204,7 @@ describe('AffiliateController', () => { ...userMock, resource_access: { account: { roles: ['manage-account', 'account-view-supporters'] } }, } - const findAffiliateSpy = jest.spyOn(service, 'findOneById').mockResolvedValue(affiliateMock) + jest.spyOn(service, 'findOneById').mockResolvedValue(affiliateMock) const codeGenerationSpy = jest .spyOn(afCodeGenerator, 'affiliateCodeGenerator') @@ -241,9 +237,7 @@ describe('AffiliateController', () => { const mockCancelledStatus: AffiliateStatusUpdateDto = { newStatus: 'cancelled', } - const findAffiliateSpy = jest - .spyOn(service, 'findOneById') - .mockResolvedValue(activeAffiliateMock) + jest.spyOn(service, 'findOneById').mockResolvedValue(activeAffiliateMock) const codeGenerationSpy = jest .spyOn(afCodeGenerator, 'affiliateCodeGenerator') @@ -265,9 +259,7 @@ describe('AffiliateController', () => { resource_access: { account: { roles: ['manage-account', 'account-view-supporters'] } }, } - const findAffiliateSpy = jest - .spyOn(service, 'findOneById') - .mockResolvedValue(activeAffiliateMock) + jest.spyOn(service, 'findOneById').mockResolvedValue(activeAffiliateMock) const updateStatusDto: AffiliateStatusUpdateDto = { newStatus: 'active', @@ -302,11 +294,11 @@ describe('AffiliateController', () => { currency: 'BGN', toEntity: new CreateAffiliateDonation().toEntity, } - const prismaSpy = jest.spyOn(service, 'findOneByCode').mockResolvedValue(activeAffiliateMock) + jest.spyOn(service, 'findOneByCode').mockResolvedValue(activeAffiliateMock) const createAffiliateDonationSpy = jest .spyOn(donationService, 'createAffiliateDonation') .mockResolvedValue(donationResponseMock) - const findVaultSpy = jest.spyOn(prismaMock.vault, 'findMany').mockResolvedValue([vaultMock]) + jest.spyOn(prismaMock.vault, 'findMany').mockResolvedValue([vaultMock]) await controller.createAffiliateDonation(affiliateCodeMock, affiliateDonationDto) expect(createAffiliateDonationSpy).toHaveBeenCalledWith({ ...affiliateDonationDto, @@ -321,12 +313,10 @@ describe('AffiliateController', () => { ...donationResponseMock, status: 'cancelled', } - const affiliateDonationSpy = jest + jest .spyOn(donationService, 'getAffiliateDonationById') .mockResolvedValue(donationResponseMock) - const updateDonationStatus = jest - .spyOn(donationService, 'update') - .mockResolvedValue(cancelledDonationResponse) + jest.spyOn(donationService, 'update').mockResolvedValue(cancelledDonationResponse) expect( await controller.cancelAffiliateDonation(affiliateCodeMock, donationResponseMock.id), ).toEqual(cancelledDonationResponse) @@ -337,7 +327,7 @@ describe('AffiliateController', () => { status: 'succeeded', } - const affiliateDonationSpy = jest + jest .spyOn(donationService, 'getAffiliateDonationById') .mockResolvedValue(succeededDonationResponse) const updateDonationStatus = jest.spyOn(donationService, 'update') diff --git a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts index 6607af36f..6b5469d25 100644 --- a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts +++ b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts @@ -28,7 +28,7 @@ export class CreateAffiliateDonation { @IsString() @IsOptional() - extPaymentMethodId: string = 'affiliate' + extPaymentMethodId = 'affiliate' @ApiProperty() @Expose() From b7c271666050bd1c386d15476cd5fe451801c2bd Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 17:51:37 +0300 Subject: [PATCH 39/79] tasks/bank-import: Change bankstatus only if donation is affiliate --- apps/api/src/tasks/bank-import/import-transactions.task.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/api/src/tasks/bank-import/import-transactions.task.ts b/apps/api/src/tasks/bank-import/import-transactions.task.ts index fb639f276..50d125e10 100644 --- a/apps/api/src/tasks/bank-import/import-transactions.task.ts +++ b/apps/api/src/tasks/bank-import/import-transactions.task.ts @@ -512,7 +512,11 @@ export class IrisTasks { data.map((trx) => this.prisma.bankTransaction.upsert({ where: { id: trx.id }, - update: { bankDonationStatus: trx.bankDonationStatus }, + update: { + bankDonationStatus: trx.description.startsWith('af_') + ? trx.bankDonationStatus + : undefined, + }, create: { ...trx }, }), ), From 8d389a5dd47b8a684f2be6021cab22147c27a197 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 24 Oct 2023 18:09:26 +0300 Subject: [PATCH 40/79] jest: Fix tests --- apps/api/src/auth/register.controller.spec.ts | 2 +- .../src/tasks/bank-import/import-transactions.task.spec.ts | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/api/src/auth/register.controller.spec.ts b/apps/api/src/auth/register.controller.spec.ts index e819b375a..5a9e13ec5 100644 --- a/apps/api/src/auth/register.controller.spec.ts +++ b/apps/api/src/auth/register.controller.spec.ts @@ -38,7 +38,7 @@ describe('RegisterController', () => { it('should call createUser', async () => { expect(await controller.register(registerDto)) expect(spyService.createUser).toHaveBeenCalled() - expect(spyService.createUser).toHaveBeenCalledWith(registerDto) + expect(spyService.createUser).toHaveBeenCalledWith(registerDto, false) }) }) }) diff --git a/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts b/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts index c56b0d2ef..d6091a9d0 100644 --- a/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts +++ b/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts @@ -450,11 +450,7 @@ describe('ImportTransactionsTask', () => { expect(parameters[4]).not.toBeDefined() // Only new transactions should be saved - expect(prismaMock.bankTransaction.createMany).toHaveBeenCalledWith( - expect.objectContaining({ - skipDuplicates: true, - }), - ) + expect(prismaMock.bankTransaction.upsert).toHaveBeenCalled() // 7.Notify for unrecognized bank donations expect(notifyUnrecognizedSpy).toHaveBeenCalledWith( From 42959879e7496c2034d255dc4c400298e370b8cc Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Wed, 25 Oct 2023 16:13:55 +0300 Subject: [PATCH 41/79] swagger: Provide schema for iris-transaction-test endpoint --- .../bank-transactions.controller.ts | 12 +++++++++++- .../dto/bank-transactions-iris-simulate.dto.ts | 2 +- .../dto/iris-bank-account-info.dto.ts | 3 +++ .../dto/iris-bank-transaction-info.dto.ts | 15 +++++++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/apps/api/src/bank-transactions/bank-transactions.controller.ts b/apps/api/src/bank-transactions/bank-transactions.controller.ts index 33ce74af0..1143b55d6 100644 --- a/apps/api/src/bank-transactions/bank-transactions.controller.ts +++ b/apps/api/src/bank-transactions/bank-transactions.controller.ts @@ -5,6 +5,7 @@ import { Controller, ForbiddenException, Get, + HttpCode, Logger, NotFoundException, Param, @@ -13,7 +14,7 @@ import { Query, Res, } from '@nestjs/common' -import { ApiQuery, ApiTags } from '@nestjs/swagger' +import { ApiBody, ApiOperation, ApiQuery, ApiResponse, ApiTags } from '@nestjs/swagger' import { RealmViewSupporters, ViewSupporters } from '@podkrepi-bg/podkrepi-types' import { Roles, RoleMatchingMode, AuthenticatedUser } from 'nest-keycloak-connect' import { KeycloakTokenParsed, isAdmin } from '../auth/keycloak' @@ -28,6 +29,8 @@ import { DateTime, Interval } from 'luxon' import { ConfigService } from '@nestjs/config' import { IrisBankTransactionSimulationDto } from './dto/bank-transactions-iris-simulate.dto' import { AffiliateService } from '../affiliate/affiliate.service' +import { IrisIbanAccountInfoDto } from './dto/iris-bank-account-info.dto' +import { IrisTransactionInfoDto } from './dto/iris-bank-transaction-info.dto' @ApiTags('bank-transaction') @Controller('bank-transaction') @@ -152,6 +155,13 @@ export class BankTransactionsController { }) } + @ApiOperation({ summary: 'Simulating bank transaction response from IRIS API' }) + @ApiResponse({ status: 204 }) + @ApiBody({ + type: IrisBankTransactionSimulationDto, + description: 'Request body for simulating IRIS response', + }) + @HttpCode(204) @Post('iris-transaction-test') async testIrisInsertion( @Body() irisDto: IrisBankTransactionSimulationDto, diff --git a/apps/api/src/bank-transactions/dto/bank-transactions-iris-simulate.dto.ts b/apps/api/src/bank-transactions/dto/bank-transactions-iris-simulate.dto.ts index 100491ea6..065200b78 100644 --- a/apps/api/src/bank-transactions/dto/bank-transactions-iris-simulate.dto.ts +++ b/apps/api/src/bank-transactions/dto/bank-transactions-iris-simulate.dto.ts @@ -13,7 +13,7 @@ export class IrisBankTransactionSimulationDto { @Type(() => IrisIbanAccountInfoDto) irisIbanAccountInfo: IrisIbanAccountInfoDto - @ApiProperty() + @ApiProperty({ type: () => IrisTransactionInfoDto }) @Expose() @IsArray() @ValidateNested({ each: true }) diff --git a/apps/api/src/bank-transactions/dto/iris-bank-account-info.dto.ts b/apps/api/src/bank-transactions/dto/iris-bank-account-info.dto.ts index f2e9a2ee8..1e671831d 100644 --- a/apps/api/src/bank-transactions/dto/iris-bank-account-info.dto.ts +++ b/apps/api/src/bank-transactions/dto/iris-bank-account-info.dto.ts @@ -1,3 +1,4 @@ +import { ApiProperty } from '@nestjs/swagger' import { Currency } from '@prisma/client' import { Expose } from 'class-transformer' import { IsIBAN, IsString } from 'class-validator' @@ -12,6 +13,7 @@ export class IrisIbanAccountInfoDto { name: string + @ApiProperty() @IsString() @IsIBAN() @Expose() @@ -23,6 +25,7 @@ export class IrisIbanAccountInfoDto { bankHash: string + @ApiProperty() @IsString() @Expose() bankName: string diff --git a/apps/api/src/bank-transactions/dto/iris-bank-transaction-info.dto.ts b/apps/api/src/bank-transactions/dto/iris-bank-transaction-info.dto.ts index cf832605c..6ff9cf07b 100644 --- a/apps/api/src/bank-transactions/dto/iris-bank-transaction-info.dto.ts +++ b/apps/api/src/bank-transactions/dto/iris-bank-transaction-info.dto.ts @@ -1,3 +1,4 @@ +import { ApiProperty } from '@nestjs/swagger' import { Currency } from '@prisma/client' import { Expose, Type } from 'class-transformer' import { @@ -11,6 +12,7 @@ import { } from 'class-validator' class bankAccountDto { + @ApiProperty() @IsString() @IsIBAN() @Expose() @@ -18,65 +20,78 @@ class bankAccountDto { } class transactionAmountDto { + @ApiProperty() @IsNumber() @Expose() amount: number + @ApiProperty() @IsEnum(Currency) @Expose() currency: Currency } export class IrisTransactionInfoDto { + @ApiProperty() @IsString() @Expose() transactionId: string + @ApiProperty() @IsString() @Expose() bookingDate: string + @ApiProperty() @IsObject() @Expose() @Type(() => bankAccountDto) @ValidateNested({ each: true }) debtorAccount: bankAccountDto + @ApiProperty() @IsObject() @Expose() @Type(() => bankAccountDto) @ValidateNested({ each: true }) creditorAccount: bankAccountDto + @ApiProperty() @IsOptional() @IsString() @Expose() creditorName: string | null + @ApiProperty() @IsOptional() @IsString() @Expose() debtorName: string | null + @ApiProperty() @IsString() @Expose() remittanceInformationUnstructured: string + @ApiProperty() @IsObject() @Expose() @Type(() => transactionAmountDto) @ValidateNested({ each: true }) transactionAmount: transactionAmountDto + @ApiProperty() @IsOptional() @IsNumber() @Expose() exchangeRate: number | null + @ApiProperty() @Expose() @IsString() valueDate: string + @ApiProperty() @Expose() @IsString() creditDebitIndicator: 'DEBIT' | 'CREDIT' From 724ac2d7d01de6643b4b80d8da1fa67c7d2f7233 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 26 Oct 2023 18:12:45 +0300 Subject: [PATCH 42/79] bank-import: Initialize variable with affiliate code prefix --- apps/api/src/tasks/bank-import/import-transactions.task.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/api/src/tasks/bank-import/import-transactions.task.ts b/apps/api/src/tasks/bank-import/import-transactions.task.ts index 50d125e10..27a6bf805 100644 --- a/apps/api/src/tasks/bank-import/import-transactions.task.ts +++ b/apps/api/src/tasks/bank-import/import-transactions.task.ts @@ -54,6 +54,7 @@ export class IrisTasks { private daysToExpCondition = 5 // Used to check if the task should be stopped private canRun = true + private readonly AFFILIATE_CODE_PREFIX = 'af_' constructor( private readonly httpService: HttpService, @@ -325,7 +326,7 @@ export class IrisTasks { continue } - if (trx.remittanceInformationUnstructured.startsWith('af_')) { + if (trx.remittanceInformationUnstructured.startsWith(this.AFFILIATE_CODE_PREFIX)) { matchedRef = trx.remittanceInformationUnstructured } else { const ref = trx.remittanceInformationUnstructured @@ -379,7 +380,7 @@ export class IrisTasks { const affiliatePaymentRef: string[] = [] bankTransactions.forEach((trx) => { if (trx.matchedRef) { - trx.matchedRef.startsWith('af_') + trx.matchedRef.startsWith(this.AFFILIATE_CODE_PREFIX) ? affiliatePaymentRef.push(trx.matchedRef) : campaignPaymentRef.push(trx.matchedRef) } @@ -513,7 +514,7 @@ export class IrisTasks { this.prisma.bankTransaction.upsert({ where: { id: trx.id }, update: { - bankDonationStatus: trx.description.startsWith('af_') + bankDonationStatus: trx.description.startsWith(this.AFFILIATE_CODE_PREFIX) ? trx.bankDonationStatus : undefined, }, From d79c1dd5cdfa9fd5265c1d6642737ec4e383d714 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 26 Oct 2023 18:36:20 +0300 Subject: [PATCH 43/79] donation: Add metadata field to donation Model Similar to how metadata field works in Stripe, this field will include additional data, for the donation, such as the name of the person who donated through the affiliate API, and additional field to store necessary for the affiliate data. --- apps/api/src/affiliate/affiliate.service.ts | 1 + .../dto/create-affiliate-donation.dto.ts | 9 +++- .../bank-transactions.controller.ts | 2 - .../donation/entities/donation.entity.ts | 2 + .../dto/connect-donationMetadata.dto.ts | 3 ++ .../dto/create-donationMetadata.dto.ts | 6 +++ .../generated/donationMetadata/dto/index.ts | 3 ++ .../dto/update-donationMetadata.dto.ts | 6 +++ .../entities/donationMetadata.entity.ts | 10 ++++ .../donationMetadata/entities/index.ts | 1 + apps/api/src/donations/donations.service.ts | 18 +++++-- .../donations/dto/donation-metadata.dto.ts | 18 +++++++ .../donations/queries/donation.validator.ts | 7 +-- .../import-transactions.task.spec.ts | 1 - .../migration.sql | 15 ++++++ schema.prisma | 47 +++++++++++-------- 16 files changed, 119 insertions(+), 30 deletions(-) create mode 100644 apps/api/src/domain/generated/donationMetadata/dto/connect-donationMetadata.dto.ts create mode 100644 apps/api/src/domain/generated/donationMetadata/dto/create-donationMetadata.dto.ts create mode 100644 apps/api/src/domain/generated/donationMetadata/dto/index.ts create mode 100644 apps/api/src/domain/generated/donationMetadata/dto/update-donationMetadata.dto.ts create mode 100644 apps/api/src/domain/generated/donationMetadata/entities/donationMetadata.entity.ts create mode 100644 apps/api/src/domain/generated/donationMetadata/entities/index.ts create mode 100644 apps/api/src/donations/dto/donation-metadata.dto.ts create mode 100644 migrations/20231026144115_add_donation_metadata/migration.sql diff --git a/apps/api/src/affiliate/affiliate.service.ts b/apps/api/src/affiliate/affiliate.service.ts index bc02baca3..ec94682c8 100644 --- a/apps/api/src/affiliate/affiliate.service.ts +++ b/apps/api/src/affiliate/affiliate.service.ts @@ -36,6 +36,7 @@ export class AffiliateService { where: { status }, take: limit, skip: Number((currentPage - 1) * limit), + include: { metadata: true }, }, }, }) diff --git a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts index 6b5469d25..3890662c7 100644 --- a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts +++ b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts @@ -1,8 +1,9 @@ import { ApiProperty } from '@nestjs/swagger' import { Currency, DonationStatus, DonationType, PaymentProvider, Prisma } from '@prisma/client' -import { Expose } from 'class-transformer' +import { Expose, Type } from 'class-transformer' import { Equals, IsBoolean, IsEnum, IsNumber, IsOptional, IsString, IsUUID } from 'class-validator' import { randomUUID } from 'crypto' +import { DonationMetadataDto } from '../../donations/dto/donation-metadata.dto' export class CreateAffiliateDonation { @ApiProperty() @@ -65,6 +66,12 @@ export class CreateAffiliateDonation { @IsOptional() extCustomerId: string + @ApiProperty() + @Expose() + @Type(() => DonationMetadataDto) + @IsOptional() + metadata: DonationMetadataDto | undefined + public toEntity(targetVaultId: string): Prisma.DonationCreateInput { return { type: DonationType.donation, diff --git a/apps/api/src/bank-transactions/bank-transactions.controller.ts b/apps/api/src/bank-transactions/bank-transactions.controller.ts index 1143b55d6..24a12ca82 100644 --- a/apps/api/src/bank-transactions/bank-transactions.controller.ts +++ b/apps/api/src/bank-transactions/bank-transactions.controller.ts @@ -29,8 +29,6 @@ import { DateTime, Interval } from 'luxon' import { ConfigService } from '@nestjs/config' import { IrisBankTransactionSimulationDto } from './dto/bank-transactions-iris-simulate.dto' import { AffiliateService } from '../affiliate/affiliate.service' -import { IrisIbanAccountInfoDto } from './dto/iris-bank-account-info.dto' -import { IrisTransactionInfoDto } from './dto/iris-bank-transaction-info.dto' @ApiTags('bank-transaction') @Controller('bank-transaction') 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 33ef5929f..57fc0ce8b 100644 --- a/apps/api/src/domain/generated/donation/entities/donation.entity.ts +++ b/apps/api/src/domain/generated/donation/entities/donation.entity.ts @@ -3,6 +3,7 @@ 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 @@ -26,4 +27,5 @@ export class Donation { targetVault?: Vault affiliate?: Affiliate | null DonationWish?: DonationWish | null + metadata?: DonationMetadata | null } 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 new file mode 100644 index 000000000..9875d62d7 --- /dev/null +++ b/apps/api/src/domain/generated/donationMetadata/dto/connect-donationMetadata.dto.ts @@ -0,0 +1,3 @@ +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 new file mode 100644 index 000000000..fc3917bb7 --- /dev/null +++ b/apps/api/src/domain/generated/donationMetadata/dto/create-donationMetadata.dto.ts @@ -0,0 +1,6 @@ +import { Prisma } from '@prisma/client' + +export class CreateDonationMetadataDto { + 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 new file mode 100644 index 000000000..f313f5d13 --- /dev/null +++ b/apps/api/src/domain/generated/donationMetadata/dto/index.ts @@ -0,0 +1,3 @@ +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 new file mode 100644 index 000000000..e2382d4b5 --- /dev/null +++ b/apps/api/src/domain/generated/donationMetadata/dto/update-donationMetadata.dto.ts @@ -0,0 +1,6 @@ +import { Prisma } from '@prisma/client' + +export class UpdateDonationMetadataDto { + 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 new file mode 100644 index 000000000..59e23cdb4 --- /dev/null +++ b/apps/api/src/domain/generated/donationMetadata/entities/donationMetadata.entity.ts @@ -0,0 +1,10 @@ +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 +} diff --git a/apps/api/src/domain/generated/donationMetadata/entities/index.ts b/apps/api/src/domain/generated/donationMetadata/entities/index.ts new file mode 100644 index 000000000..c995d374a --- /dev/null +++ b/apps/api/src/domain/generated/donationMetadata/entities/index.ts @@ -0,0 +1 @@ +export * from './donationMetadata.entity' diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index 24e0df249..0e84303d8 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -307,6 +307,7 @@ export class DonationsService { person: { select: { firstName: true, lastName: true, company: { select: { companyName: true } } }, }, + metadata: { select: { name: true } }, }, skip: pageIndex && pageSize ? pageIndex * pageSize : undefined, take: pageSize ? pageSize : undefined, @@ -320,14 +321,23 @@ export class DonationsService { return result } - async createAffiliateDonation(donation: CreateAffiliateDonation) { - const vault = await this.vaultService.findByCampaignId(donation.campaignId) + async createAffiliateDonation(donationDto: CreateAffiliateDonation) { + const vault = await this.vaultService.findByCampaignId(donationDto.campaignId) if (!vault) throw new NotFoundException('Vault not found') - return await this.prisma.donation.create({ - data: donation.toEntity(vault[0].id), + const donation = await this.prisma.donation.create({ + data: donationDto.toEntity(vault[0].id), }) + if (donationDto.metadata) { + await this.prisma.donationMetadata.create({ + data: { + donationId: donation.id, + ...donationDto.metadata, + }, + }) + } + return donation } /** diff --git a/apps/api/src/donations/dto/donation-metadata.dto.ts b/apps/api/src/donations/dto/donation-metadata.dto.ts new file mode 100644 index 000000000..666d74c9f --- /dev/null +++ b/apps/api/src/donations/dto/donation-metadata.dto.ts @@ -0,0 +1,18 @@ +import { ApiProperty } from '@nestjs/swagger' +import { Expose } from 'class-transformer' +import { IsObject, IsOptional, IsString } from 'class-validator' + +export class DonationMetadataDto { + @ApiProperty() + @Expose() + @IsString() + @IsOptional() + name: string | undefined + + @ApiProperty() + @Expose() + @IsObject() + @IsOptional() + //eslint-disable-next-line + extraData: any +} diff --git a/apps/api/src/donations/queries/donation.validator.ts b/apps/api/src/donations/queries/donation.validator.ts index 3203aa37b..ac3f6b0be 100644 --- a/apps/api/src/donations/queries/donation.validator.ts +++ b/apps/api/src/donations/queries/donation.validator.ts @@ -14,11 +14,12 @@ export const donationWithPerson = Prisma.validator( name: true, campaign: { select: { - id: true - } - } + id: true, + }, + }, }, }, + metadata: true, }, }) diff --git a/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts b/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts index d6091a9d0..92ba78380 100644 --- a/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts +++ b/apps/api/src/tasks/bank-import/import-transactions.task.spec.ts @@ -15,7 +15,6 @@ import { VaultService } from '../../vault/vault.service' import { NotificationModule } from '../../sockets/notifications/notification.module' import { ExportService } from '../../export/export.service' import { - Affiliate, BankDonationStatus, BankTransaction, Campaign, diff --git a/migrations/20231026144115_add_donation_metadata/migration.sql b/migrations/20231026144115_add_donation_metadata/migration.sql new file mode 100644 index 000000000..a43ccc29f --- /dev/null +++ b/migrations/20231026144115_add_donation_metadata/migration.sql @@ -0,0 +1,15 @@ +-- CreateTable +CREATE TABLE "DonationMetadata" ( + "donation_id" UUID NOT NULL, + "name" VARCHAR, + "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "extra_data" JSONB, + + CONSTRAINT "DonationMetadata_pkey" PRIMARY KEY ("donation_id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "DonationMetadata_donation_id_key" ON "DonationMetadata"("donation_id"); + +-- AddForeignKey +ALTER TABLE "DonationMetadata" ADD CONSTRAINT "DonationMetadata_donation_id_fkey" FOREIGN KEY ("donation_id") REFERENCES "donations"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/schema.prisma b/schema.prisma index 0d13801f9..e94c0b37b 100644 --- a/schema.prisma +++ b/schema.prisma @@ -446,34 +446,43 @@ model Vault { } model Donation { - id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid + id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid type DonationType - status DonationStatus @default(initial) - provider PaymentProvider @default(none) + status DonationStatus @default(initial) + provider PaymentProvider @default(none) /// Vault where the funds are going - targetVaultId String @map("target_vault_id") @db.Uuid + targetVaultId String @map("target_vault_id") @db.Uuid /// Payment provider attributes - extCustomerId String @map("ext_customer_id") @db.VarChar(50) - extPaymentIntentId String @unique @map("ext_payment_intent_id") - extPaymentMethodId String @map("ext_payment_method_id") + extCustomerId String @map("ext_customer_id") @db.VarChar(50) + extPaymentIntentId String @unique @map("ext_payment_intent_id") + extPaymentMethodId String @map("ext_payment_method_id") /// - createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6) - updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) - amount Int @default(0) - currency Currency @default(BGN) - affiliateId String? @map("affiliate_id") @db.Uuid - personId String? @map("person_id") @db.Uuid - billingEmail String? @map("billing_email") @db.VarChar - billingName String? @map("billing_name") @db.VarChar - chargedAmount Int @default(0) - person Person? @relation(fields: [personId], references: [id]) - targetVault Vault @relation(fields: [targetVaultId], references: [id]) - affiliate Affiliate? @relation(fields: [affiliateId], references: [id]) + createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6) + updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) + amount Int @default(0) + currency Currency @default(BGN) + affiliateId String? @map("affiliate_id") @db.Uuid + personId String? @map("person_id") @db.Uuid + billingEmail String? @map("billing_email") @db.VarChar + billingName String? @map("billing_name") @db.VarChar + chargedAmount Int @default(0) + person Person? @relation(fields: [personId], references: [id]) + targetVault Vault @relation(fields: [targetVaultId], references: [id]) + affiliate Affiliate? @relation(fields: [affiliateId], references: [id]) DonationWish DonationWish? + metadata DonationMetadata? @@map("donations") } +model DonationMetadata { + donationId String @id @unique @map("donation_id") @db.Uuid + name String? @db.VarChar + createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6) + extraData Json? @map("extra_data") + donation Donation @relation(fields: [donationId], references: [id]) +} + model DonationWish { id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid message String From 00b31d185aabe717ef6a8f3bbddca77fef7d09fd Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Fri, 27 Oct 2023 10:50:59 +0300 Subject: [PATCH 44/79] schema.prisma: Map DonationMetadata model --- .../migration.sql | 27 +++++++++++++++++++ schema.prisma | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 migrations/20231027074921_map_donation_metadata/migration.sql diff --git a/migrations/20231027074921_map_donation_metadata/migration.sql b/migrations/20231027074921_map_donation_metadata/migration.sql new file mode 100644 index 000000000..e20fdc67a --- /dev/null +++ b/migrations/20231027074921_map_donation_metadata/migration.sql @@ -0,0 +1,27 @@ +/* + Warnings: + + - You are about to drop the `DonationMetadata` table. If the table is not empty, all the data it contains will be lost. + +*/ +-- DropForeignKey +ALTER TABLE "DonationMetadata" DROP CONSTRAINT "DonationMetadata_donation_id_fkey"; + +-- DropTable +DROP TABLE "DonationMetadata"; + +-- CreateTable +CREATE TABLE "donation_metadata" ( + "donation_id" UUID NOT NULL, + "name" VARCHAR, + "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "extra_data" JSONB, + + CONSTRAINT "donation_metadata_pkey" PRIMARY KEY ("donation_id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "donation_metadata_donation_id_key" ON "donation_metadata"("donation_id"); + +-- AddForeignKey +ALTER TABLE "donation_metadata" ADD CONSTRAINT "donation_metadata_donation_id_fkey" FOREIGN KEY ("donation_id") REFERENCES "donations"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/schema.prisma b/schema.prisma index e94c0b37b..30c18488e 100644 --- a/schema.prisma +++ b/schema.prisma @@ -481,6 +481,8 @@ model DonationMetadata { createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6) extraData Json? @map("extra_data") donation Donation @relation(fields: [donationId], references: [id]) + + @@map("donation_metadata") } model DonationWish { From 7055e1da13873789b50b29ac5fb29390f4ae44d6 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 30 Oct 2023 11:48:21 +0200 Subject: [PATCH 45/79] src/affiliate: Include metadata in affiliateDonationDto in jest --- apps/api/src/affiliate/affiliate.controller.spec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/api/src/affiliate/affiliate.controller.spec.ts b/apps/api/src/affiliate/affiliate.controller.spec.ts index b1c341b7b..434c11cd1 100644 --- a/apps/api/src/affiliate/affiliate.controller.spec.ts +++ b/apps/api/src/affiliate/affiliate.controller.spec.ts @@ -285,7 +285,7 @@ describe('AffiliateController', () => { amount: 5000, billingName: 'John doe', isAnonymous: true, - affiliateId: null, + affiliateId: '123', personId: null, extCustomerId: '', extPaymentIntentId: '123456', @@ -293,6 +293,10 @@ describe('AffiliateController', () => { billingEmail: 'test@podkrepi.bg', currency: 'BGN', toEntity: new CreateAffiliateDonation().toEntity, + metadata: { + name: '', + extraData: {}, + }, } jest.spyOn(service, 'findOneByCode').mockResolvedValue(activeAffiliateMock) const createAffiliateDonationSpy = jest From 52d67ee9e01b1e129a4d1592c8823ad446f257d4 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 30 Oct 2023 11:53:44 +0200 Subject: [PATCH 46/79] src/auth: Allow for corporate fields to be either string or undefined --- apps/api/src/auth/auth.service.ts | 7 +++++-- apps/api/src/auth/dto/register.dto.ts | 4 ++-- apps/api/src/company/company.service.ts | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index fdefb984e..ed17ade13 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -161,8 +161,8 @@ export class AuthService { password: '', firstName: userData?.firstName ?? '', lastName: userData?.lastName ?? '', - companyName: 'typechecking-hack', - companyNumber: 'typechecking-hack', + companyName: undefined, + companyNumber: undefined, } await this.createPerson(registerDto, user.sub, undefined) } @@ -297,6 +297,9 @@ export class AuthService { } private async createCompany(registerDto: RegisterDto): Promise { + if (!registerDto.companyName || !registerDto.companyNumber) { + throw new BadRequestException('Company name and companyNumber are missing') + } return await this.prismaService.company.create({ // Create a person with the provided keycloakId data: { diff --git a/apps/api/src/auth/dto/register.dto.ts b/apps/api/src/auth/dto/register.dto.ts index d654e1aaf..fee8399b9 100644 --- a/apps/api/src/auth/dto/register.dto.ts +++ b/apps/api/src/auth/dto/register.dto.ts @@ -57,7 +57,7 @@ export class RegisterDto { @IsString() @ApiProperty() @MaxLength(100) - companyName: string + companyName: string | undefined @ValidateIf((o) => o.type === ProfileType.CORPORATE) @Expose() @@ -66,5 +66,5 @@ export class RegisterDto { description: 'BULSTAT Unified Identification Code (UIC) https://psc.egov.bg/en/psc-starting-a-business-bulstat', }) - companyNumber: string + companyNumber: string | undefined } diff --git a/apps/api/src/company/company.service.ts b/apps/api/src/company/company.service.ts index 9e7828015..b35759756 100644 --- a/apps/api/src/company/company.service.ts +++ b/apps/api/src/company/company.service.ts @@ -1,4 +1,4 @@ -import { Injectable, Logger, NotFoundException } from '@nestjs/common' +import { BadRequestException, Injectable, Logger, NotFoundException } from '@nestjs/common' import { Prisma } from '@prisma/client' import { PrismaService } from '../prisma/prisma.service' @@ -42,7 +42,8 @@ export class CompanyService { return company } - async findOneByEIK(companyNumber: string) { + async findOneByEIK(companyNumber: string | undefined) { + if (!companyNumber) throw new BadRequestException('Company number not provided') return await this.prisma.company.findUnique({ where: { companyNumber } }) } From 734963f77635f3e81fee4f84bbd444689aa37e29 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 30 Oct 2023 12:04:14 +0200 Subject: [PATCH 47/79] src/affiliate: Improve semantics CreateAffiliateDonationDto: Removed validator decorators from affiliateId, personId, billingName and billigEmail, as those fields shouldn't be part of the request body itself. createAffiliateDonation(): Use chain conditioning to find whether affiliate exists or not. --- .../affiliate/affiliate.controller.spec.ts | 6 +++--- .../api/src/affiliate/affiliate.controller.ts | 10 ++++----- .../dto/create-affiliate-donation.dto.ts | 21 ++++--------------- apps/api/src/donations/donations.service.ts | 4 ++-- 4 files changed, 14 insertions(+), 27 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.spec.ts b/apps/api/src/affiliate/affiliate.controller.spec.ts index 434c11cd1..54e055a19 100644 --- a/apps/api/src/affiliate/affiliate.controller.spec.ts +++ b/apps/api/src/affiliate/affiliate.controller.spec.ts @@ -16,7 +16,7 @@ import { KeycloakTokenParsed } from '../auth/keycloak' import { BadRequestException, ConflictException, ForbiddenException } from '@nestjs/common' import { AffiliateStatusUpdateDto } from './dto/affiliate-status-update.dto' import * as afCodeGenerator from './utils/affiliateCodeGenerator' -import { CreateAffiliateDonation } from './dto/create-affiliate-donation.dto' +import { CreateAffiliateDonationDto } from './dto/create-affiliate-donation.dto' type PersonWithPayload = Prisma.PersonGetPayload<{ include: { company: true } }> type AffiliateWithPayload = Prisma.AffiliateGetPayload<{ @@ -280,7 +280,7 @@ describe('AffiliateController', () => { describe('Affiliate donations', () => { it('should create donation', async () => { - const affiliateDonationDto: CreateAffiliateDonation = { + const affiliateDonationDto: CreateAffiliateDonationDto = { campaignId: '12345', amount: 5000, billingName: 'John doe', @@ -292,7 +292,7 @@ describe('AffiliateController', () => { extPaymentMethodId: '1234', billingEmail: 'test@podkrepi.bg', currency: 'BGN', - toEntity: new CreateAffiliateDonation().toEntity, + toEntity: new CreateAffiliateDonationDto().toEntity, metadata: { name: '', extraData: {}, diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index 6c98ebb2e..e54bc7db6 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -19,7 +19,7 @@ import { KeycloakTokenParsed, isAdmin } from '../auth/keycloak' import { AuthenticatedUser, Public } from 'nest-keycloak-connect' import { AffiliateService } from './affiliate.service' import { AffiliateStatusUpdateDto } from './dto/affiliate-status-update.dto' -import { CreateAffiliateDonation } from './dto/create-affiliate-donation.dto' +import { CreateAffiliateDonationDto } from './dto/create-affiliate-donation.dto' import { DonationsService } from '../donations/donations.service' import { shouldAllowStatusChange } from '../donations/helpers/donation-status-updates' import { affiliateCodeGenerator } from './utils/affiliateCodeGenerator' @@ -80,15 +80,15 @@ export class AffiliateController { @Public() async createAffiliateDonation( @Param('affiliateCode') affiliateCode: string, - @Body() donation: CreateAffiliateDonation, + @Body() donation: CreateAffiliateDonationDto, ) { const affiliate = await this.affiliateService.findOneByCode(affiliateCode) - if (!affiliate || !affiliate.company || !affiliate.company.person) - throw new NotFoundException('Affiliate not found') - const affiliateDonationDto: CreateAffiliateDonation = { + if (!affiliate?.company?.person) throw new NotFoundException('Affiliate not found') + const affiliateDonationDto: CreateAffiliateDonationDto = { ...donation, affiliateId: affiliate.id, personId: donation.isAnonymous ? null : affiliate.company.person.id, + billingName: affiliate.company.person.firstName + ' ' + affiliate.company.person.lastName, billingEmail: affiliate.company.person.email, toEntity: donation.toEntity, } diff --git a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts index 3890662c7..1efc453a6 100644 --- a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts +++ b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts @@ -5,24 +5,16 @@ import { Equals, IsBoolean, IsEnum, IsNumber, IsOptional, IsString, IsUUID } fro import { randomUUID } from 'crypto' import { DonationMetadataDto } from '../../donations/dto/donation-metadata.dto' -export class CreateAffiliateDonation { +export class CreateAffiliateDonationDto { @ApiProperty() @Expose() @IsUUID() @IsString() campaignId: string - @ApiProperty() - @Expose() - @IsUUID() - @IsString() - @IsOptional() - affiliateId: string | null = null + affiliateId: string - @IsUUID() - @IsString() - @IsOptional() - personId: string | null = null + personId: string | null @IsString() extPaymentIntentId: string = 'pi_' + randomUUID() @@ -45,13 +37,8 @@ export class CreateAffiliateDonation { @IsNumber() amount: number - @ApiProperty() - @Expose() - @IsString() - billingName: string + billingName: string | null - @IsString() - @IsOptional() billingEmail: string | null @ApiProperty() diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index 0e84303d8..e61fd15b4 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -27,7 +27,7 @@ import { donationWithPerson, DonationWithPerson } from './queries/donation.valid import { CreateStripePaymentDto } from './dto/create-stripe-payment.dto' import { ImportStatus } from '../bank-transactions-file/dto/bank-transactions-import-status.dto' import { DonationQueryDto } from '../common/dto/donation-query-dto' -import { CreateAffiliateDonation } from '../affiliate/dto/create-affiliate-donation.dto' +import { CreateAffiliateDonationDto } from '../affiliate/dto/create-affiliate-donation.dto' @Injectable() export class DonationsService { @@ -321,7 +321,7 @@ export class DonationsService { return result } - async createAffiliateDonation(donationDto: CreateAffiliateDonation) { + async createAffiliateDonation(donationDto: CreateAffiliateDonationDto) { const vault = await this.vaultService.findByCampaignId(donationDto.campaignId) if (!vault) throw new NotFoundException('Vault not found') From 4daeba838affa69223cf2c06c8d46516ccc0ad90 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 30 Oct 2023 12:24:08 +0200 Subject: [PATCH 48/79] src/affiliate: Fix test --- apps/api/src/affiliate/affiliate.controller.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.spec.ts b/apps/api/src/affiliate/affiliate.controller.spec.ts index 54e055a19..9e2a73114 100644 --- a/apps/api/src/affiliate/affiliate.controller.spec.ts +++ b/apps/api/src/affiliate/affiliate.controller.spec.ts @@ -72,8 +72,8 @@ describe('AffiliateController', () => { const mockIndividualProfile: PersonWithPayload = { id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', - firstName: 'Admin', - lastName: 'Dev', + firstName: 'John', + lastName: 'Doe', companyId: null, keycloakId: '123', email: 'test@podkrepi.bg', @@ -137,7 +137,7 @@ describe('AffiliateController', () => { extPaymentIntentId: '123456', extPaymentMethodId: '1234', billingEmail: 'test@podkrepi.bg', - billingName: 'John doe', + billingName: 'John Doe', targetVaultId: vaultMock.id, chargedAmount: 0, currency: 'BGN', @@ -283,7 +283,7 @@ describe('AffiliateController', () => { const affiliateDonationDto: CreateAffiliateDonationDto = { campaignId: '12345', amount: 5000, - billingName: 'John doe', + billingName: 'John Doe', isAnonymous: true, affiliateId: '123', personId: null, From 50238df52342550ec6137598de90cd2628625e23 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 30 Oct 2023 18:33:36 +0200 Subject: [PATCH 49/79] src/affiliate: Include JWT_SECRET_KEY when generating affiliate code When generating affiliate code using only affiliateId, the affiliate code could easily be leaked, if some API response returns the affiliateId. This change ensures that this doesn't happen --- apps/api/src/affiliate/utils/affiliateCodeGenerator.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/api/src/affiliate/utils/affiliateCodeGenerator.ts b/apps/api/src/affiliate/utils/affiliateCodeGenerator.ts index a82d09e6a..2a1658163 100644 --- a/apps/api/src/affiliate/utils/affiliateCodeGenerator.ts +++ b/apps/api/src/affiliate/utils/affiliateCodeGenerator.ts @@ -1,6 +1,10 @@ import crypto from 'crypto' export function affiliateCodeGenerator(affiliateId: string) { - const uniqueHash = crypto.createHash('sha256').update(affiliateId).digest('hex').slice(0, 8) + const uniqueHash = crypto + .createHash('sha256') + .update(affiliateId + process.env.JWT_SECRET_KEY + new Date()) + .digest('hex') + .slice(0, 8) return 'af_' + uniqueHash } From 7ce893939a2f575a49b7941a782f1547657c681a Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 30 Oct 2023 18:52:34 +0200 Subject: [PATCH 50/79] src/affiliate: Create new endpoint to refresh affiliate code Would be useful in case of a leak --- apps/api/src/affiliate/affiliate.controller.ts | 18 ++++++++++++++---- apps/api/src/affiliate/affiliate.service.ts | 7 +++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index e54bc7db6..58070ab43 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -34,6 +34,12 @@ export class AffiliateController { private readonly donationService: DonationsService, ) {} + @Get(':affiliateCode') + @Public() + async affiliateSummary(@Param('affiliateCode') affilliateCode: string) { + return await this.affiliateService.getAffiliateSummaryByCode(affilliateCode) + } + @Post('join') async joinAffiliateProgramRequest(@AuthenticatedUser() user: KeycloakTokenParsed) { const person = await this.personService.findOneByKeycloakId(user.sub) @@ -70,10 +76,14 @@ export class AffiliateController { return await this.affiliateService.updateStatus(affiliateId, newStatus, affiliateCode) } - @Get(':affiliateCode') - @Public() - async affiliateSummary(@Param('affiliateCode') affilliateCode: string) { - return await this.affiliateService.getAffiliateSummaryByCode(affilliateCode) + @Patch(':affiliateId/code-refresh') + async refreshAffiliateCode( + @Param('affiliateId') affiliateId: string, + @AuthenticatedUser() user: KeycloakTokenParsed, + ) { + if (!isAdmin(user)) throw new ForbiddenException('Must be an admin') + const affiliateCode = affiliateCodeGenerator(affiliateId) + return await this.affiliateService.updateCode(affiliateId, affiliateCode) } @Post(':affiliateCode/donation') diff --git a/apps/api/src/affiliate/affiliate.service.ts b/apps/api/src/affiliate/affiliate.service.ts index ec94682c8..4a532d761 100644 --- a/apps/api/src/affiliate/affiliate.service.ts +++ b/apps/api/src/affiliate/affiliate.service.ts @@ -62,6 +62,13 @@ export class AffiliateService { }) } + async updateCode(affiliateId: string, affiliateCode: string) { + return await this.prismaService.affiliate.update({ + where: { id: affiliateId }, + data: { affiliateCode }, + }) + } + async updateStatus( affiliateId: string, status: AffiliateStatus, From a7d1df3de128ae4220555f4a985658e84a42b638 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 30 Oct 2023 18:54:00 +0200 Subject: [PATCH 51/79] src/donations: Fix error handling if no vault has been found vaultService.findByCampaignId returns an array, thus we need to also check if the length of that array is 0 --- apps/api/src/donations/donations.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index e61fd15b4..d79be8624 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -324,7 +324,7 @@ export class DonationsService { async createAffiliateDonation(donationDto: CreateAffiliateDonationDto) { const vault = await this.vaultService.findByCampaignId(donationDto.campaignId) - if (!vault) throw new NotFoundException('Vault not found') + if (!vault || vault.length === 0) throw new NotFoundException('Campaign or vault not found') const donation = await this.prisma.donation.create({ data: donationDto.toEntity(vault[0].id), From 12ceefeb2083202fd7d0ea117401b1299f97f6d4 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 30 Oct 2023 19:22:41 +0200 Subject: [PATCH 52/79] src/affiliate: Check whether campaign accepts more donations before making one --- apps/api/src/affiliate/affiliate.controller.spec.ts | 7 ++++++- apps/api/src/affiliate/affiliate.controller.ts | 7 +++++++ apps/api/src/affiliate/affiliate.module.ts | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.spec.ts b/apps/api/src/affiliate/affiliate.controller.spec.ts index 9e2a73114..c601d4255 100644 --- a/apps/api/src/affiliate/affiliate.controller.spec.ts +++ b/apps/api/src/affiliate/affiliate.controller.spec.ts @@ -11,7 +11,7 @@ import { VaultService } from '../vault/vault.service' import { NotificationModule } from '../sockets/notifications/notification.module' import { MarketingNotificationsModule } from '../notifications/notifications.module' import { ExportService } from '../export/export.service' -import { Affiliate, Donation, Prisma, Vault } from '@prisma/client' +import { Affiliate, Campaign, CampaignState, Donation, Prisma, Vault } from '@prisma/client' import { KeycloakTokenParsed } from '../auth/keycloak' import { BadRequestException, ConflictException, ForbiddenException } from '@nestjs/common' import { AffiliateStatusUpdateDto } from './dto/affiliate-status-update.dto' @@ -303,6 +303,11 @@ describe('AffiliateController', () => { .spyOn(donationService, 'createAffiliateDonation') .mockResolvedValue(donationResponseMock) jest.spyOn(prismaMock.vault, 'findMany').mockResolvedValue([vaultMock]) + prismaMock.campaign.findFirst.mockResolvedValue({ + id: '123', + allowDonationOnComplete: false, + state: CampaignState.active, + } as Campaign) await controller.createAffiliateDonation(affiliateCodeMock, affiliateDonationDto) expect(createAffiliateDonationSpy).toHaveBeenCalledWith({ ...affiliateDonationDto, diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index 58070ab43..b4004faf3 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -24,6 +24,7 @@ import { DonationsService } from '../donations/donations.service' import { shouldAllowStatusChange } from '../donations/helpers/donation-status-updates' import { affiliateCodeGenerator } from './utils/affiliateCodeGenerator' import { DonationStatus } from '@prisma/client' +import { CampaignService } from '../campaign/campaign.service' @Controller('affiliate') @ApiTags('affiliate') @@ -32,6 +33,7 @@ export class AffiliateController { private readonly personService: PersonService, private readonly affiliateService: AffiliateService, private readonly donationService: DonationsService, + private readonly campaignService: CampaignService, ) {} @Get(':affiliateCode') @@ -94,6 +96,11 @@ export class AffiliateController { ) { const affiliate = await this.affiliateService.findOneByCode(affiliateCode) if (!affiliate?.company?.person) throw new NotFoundException('Affiliate not found') + const campaign = await this.campaignService.getCampaignById(donation.campaignId) + const canAcceptDonation = await this.campaignService.canAcceptDonations(campaign) + if (!canAcceptDonation) { + throw new ConflictException('Campaign has been completed already') + } const affiliateDonationDto: CreateAffiliateDonationDto = { ...donation, affiliateId: affiliate.id, diff --git a/apps/api/src/affiliate/affiliate.module.ts b/apps/api/src/affiliate/affiliate.module.ts index 0e074e0e7..dd834f2ee 100644 --- a/apps/api/src/affiliate/affiliate.module.ts +++ b/apps/api/src/affiliate/affiliate.module.ts @@ -4,11 +4,12 @@ import { AffiliateService } from './affiliate.service' import { PersonModule } from '../person/person.module' import { PrismaService } from '../prisma/prisma.service' import { DonationsModule } from '../donations/donations.module' +import { CampaignModule } from '../campaign/campaign.module' @Module({ controllers: [AffiliateController], providers: [AffiliateService, PrismaService], - imports: [PersonModule, DonationsModule], + imports: [PersonModule, DonationsModule, CampaignModule], exports: [AffiliateService], }) export class AffiliateModule {} From 2aacb5d1d37239752ef642f9e3305e287f20af3a Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 31 Oct 2023 12:54:57 +0200 Subject: [PATCH 53/79] src/donations: Bring back count query to listPublic service endpoint The result of donation's query is paginated, thus its length doesnt represent the total amount of donations, and thus breaks the pagination on the front-end --- apps/api/src/donations/donations.service.ts | 56 ++++++++++++--------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index d79be8624..8c0ee9dff 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -288,34 +288,42 @@ export class DonationsService { pageIndex?: number, pageSize?: number, ): Promise> { - const data = await this.prisma.donation.findMany({ - where: { - OR: [{ status: status }, { status: DonationStatus.guaranteed }], - targetVault: { campaign: { id: campaignId } }, - }, - orderBy: [{ updatedAt: 'desc' }], - select: { - id: true, - type: true, - status: true, - provider: true, - createdAt: true, - updatedAt: true, - amount: true, - chargedAmount: true, - currency: true, - person: { - select: { firstName: true, lastName: true, company: { select: { companyName: true } } }, + const [data, count] = await this.prisma.$transaction([ + this.prisma.donation.findMany({ + where: { + OR: [{ status: status }, { status: DonationStatus.guaranteed }], + targetVault: { campaign: { id: campaignId } }, }, - metadata: { select: { name: true } }, - }, - skip: pageIndex && pageSize ? pageIndex * pageSize : undefined, - take: pageSize ? pageSize : undefined, - }) + orderBy: [{ updatedAt: 'desc' }], + select: { + id: true, + type: true, + status: true, + provider: true, + createdAt: true, + updatedAt: true, + amount: true, + chargedAmount: true, + currency: true, + person: { + select: { firstName: true, lastName: true, company: { select: { companyName: true } } }, + }, + metadata: { select: { name: true } }, + }, + skip: pageIndex && pageSize ? pageIndex * pageSize : undefined, + take: pageSize ? pageSize : undefined, + }), + this.prisma.donation.count({ + where: { + OR: [{ status: status }, { status: DonationStatus.guaranteed }], + targetVault: { campaign: { id: campaignId } }, + }, + }), + ]) const result = { items: data, - total: data.length, + total: count, } return result From a5e4e0becb842ffc26fabc4e8fb50540819375e1 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 31 Oct 2023 16:52:47 +0200 Subject: [PATCH 54/79] src/donations: Handle corporate donations --- .../dto/create-affiliate-donation.dto.ts | 5 ++++- apps/api/src/campaign/campaign.service.ts | 19 +---------------- apps/api/src/donations/donations.service.ts | 2 ++ .../donations/dontation-metadata.interface.ts | 2 ++ .../src/donations/dto/create-session.dto.ts | 7 +++++++ .../events/stripe-payment.service.spec.ts | 2 +- .../events/stripe-payment.service.ts | 2 +- .../helpers/payment-intent-helpers.ts | 15 ++++++++++++- apps/api/src/paypal/paypal.service.ts | 7 ++++++- .../migration.sql | 2 ++ podkrepi.dbml | 21 ++++++++++++++++--- schema.prisma | 1 + 12 files changed, 59 insertions(+), 26 deletions(-) create mode 100644 migrations/20231031091416_add_corporate_to_donation_type/migration.sql diff --git a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts index 1efc453a6..f6539d0d2 100644 --- a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts +++ b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts @@ -12,6 +12,9 @@ export class CreateAffiliateDonationDto { @IsString() campaignId: string + @IsEnum(DonationType) + type: DonationType = DonationType.corporate + affiliateId: string personId: string | null @@ -61,7 +64,7 @@ export class CreateAffiliateDonationDto { public toEntity(targetVaultId: string): Prisma.DonationCreateInput { return { - type: DonationType.donation, + type: DonationType.corporate, status: DonationStatus.guaranteed, provider: PaymentProvider.bank, currency: this.currency, diff --git a/apps/api/src/campaign/campaign.service.ts b/apps/api/src/campaign/campaign.service.ts index ad35f25f3..a51a49014 100644 --- a/apps/api/src/campaign/campaign.service.ts +++ b/apps/api/src/campaign/campaign.service.ts @@ -565,7 +565,6 @@ export class CampaignService { campaign: Campaign, paymentData: PaymentData, newDonationStatus: DonationStatus, - metadata?: DonationMetadata, ): Promise { const campaignId = campaign.id Logger.debug('Update donation to status: ' + newDonationStatus, { @@ -602,22 +601,6 @@ export class CampaignService { donationId = updatedDonation?.id } - //For successful donations we will also need to link them to user if not marked as anonymous - if (donationId && newDonationStatus === DonationStatus.succeeded) { - if (metadata?.isAnonymous !== 'true') { - await tx.donation.update({ - where: { id: donationId }, - data: { - person: { - connect: { - email: paymentData.billingEmail, - }, - }, - }, - }) - } - } - return donationId }) //end of the transaction scope } @@ -710,7 +693,7 @@ export class CampaignService { currency: campaign.currency, targetVault: targetVaultData, provider: paymentData.paymentProvider, - type: DonationType.donation, + type: paymentData.type as DonationType, status: newDonationStatus, extCustomerId: paymentData.stripeCustomerId ?? '', extPaymentIntentId: paymentData.paymentIntentId, diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index 8c0ee9dff..d26f6d931 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -180,11 +180,13 @@ export class DonationsService { const campaign = await this.campaignService.validateCampaignId(sessionDto.campaignId) const { mode } = sessionDto const appUrl = this.config.get('APP_URL') + const metadata: DonationMetadata = { campaignId: sessionDto.campaignId, personId: sessionDto.personId, isAnonymous: sessionDto.isAnonymous ? 'true' : 'false', wish: sessionDto.message ?? null, + type: sessionDto.type, } const items = await this.prepareSessionItems(sessionDto, campaign) diff --git a/apps/api/src/donations/dontation-metadata.interface.ts b/apps/api/src/donations/dontation-metadata.interface.ts index feb79827c..c979a561f 100644 --- a/apps/api/src/donations/dontation-metadata.interface.ts +++ b/apps/api/src/donations/dontation-metadata.interface.ts @@ -1,6 +1,8 @@ +import { DonationType } from '@prisma/client' import Stripe from 'stripe' export interface DonationMetadata extends Stripe.MetadataParam { + type: DonationType | null campaignId: string | null personId: string | null isAnonymous: string | null diff --git a/apps/api/src/donations/dto/create-session.dto.ts b/apps/api/src/donations/dto/create-session.dto.ts index b780bcc21..ccd281de5 100644 --- a/apps/api/src/donations/dto/create-session.dto.ts +++ b/apps/api/src/donations/dto/create-session.dto.ts @@ -4,6 +4,7 @@ import { ApiProperty } from '@nestjs/swagger' import { IsBoolean, IsEmail, + IsEnum, IsIn, IsNotEmpty, IsNumber, @@ -15,6 +16,7 @@ import { Min, ValidateIf, } from 'class-validator' +import { DonationType } from '@prisma/client' export class CreateSessionDto { @ApiProperty() @@ -23,6 +25,11 @@ export class CreateSessionDto { @IsIn(['payment', 'setup', 'subscription']) public readonly mode: Stripe.Checkout.Session.Mode + @ApiProperty() + @Expose() + @IsEnum(DonationType) + public readonly type: DonationType + @ApiProperty() @Expose() @IsNumber() diff --git a/apps/api/src/donations/events/stripe-payment.service.spec.ts b/apps/api/src/donations/events/stripe-payment.service.spec.ts index ab3a7569a..77cd15780 100644 --- a/apps/api/src/donations/events/stripe-payment.service.spec.ts +++ b/apps/api/src/donations/events/stripe-payment.service.spec.ts @@ -323,7 +323,7 @@ describe('StripePaymentService', () => { expect(prismaMock.donation.findUnique).toHaveBeenCalled() expect(prismaMock.donation.create).not.toHaveBeenCalled() expect(mockedIncrementVaultAmount).toHaveBeenCalled() - expect(prismaMock.donation.update).toHaveBeenCalledTimes(2) //once for the amount and second time for assigning donation to the person + expect(prismaMock.donation.update).toHaveBeenCalledTimes(1) expect(mockedUpdateCampaignStatusIfTargetReached).toHaveBeenCalled() expect(prismaMock.campaign.update).toHaveBeenCalledWith({ where: { diff --git a/apps/api/src/donations/events/stripe-payment.service.ts b/apps/api/src/donations/events/stripe-payment.service.ts index 77c8b27ab..1e752ceb3 100644 --- a/apps/api/src/donations/events/stripe-payment.service.ts +++ b/apps/api/src/donations/events/stripe-payment.service.ts @@ -135,7 +135,6 @@ export class StripePaymentService { campaign, billingData, DonationStatus.succeeded, - metadata, ) //updateDonationPayment will mark the campaign as completed if amount is reached @@ -289,6 +288,7 @@ export class StripePaymentService { Logger.log('[ handleInvoicePaid ]', invoice) let metadata: DonationMetadata = { + type: null, campaignId: null, personId: null, isAnonymous: null, diff --git a/apps/api/src/donations/helpers/payment-intent-helpers.ts b/apps/api/src/donations/helpers/payment-intent-helpers.ts index ae4518d0a..b71a370a5 100644 --- a/apps/api/src/donations/helpers/payment-intent-helpers.ts +++ b/apps/api/src/donations/helpers/payment-intent-helpers.ts @@ -1,4 +1,4 @@ -import { PaymentProvider } from '@prisma/client' +import { DonationType, PaymentProvider } from '@prisma/client' import Stripe from 'stripe' import { getCountryRegion, stripeFeeCalculator } from './stripe-fee-calculator' import { RecurringDonationStatus, Currency } from '@prisma/client' @@ -28,12 +28,15 @@ export type PaymentData = { stripeCustomerId?: string paymentProvider: PaymentProvider personId?: string + type: string } export function getPaymentData( paymentIntent: Stripe.PaymentIntent, charge?: Stripe.Charge, ): PaymentData { + const isAnonymous = paymentIntent.metadata.isAnonymous === 'true' + return { paymentProvider: PaymentProvider.stripe, paymentIntentId: paymentIntent.id, @@ -53,10 +56,13 @@ export function getPaymentData( billingEmail: charge?.billing_details?.email ?? paymentIntent.receipt_email ?? undefined, paymentMethodId: getPaymentMethodId(paymentIntent), stripeCustomerId: getPaymentCustomerId(paymentIntent), + type: paymentIntent.metadata.type, + personId: !isAnonymous ? paymentIntent.metadata.personId : undefined, } } export function getPaymentDataFromCharge(charge: Stripe.Charge): PaymentData { + const isAnonymous = charge.metadata.isAnonymous === 'true' return { paymentProvider: PaymentProvider.stripe, paymentIntentId: charge.payment_intent as string, @@ -74,6 +80,8 @@ export function getPaymentDataFromCharge(charge: Stripe.Charge): PaymentData { billingEmail: charge?.billing_details?.email ?? charge.receipt_email ?? undefined, paymentMethodId: 'card', stripeCustomerId: charge.billing_details?.email ?? undefined, + type: charge.metadata.type, + personId: !isAnonymous ? charge.metadata.personId : undefined, } } @@ -82,10 +90,14 @@ export function getInvoiceData(invoice: Stripe.Invoice): PaymentData { const country = invoice.account_country as string let personId = '' + let type = '' lines.map((line) => { if (line.metadata.personId) { personId = line.metadata.personId } + if (line.metadata.type) { + type = line.metadata.type + } }) return { @@ -106,6 +118,7 @@ export function getInvoiceData(invoice: Stripe.Invoice): PaymentData { paymentMethodId: invoice.collection_method, stripeCustomerId: invoice.customer as string, personId, + type, } } diff --git a/apps/api/src/paypal/paypal.service.ts b/apps/api/src/paypal/paypal.service.ts index 4b087b990..3eb13182a 100644 --- a/apps/api/src/paypal/paypal.service.ts +++ b/apps/api/src/paypal/paypal.service.ts @@ -2,7 +2,7 @@ import { Injectable, Logger } from '@nestjs/common' import { ConfigService } from '@nestjs/config' import { CampaignService } from '../campaign/campaign.service' import { HttpService } from '@nestjs/axios' -import { DonationStatus, PaymentProvider } from '@prisma/client' +import { DonationStatus, DonationType, PaymentProvider } from '@prisma/client' @Injectable() export class PaypalService { @@ -165,6 +165,8 @@ export class PaypalService { parsePaypalPaymentOrder(paypalOrder): PaymentData { //note we store the money in db as cents so we multiply incoming amounts by 100 return { + //TODO: Find a way to attach type to metadata + type: DonationType.donation, paymentProvider: PaymentProvider.paypal, campaignId: paypalOrder.resource.purchase_units[0].custom_id, paymentIntentId: paypalOrder.resource.purchase_units[0].payments.captures[0].id, @@ -194,6 +196,8 @@ export class PaypalService { return { paymentProvider: PaymentProvider.paypal, campaignId: paypalCapture.resource.custom_id, + //TODO: Find a way to attach type to metadata + type: DonationType.donation, paymentIntentId: paypalCapture.resource.id, netAmount: 100 * Number(paypalCapture.resource.seller_receivable_breakdown.net_amount.value), chargedAmount: @@ -214,4 +218,5 @@ type PaymentData = { billingEmail?: string paymentMethodId?: string stripeCustomerId?: string + type: DonationType } diff --git a/migrations/20231031091416_add_corporate_to_donation_type/migration.sql b/migrations/20231031091416_add_corporate_to_donation_type/migration.sql new file mode 100644 index 000000000..52769b15a --- /dev/null +++ b/migrations/20231031091416_add_corporate_to_donation_type/migration.sql @@ -0,0 +1,2 @@ +-- AlterEnum +ALTER TYPE "donation_type" ADD VALUE 'corporate'; diff --git a/podkrepi.dbml b/podkrepi.dbml index 1f78741f9..71829bf6e 100644 --- a/podkrepi.dbml +++ b/podkrepi.dbml @@ -21,6 +21,7 @@ Table people { emailConfirmed Boolean [default: false] personalNumber String [unique, note: 'Uniform Civil Number (NCN, EGN) https://en.wikipedia.org/wiki/National_identification_number#Bulgaria'] + companyId String [unique] keycloakId String [unique] stripeCustomerId String [unique] picture String @@ -70,8 +71,8 @@ Table affiliates { id String [pk] status AffiliateStatus [not null, default: 'pending'] affiliateCode String [unique] - companyId String [unique] - company companies + companyId String [unique, not null] + company companies [not null] donations donations [not null] } @@ -387,6 +388,15 @@ Table donations { targetVault vaults [not null] affiliate affiliates DonationWish donation_wishes + metadata donation_metadata +} + +Table donation_metadata { + donationId String [pk] + name String + createdAt DateTime [default: `now()`, not null] + extraData Json + donation donations [not null] } Table donation_wishes { @@ -644,6 +654,7 @@ Enum DocumentType { Enum DonationType { donation + corporate } Enum DonationStatus { @@ -653,6 +664,7 @@ Enum DonationStatus { declined waiting cancelled + guaranteed succeeded deleted refund @@ -708,6 +720,7 @@ Enum BankTransactionType { Enum BankDonationStatus { unrecognized imported + incomplete reImported importFailed } @@ -785,7 +798,7 @@ Enum EmailType { raised100 } -Ref: companies.personId - people.id +Ref: people.companyId - companies.id Ref: affiliates.companyId - companies.id @@ -857,6 +870,8 @@ Ref: donations.targetVaultId > vaults.id Ref: donations.affiliateId > affiliates.id +Ref: donation_metadata.donationId - donations.id + Ref: donation_wishes.campaignId > campaigns.id Ref: donation_wishes.personId > people.id diff --git a/schema.prisma b/schema.prisma index 30c18488e..26b0fc5a0 100644 --- a/schema.prisma +++ b/schema.prisma @@ -793,6 +793,7 @@ enum DocumentType { enum DonationType { donation + corporate @@map("donation_type") } From ca2510445315b4612f23aafb87c6b49f0c280733 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Wed, 1 Nov 2023 12:49:52 +0200 Subject: [PATCH 55/79] src/donations: Don't update updatedAt property on imported donation When we show the donations on frontend they are ordered by the updatedAt property in descending order, thus when bank transaction is imported, those affiliate donations will be shown again on top of the list, which might cause confusion --- apps/api/src/donations/donations.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index d26f6d931..90738b9e9 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -587,7 +587,7 @@ export class DonationsService { this.vaultService.incrementVaultAmount(donationDto.targetVaultId, donationDto.amount, tx), tx.donation.update({ where: { id: donationDto.id }, - data: { status: DonationStatus.succeeded }, + data: { status: DonationStatus.succeeded, updatedAt: undefined }, }), ]) }) From 3acf963d721270c66dbc4c26437fb356fc75f155 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Wed, 1 Nov 2023 14:27:49 +0200 Subject: [PATCH 56/79] src/donation-wish: Extend selector to include companyName and donation type --- .../src/donation-wish/donation-wish.service.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/api/src/donation-wish/donation-wish.service.ts b/apps/api/src/donation-wish/donation-wish.service.ts index ab0c357fb..f9eb148ff 100644 --- a/apps/api/src/donation-wish/donation-wish.service.ts +++ b/apps/api/src/donation-wish/donation-wish.service.ts @@ -65,8 +65,22 @@ export class DonationWishService { : { createdAt: 'desc' }, ], include: { - person: { select: { id: true, firstName: true, lastName: true } }, - donation: { select: { amount: true, currency: true } }, + person: { + select: { + id: true, + firstName: true, + lastName: true, + company: { select: { companyName: true } }, + }, + }, + donation: { + select: { + amount: true, + currency: true, + type: true, + metadata: { select: { name: true } }, + }, + }, }, }) From d5754e803cd967ce43db44f52bd8252168a7e1e7 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Wed, 1 Nov 2023 14:44:00 +0200 Subject: [PATCH 57/79] src/affiliate: Include donation wish in query --- .../src/affiliate/dto/create-affiliate-donation.dto.ts | 6 ++++++ apps/api/src/donations/donations.service.ts | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts index f6539d0d2..eb4e3ed71 100644 --- a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts +++ b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts @@ -56,6 +56,12 @@ export class CreateAffiliateDonationDto { @IsOptional() extCustomerId: string + @ApiProperty() + @Expose() + @IsString() + @IsOptional() + message?: string + @ApiProperty() @Expose() @Type(() => DonationMetadataDto) diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index 90738b9e9..9b36fb3a5 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -347,6 +347,16 @@ export class DonationsService { }, }) } + if (donationDto.message) { + await this.prisma.donationWish.create({ + data: { + campaignId: donationDto.campaignId, + message: donationDto.message, + donationId: donation.id, + personId: donationDto.personId, + }, + }) + } return donation } From 87df4e2d5234232ec074e4691960e0e5d490593b Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Wed, 1 Nov 2023 15:39:24 +0200 Subject: [PATCH 58/79] updateAffiliateBankPayment: Use value of donation's updatedAt field When passing undefined to the query, prisma still updates the updatedAt field, as it uses default property --- apps/api/src/donations/donations.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index 9b36fb3a5..716eabf41 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -597,7 +597,7 @@ export class DonationsService { this.vaultService.incrementVaultAmount(donationDto.targetVaultId, donationDto.amount, tx), tx.donation.update({ where: { id: donationDto.id }, - data: { status: DonationStatus.succeeded, updatedAt: undefined }, + data: { status: DonationStatus.succeeded, updatedAt: donationDto.updatedAt }, }), ]) }) From aea9be98583fbde796cf5a312dfb3cdb73c77ebf Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 2 Nov 2023 15:35:25 +0200 Subject: [PATCH 59/79] getUserDonationById: Include companyName inside the query Needed in order to show the corporation's name inside the certificate --- apps/api/src/donations/donations.service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index 716eabf41..9bd9b17c2 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -491,8 +491,12 @@ export class DonationsService { id: true, firstName: true, lastName: true, + company: { select: { companyName: true } }, }, }, + affiliate: { + select: { company: { select: { companyName: true } } }, + }, targetVault: { select: { id: true, From 82eb4a4b750413bb277bb3a12ca1259136c32aef Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 2 Nov 2023 15:52:51 +0200 Subject: [PATCH 60/79] userDonationById(): Get first and last name from keycloak token Needed in order to show the name of the donor on the certificate, if the donation is anonymous --- apps/api/src/donations/donations.controller.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/api/src/donations/donations.controller.ts b/apps/api/src/donations/donations.controller.ts index d79272110..0298acfc9 100644 --- a/apps/api/src/donations/donations.controller.ts +++ b/apps/api/src/donations/donations.controller.ts @@ -175,7 +175,14 @@ export class DonationsController { @Get('user/:id') async userDonationById(@Param('id') id: string, @AuthenticatedUser() user: KeycloakTokenParsed) { - return await this.donationsService.getUserDonationById(id, user.sub, user.email) + const donation = await this.donationsService.getUserDonationById(id, user.sub, user.email) + return { + ...donation, + person: { + firstName: user.given_name, + lastName: user.family_name, + }, + } } @Post('payment-intent') From c143e6b226308e788f8e40f71b577c601bdbf29a Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Sat, 4 Nov 2023 17:37:29 +0200 Subject: [PATCH 61/79] src/affiliate: Add new endpoint to get affiliate's data by userid --- apps/api/src/affiliate/affiliate.controller.ts | 16 ++++++++++++++-- apps/api/src/affiliate/affiliate.service.ts | 18 +++++++++++++++++- .../bank-transactions.controller.ts | 2 +- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index b4004faf3..8128c3617 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -36,10 +36,18 @@ export class AffiliateController { private readonly campaignService: CampaignService, ) {} + @Get('data') + async findAffiliateByUserId(@AuthenticatedUser() user: KeycloakTokenParsed) { + const affiliate = await this.affiliateService.getAffiliateDataByKeycloakId(user.sub) + return affiliate + } + @Get(':affiliateCode') @Public() async affiliateSummary(@Param('affiliateCode') affilliateCode: string) { - return await this.affiliateService.getAffiliateSummaryByCode(affilliateCode) + const affiliate = await this.affiliateService.getAffiliateSummaryByCode(affilliateCode) + if (!affiliate) throw new NotFoundException('Affiliate not found') + return affiliate } @Post('join') @@ -135,8 +143,12 @@ export class AffiliateController { @Param('affiliateCode') affiliateCode: string, @Param('donationId') donationId: string, ) { + console.log(`called`) const donation = await this.donationService.getAffiliateDonationById(donationId, affiliateCode) - if (!donation) throw new NotFoundException('Donation with this id is not found') + if (!donation) { + console.log(`this is not found`) + throw new NotFoundException('Donation with this id is not found') + } if (!shouldAllowStatusChange(donation.status, 'cancelled')) throw new BadRequestException("Donation status can't be updated") diff --git a/apps/api/src/affiliate/affiliate.service.ts b/apps/api/src/affiliate/affiliate.service.ts index 4a532d761..3bc1bda32 100644 --- a/apps/api/src/affiliate/affiliate.service.ts +++ b/apps/api/src/affiliate/affiliate.service.ts @@ -16,9 +16,25 @@ export class AffiliateService { return await this.prismaService.affiliate.findUnique({ where: { id } }) } - async findAffiliateByKecloakId(keycloakId: string) { + async findAffiliateByKeycloakId(keycloakId: string) { + return await this.prismaService.affiliate.count({ + where: { company: { person: { keycloakId } } }, + }) + } + + async getAffiliateDataByKeycloakId(keycloakId: string) { return await this.prismaService.affiliate.findFirst({ where: { company: { person: { keycloakId } } }, + include: { + donations: { + where: { status: DonationStatus.guaranteed }, + include: { + targetVault: { select: { campaign: { select: { title: true, slug: true } } } }, + affiliate: { select: { company: { select: { companyName: true } } } }, + metadata: { select: { name: true } }, + }, + }, + }, }) } diff --git a/apps/api/src/bank-transactions/bank-transactions.controller.ts b/apps/api/src/bank-transactions/bank-transactions.controller.ts index 24a12ca82..75e5dfc4c 100644 --- a/apps/api/src/bank-transactions/bank-transactions.controller.ts +++ b/apps/api/src/bank-transactions/bank-transactions.controller.ts @@ -169,7 +169,7 @@ export class BankTransactionsController { const isDev = appEnv === 'development' || appEnv === 'staging' if (!isDev) throw new ForbiddenException('Endpoint available only for testing enviroments') - const affiliate = await this.affiliateService.findAffiliateByKecloakId(user.sub) + const affiliate = await this.affiliateService.findAffiliateByKeycloakId(user.sub) if (!isAdmin(user) && !affiliate) throw new ForbiddenException('Must be either an admin or active affiliate') From 4929a4f5130bf128b0085c938b3a41c1f031b344 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Sat, 4 Nov 2023 19:07:33 +0200 Subject: [PATCH 62/79] src/affiliate: cleanup console.log --- apps/api/src/affiliate/affiliate.controller.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index 8128c3617..db488b06e 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -143,10 +143,8 @@ export class AffiliateController { @Param('affiliateCode') affiliateCode: string, @Param('donationId') donationId: string, ) { - console.log(`called`) const donation = await this.donationService.getAffiliateDonationById(donationId, affiliateCode) if (!donation) { - console.log(`this is not found`) throw new NotFoundException('Donation with this id is not found') } From ec254642627b322f492513ed9d76cf9c313ae08a Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 6 Nov 2023 15:16:59 +0200 Subject: [PATCH 63/79] schema.prisma: Add profileEnabled to person table Makes it easier to track whether a corporate profile is enabled or not --- apps/api/src/auth/auth.service.ts | 1 + apps/api/src/domain/generated/person/entities/person.entity.ts | 1 + .../20231106124859_add_profile_enabled_to_person/migration.sql | 2 ++ podkrepi.dbml | 1 + schema.prisma | 1 + 5 files changed, 6 insertions(+) create mode 100644 migrations/20231106124859_add_profile_enabled_to_person/migration.sql diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index ed17ade13..5e92cfb65 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -289,6 +289,7 @@ export class AuthService { lastName: registerDto.lastName, newsletter: registerDto.newsletter ? registerDto.newsletter : false, companyId: companyId, + profileEnabled: companyId ? false : true, }, // Store keycloakId to the person with same email update: { keycloakId }, 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 52898b636..fa0e3872a 100644 --- a/apps/api/src/domain/generated/person/entities/person.entity.ts +++ b/apps/api/src/domain/generated/person/entities/person.entity.ts @@ -37,6 +37,7 @@ export class Person { keycloakId: string | null stripeCustomerId: string | null picture: string | null + profileEnabled: boolean benefactors?: Benefactor[] beneficiaries?: Beneficiary[] campaignFiles?: CampaignFile[] diff --git a/migrations/20231106124859_add_profile_enabled_to_person/migration.sql b/migrations/20231106124859_add_profile_enabled_to_person/migration.sql new file mode 100644 index 000000000..a067c4e67 --- /dev/null +++ b/migrations/20231106124859_add_profile_enabled_to_person/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "people" ADD COLUMN "profile_enabled" BOOLEAN NOT NULL DEFAULT true; diff --git a/podkrepi.dbml b/podkrepi.dbml index 71829bf6e..93b75533c 100644 --- a/podkrepi.dbml +++ b/podkrepi.dbml @@ -25,6 +25,7 @@ https://en.wikipedia.org/wiki/National_identification_number#Bulgaria'] keycloakId String [unique] stripeCustomerId String [unique] picture String + profileEnabled Boolean [not null, default: true] benefactors benefactors [not null] beneficiaries beneficiaries [not null] campaignFiles campaign_files [not null] diff --git a/schema.prisma b/schema.prisma index 26b0fc5a0..f77da0948 100644 --- a/schema.prisma +++ b/schema.prisma @@ -50,6 +50,7 @@ model Person { keycloakId String? @unique @map("keycloak_id") @db.Uuid stripeCustomerId String? @unique @map("stripe_customer_id") picture String? @db.VarChar(250) + profileEnabled Boolean @default(true) @map("profile_enabled") // Used to verify some emails sent to the user benefactors Benefactor[] beneficiaries Beneficiary[] From e112223b33b70b9a3fc77a8ffbd590dd481fc47d Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 6 Nov 2023 16:26:18 +0200 Subject: [PATCH 64/79] src/account: Make endpoint for manual activation/deactivation of profile --- apps/api/src/account/account.controller.ts | 17 ++++++++++++++++- apps/api/src/account/account.service.ts | 6 +++++- apps/api/src/auth/auth.service.ts | 10 +++++++--- apps/api/src/person/dto/update-person.dto.ts | 6 ++++++ 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/apps/api/src/account/account.controller.ts b/apps/api/src/account/account.controller.ts index ce49b7317..dc21746cc 100644 --- a/apps/api/src/account/account.controller.ts +++ b/apps/api/src/account/account.controller.ts @@ -1,5 +1,5 @@ import CredentialRepresentation from '@keycloak/keycloak-admin-client/lib/defs/credentialRepresentation' -import { Body, Controller, Get, Put, Logger, Delete } from '@nestjs/common' +import { Body, Controller, Get, Put, Logger, Delete, Patch, Param, Query } from '@nestjs/common' import { RealmViewSupporters, ViewSupporters } from '@podkrepi-bg/podkrepi-types' import { AuthenticatedUser, Public, RoleMatchingMode, Roles } from 'nest-keycloak-connect' @@ -114,4 +114,19 @@ export class AccountController { adminRole() { return { status: 'OK' } } + + @Patch(':keycloakId/status') + @Roles({ + roles: [RealmViewSupporters.role, ViewSupporters.role], + mode: RoleMatchingMode.ANY, + }) + async changeProfileStatus( + @Param('keycloakId') keycloakId: string, + @Body() data: UpdatePersonDto, + ) { + return await this.accountService.changeProfileActivationStatus( + keycloakId, + !!data.profileEnabled, + ) + } } diff --git a/apps/api/src/account/account.service.ts b/apps/api/src/account/account.service.ts index 8cfb36e70..10f70d43a 100644 --- a/apps/api/src/account/account.service.ts +++ b/apps/api/src/account/account.service.ts @@ -25,6 +25,10 @@ export class AccountService { } async disableUser(user: KeycloakTokenParsed) { - return await this.authService.disableUser(user.sub) + return await this.authService.changeEnabledStatus(user.sub, false) + } + + 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 5e92cfb65..c7d76b743 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -350,14 +350,18 @@ export class AuthService { return true } - async disableUser(keycloakId: string) { + async changeEnabledStatus(keycloakId: string, enabled: boolean) { await this.authenticateAdmin() - return await this.admin.users.update( + await this.admin.users.update( { id: keycloakId }, { - enabled: false, + enabled, }, ) + return await this.prismaService.person.update({ + where: { keycloakId }, + data: { profileEnabled: enabled }, + }) } async sendMailForPasswordChange(forgotPasswordDto: ForgottenPasswordEmailDto) { diff --git a/apps/api/src/person/dto/update-person.dto.ts b/apps/api/src/person/dto/update-person.dto.ts index c679771bc..8ce34cc80 100644 --- a/apps/api/src/person/dto/update-person.dto.ts +++ b/apps/api/src/person/dto/update-person.dto.ts @@ -51,4 +51,10 @@ export class UpdatePersonDto { @IsOptional() @IsString() personalNumber?: string + + @ApiProperty() + @Expose() + @IsOptional() + @IsBoolean() + profileEnabled?: boolean } From 7cd1a24a9a0d87f9132293336c16c17238795148 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 6 Nov 2023 16:27:00 +0200 Subject: [PATCH 65/79] src/person: Fix ordering by profile type not working --- apps/api/src/person/person.service.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/api/src/person/person.service.ts b/apps/api/src/person/person.service.ts index 1e99e7e20..da9f18fdb 100644 --- a/apps/api/src/person/person.service.ts +++ b/apps/api/src/person/person.service.ts @@ -62,6 +62,9 @@ export class PersonService { case 'beneficiaries': sort = { beneficiaries: { _count: sortOrder == 'asc' ? 'desc' : 'asc' } } break + case 'type': + sort = { company: { createdAt: sortOrder == 'asc' ? 'desc' : 'asc' } } + break default: sort = { [sortBy]: sortOrder ?? 'desc' } } From 62cfe0306b3b2b0806792d9b830e034a93d96390 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 6 Nov 2023 17:16:21 +0200 Subject: [PATCH 66/79] src/auth: Prevent deactivation of profile if it is in podkrepi-admin group --- apps/api/src/auth/auth.service.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index c7d76b743..e98c17943 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -1,5 +1,6 @@ import { BadRequestException, + ForbiddenException, Inject, Injectable, InternalServerErrorException, @@ -63,7 +64,8 @@ export class AuthService { @Inject(KEYCLOAK_INSTANCE) private keycloak: KeycloakConnect.Keycloak, private readonly marketingNotificationsService: MarketingNotificationsService, ) {} - + private readonly ADMIN_GROUP: string = + process.env.APP_ENV === 'production' ? 'podkrepi-team' : 'podkrepi-dev-local' async issueGrant(email: string, password: string): Promise { return this.keycloak.grantManager.obtainDirectly(email, password) } @@ -352,6 +354,12 @@ 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 isAdmin = userGroups.realmMappings?.some((obj) => obj.name === 'podkrepi-admin') + if (isAdmin) { + throw new ForbiddenException("Admin profiles can't be deactivated") + } await this.admin.users.update( { id: keycloakId }, { From f2be94f07608f937015b5ae87476c4b8ead77518 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 7 Nov 2023 12:48:39 +0200 Subject: [PATCH 67/79] src/affiliate: Solve ts errors on controller.spec --- apps/api/src/affiliate/affiliate.controller.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/api/src/affiliate/affiliate.controller.spec.ts b/apps/api/src/affiliate/affiliate.controller.spec.ts index c601d4255..fba4106ae 100644 --- a/apps/api/src/affiliate/affiliate.controller.spec.ts +++ b/apps/api/src/affiliate/affiliate.controller.spec.ts @@ -88,6 +88,7 @@ describe('AffiliateController', () => { personalNumber: null, stripeCustomerId: null, company: null, + profileEnabled: true, } const vaultMock: Vault = { @@ -281,6 +282,7 @@ describe('AffiliateController', () => { describe('Affiliate donations', () => { it('should create donation', async () => { const affiliateDonationDto: CreateAffiliateDonationDto = { + type: 'donation', campaignId: '12345', amount: 5000, billingName: 'John Doe', From 4227d25a514000b9af9efff0d0eefba858528e79 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 7 Nov 2023 12:50:10 +0200 Subject: [PATCH 68/79] src/affiliate: Add new endpoint to list all affiliates Needed for the admin panel --- apps/api/src/affiliate/affiliate.controller.ts | 11 ++++++++++- apps/api/src/affiliate/affiliate.service.ts | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index db488b06e..444e3479f 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -16,7 +16,7 @@ import { import { ApiTags } from '@nestjs/swagger' import { PersonService } from '../person/person.service' import { KeycloakTokenParsed, isAdmin } from '../auth/keycloak' -import { AuthenticatedUser, Public } from 'nest-keycloak-connect' +import { AuthenticatedUser, Public, RoleMatchingMode, Roles } from 'nest-keycloak-connect' import { AffiliateService } from './affiliate.service' import { AffiliateStatusUpdateDto } from './dto/affiliate-status-update.dto' import { CreateAffiliateDonationDto } from './dto/create-affiliate-donation.dto' @@ -25,6 +25,7 @@ import { shouldAllowStatusChange } from '../donations/helpers/donation-status-up import { affiliateCodeGenerator } from './utils/affiliateCodeGenerator' import { DonationStatus } from '@prisma/client' import { CampaignService } from '../campaign/campaign.service' +import { RealmViewSupporters, ViewSupporters } from '@podkrepi-bg/podkrepi-types' @Controller('affiliate') @ApiTags('affiliate') @@ -36,6 +37,14 @@ export class AffiliateController { private readonly campaignService: CampaignService, ) {} + @Get('list-all') + @Roles({ + roles: [RealmViewSupporters.role, ViewSupporters.role], + mode: RoleMatchingMode.ANY, + }) + async findAllAffiliates() { + return await this.affiliateService.findAll() + } @Get('data') async findAffiliateByUserId(@AuthenticatedUser() user: KeycloakTokenParsed) { const affiliate = await this.affiliateService.getAffiliateDataByKeycloakId(user.sub) diff --git a/apps/api/src/affiliate/affiliate.service.ts b/apps/api/src/affiliate/affiliate.service.ts index 3bc1bda32..180f026af 100644 --- a/apps/api/src/affiliate/affiliate.service.ts +++ b/apps/api/src/affiliate/affiliate.service.ts @@ -16,6 +16,24 @@ export class AffiliateService { return await this.prismaService.affiliate.findUnique({ where: { id } }) } + async findAll() { + return await this.prismaService.affiliate.findMany({ + include: { + company: { + select: { + companyName: true, + companyNumber: true, + person: { + select: { + firstName: true, + lastName: true, + }, + }, + }, + }, + }, + }) + } async findAffiliateByKeycloakId(keycloakId: string) { return await this.prismaService.affiliate.count({ where: { company: { person: { keycloakId } } }, From 6fa38f00aacc0d08bff14f459ac4794d1d79a6a8 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 7 Nov 2023 14:01:40 +0200 Subject: [PATCH 69/79] src/affiliate: Include person's email in findAll query result --- apps/api/src/affiliate/affiliate.service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/api/src/affiliate/affiliate.service.ts b/apps/api/src/affiliate/affiliate.service.ts index 180f026af..a84bb6f11 100644 --- a/apps/api/src/affiliate/affiliate.service.ts +++ b/apps/api/src/affiliate/affiliate.service.ts @@ -27,6 +27,7 @@ export class AffiliateService { select: { firstName: true, lastName: true, + email: true, }, }, }, From c42e7b31370487e1a4f9dda9aebe0bec08c54e45 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 7 Nov 2023 14:11:14 +0200 Subject: [PATCH 70/79] src/auth: Fix test breakage --- apps/api/src/auth/auth.service.spec.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index 33e284587..7ba0aff94 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -50,6 +50,7 @@ describe('AuthService', () => { birthday: null, personalNumber: null, stripeCustomerId: null, + profileEnabled: false, } beforeEach(async () => { @@ -310,6 +311,9 @@ describe('AuthService', () => { 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 () => { @@ -360,7 +364,7 @@ describe('AuthService', () => { // Check db creation expect(prismaSpy).toHaveBeenCalledWith({ - create: { keycloakId, email, firstName, lastName, newsletter }, + create: { keycloakId, email, firstName, lastName, newsletter, companyId, profileEnabled }, update: { keycloakId }, where: { email }, }) @@ -419,6 +423,7 @@ describe('AuthService', () => { birthday: null, personalNumber: null, stripeCustomerId: null, + profileEnabled: true, } jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) jest.spyOn(admin.users, 'create').mockResolvedValue({ id: keycloakId }) @@ -468,6 +473,7 @@ describe('AuthService', () => { birthday: null, personalNumber: null, stripeCustomerId: null, + profileEnabled: true, } jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person) jest.spyOn(admin.users, 'create').mockResolvedValue({ id: keycloakId }) From 5a68fc4b79a526a83390c712191e69f9fdc9773c Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Tue, 7 Nov 2023 15:16:50 +0200 Subject: [PATCH 71/79] schema.prisma: Add createdAt and updatedAt fields to Affiliate model --- apps/api/src/affiliate/affiliate.controller.spec.ts | 2 ++ apps/api/src/affiliate/affiliate.service.ts | 1 + .../domain/generated/affiliate/entities/affiliate.entity.ts | 2 ++ .../migration.sql | 3 +++ podkrepi.dbml | 2 ++ schema.prisma | 2 ++ 6 files changed, 12 insertions(+) create mode 100644 migrations/20231107131150_add_datetime_fields_to_affiliate/migration.sql diff --git a/apps/api/src/affiliate/affiliate.controller.spec.ts b/apps/api/src/affiliate/affiliate.controller.spec.ts index fba4106ae..62a523ef5 100644 --- a/apps/api/src/affiliate/affiliate.controller.spec.ts +++ b/apps/api/src/affiliate/affiliate.controller.spec.ts @@ -106,6 +106,8 @@ describe('AffiliateController', () => { companyId: '1234572', affiliateCode: null, status: 'pending', + createdAt: new Date(), + updatedAt: new Date(), } const activeAffiliateMock: AffiliateWithPayload = { ...affiliateMock, diff --git a/apps/api/src/affiliate/affiliate.service.ts b/apps/api/src/affiliate/affiliate.service.ts index a84bb6f11..4cb4d173b 100644 --- a/apps/api/src/affiliate/affiliate.service.ts +++ b/apps/api/src/affiliate/affiliate.service.ts @@ -18,6 +18,7 @@ export class AffiliateService { async findAll() { return await this.prismaService.affiliate.findMany({ + orderBy: { createdAt: 'desc' }, include: { company: { select: { 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 98e2a43cd..3672e5d40 100644 --- a/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts +++ b/apps/api/src/domain/generated/affiliate/entities/affiliate.entity.ts @@ -7,6 +7,8 @@ export class Affiliate { status: AffiliateStatus affiliateCode: string | null companyId: string + createdAt: Date + updatedAt: Date | null company?: Company donations?: Donation[] } diff --git a/migrations/20231107131150_add_datetime_fields_to_affiliate/migration.sql b/migrations/20231107131150_add_datetime_fields_to_affiliate/migration.sql new file mode 100644 index 000000000..0450927e6 --- /dev/null +++ b/migrations/20231107131150_add_datetime_fields_to_affiliate/migration.sql @@ -0,0 +1,3 @@ +-- AlterTable +ALTER TABLE "affiliates" ADD COLUMN "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, +ADD COLUMN "updated_at" TIMESTAMPTZ(6); diff --git a/podkrepi.dbml b/podkrepi.dbml index 93b75533c..7c6c8b54c 100644 --- a/podkrepi.dbml +++ b/podkrepi.dbml @@ -73,6 +73,8 @@ Table affiliates { status AffiliateStatus [not null, default: 'pending'] affiliateCode String [unique] companyId String [unique, not null] + createdAt DateTime [default: `now()`, not null] + updatedAt DateTime company companies [not null] donations donations [not null] } diff --git a/schema.prisma b/schema.prisma index f77da0948..1c3d805d6 100644 --- a/schema.prisma +++ b/schema.prisma @@ -104,6 +104,8 @@ model Affiliate { status AffiliateStatus @default(pending) affiliateCode String? @unique @map("affiliate_code") companyId String @unique @map("company_id") @db.Uuid + createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6) + updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) company Company @relation(fields: [companyId], references: [id]) donations Donation[] From 26837ce8a014ce78da4d321b08595b69f21defa1 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Wed, 8 Nov 2023 02:47:40 +0200 Subject: [PATCH 72/79] src/donations: Improve validation of metadata fields if not undefined -if metadata is included in the request body -it should not be empty -should contain either name or extraData -extraData should be an object --- .../dto/create-affiliate-donation.dto.ts | 17 +++++++++++++++-- .../src/donations/dto/donation-metadata.dto.ts | 10 +++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts index eb4e3ed71..838182a95 100644 --- a/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts +++ b/apps/api/src/affiliate/dto/create-affiliate-donation.dto.ts @@ -1,7 +1,18 @@ import { ApiProperty } from '@nestjs/swagger' import { Currency, DonationStatus, DonationType, PaymentProvider, Prisma } from '@prisma/client' import { Expose, Type } from 'class-transformer' -import { Equals, IsBoolean, IsEnum, IsNumber, IsOptional, IsString, IsUUID } from 'class-validator' +import { + Equals, + IsBoolean, + IsEnum, + IsNotEmptyObject, + IsNumber, + IsOptional, + IsString, + IsUUID, + ValidateIf, + ValidateNested, +} from 'class-validator' import { randomUUID } from 'crypto' import { DonationMetadataDto } from '../../donations/dto/donation-metadata.dto' @@ -64,8 +75,10 @@ export class CreateAffiliateDonationDto { @ApiProperty() @Expose() + @ValidateIf((req) => typeof req.metadata !== 'undefined') + @IsNotEmptyObject({ nullable: true }) @Type(() => DonationMetadataDto) - @IsOptional() + @ValidateNested({ each: true }) metadata: DonationMetadataDto | undefined public toEntity(targetVaultId: string): Prisma.DonationCreateInput { diff --git a/apps/api/src/donations/dto/donation-metadata.dto.ts b/apps/api/src/donations/dto/donation-metadata.dto.ts index 666d74c9f..28dae345b 100644 --- a/apps/api/src/donations/dto/donation-metadata.dto.ts +++ b/apps/api/src/donations/dto/donation-metadata.dto.ts @@ -1,7 +1,11 @@ import { ApiProperty } from '@nestjs/swagger' -import { Expose } from 'class-transformer' +import { Expose, Type } from 'class-transformer' import { IsObject, IsOptional, IsString } from 'class-validator' +class TExtraData { + [key: string]: boolean | string | null +} + export class DonationMetadataDto { @ApiProperty() @Expose() @@ -12,7 +16,7 @@ export class DonationMetadataDto { @ApiProperty() @Expose() @IsObject() + @Type(() => TExtraData) @IsOptional() - //eslint-disable-next-line - extraData: any + extraData: TExtraData | undefined } From bd4a86a2a80fa49ff02cec7b58e08b5c1e6846c1 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Wed, 8 Nov 2023 11:28:09 +0200 Subject: [PATCH 73/79] src/donations: Fix ts errors --- apps/api/src/donations/donations.controller.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/api/src/donations/donations.controller.spec.ts b/apps/api/src/donations/donations.controller.spec.ts index 039ff1087..99aee48cc 100644 --- a/apps/api/src/donations/donations.controller.spec.ts +++ b/apps/api/src/donations/donations.controller.spec.ts @@ -194,6 +194,7 @@ describe('DonationsController', () => { keycloakId: '00000000-0000-0000-0000-000000000012', stripeCustomerId: 'string', picture: 'string', + profileEnabled: true, } jest.spyOn(prismaMock, '$transaction').mockImplementation((callback) => callback(prismaMock)) @@ -245,6 +246,7 @@ describe('DonationsController', () => { keycloakId: '00000000-0000-0000-0000-000000000012', stripeCustomerId: 'string', picture: 'string', + profileEnabled: true, } const existingDonation = { ...mockDonation, status: DonationStatus.initial } From b34c67a8b16fae57fa29c8eeab86c21f7da3c870 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Wed, 8 Nov 2023 11:28:58 +0200 Subject: [PATCH 74/79] bank-transaction: iris-simulation should be done only by admin --- .../api/src/bank-transactions/bank-transactions.controller.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/api/src/bank-transactions/bank-transactions.controller.ts b/apps/api/src/bank-transactions/bank-transactions.controller.ts index 75e5dfc4c..75db2fed5 100644 --- a/apps/api/src/bank-transactions/bank-transactions.controller.ts +++ b/apps/api/src/bank-transactions/bank-transactions.controller.ts @@ -169,9 +169,7 @@ export class BankTransactionsController { const isDev = appEnv === 'development' || appEnv === 'staging' if (!isDev) throw new ForbiddenException('Endpoint available only for testing enviroments') - const affiliate = await this.affiliateService.findAffiliateByKeycloakId(user.sub) - if (!isAdmin(user) && !affiliate) - throw new ForbiddenException('Must be either an admin or active affiliate') + if (!isAdmin(user)) throw new ForbiddenException('Must be either an admin or active affiliate') return await this.bankTransactionsService.simulateIrisTask( irisDto.irisIbanAccountInfo, From e113148d82098a15e1b09f5de0b9b1e0b2db7770 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 9 Nov 2023 20:08:27 +0200 Subject: [PATCH 75/79] dto/donation-metadata: Fix extraData field being empty on valid Object being sent Apparently the latest changes broke the extraData field. - Removed the unecessary dto extension, as it is enough to validated whether the extraData is Object - Used more specific type of the expected request body of extraData --- apps/api/src/donations/dto/donation-metadata.dto.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/api/src/donations/dto/donation-metadata.dto.ts b/apps/api/src/donations/dto/donation-metadata.dto.ts index 28dae345b..b05d5f635 100644 --- a/apps/api/src/donations/dto/donation-metadata.dto.ts +++ b/apps/api/src/donations/dto/donation-metadata.dto.ts @@ -1,9 +1,9 @@ import { ApiProperty } from '@nestjs/swagger' -import { Expose, Type } from 'class-transformer' +import { Expose } from 'class-transformer' import { IsObject, IsOptional, IsString } from 'class-validator' -class TExtraData { - [key: string]: boolean | string | null +type TExtraData = { + [key: string]: string | null | number | boolean } export class DonationMetadataDto { @@ -16,7 +16,6 @@ export class DonationMetadataDto { @ApiProperty() @Expose() @IsObject() - @Type(() => TExtraData) @IsOptional() extraData: TExtraData | undefined } From 8079147243cab4dfb4ed8240dcacaeb498d92b54 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Sun, 12 Nov 2023 13:53:25 +0200 Subject: [PATCH 76/79] src/auth: Change admin roles lookup In keycloak admin access is granted through team-support role - which is compose of view-supporters, view-contact-requests. --- apps/api/src/auth/auth.service.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/api/src/auth/auth.service.ts b/apps/api/src/auth/auth.service.ts index e98c17943..bdad5b727 100644 --- a/apps/api/src/auth/auth.service.ts +++ b/apps/api/src/auth/auth.service.ts @@ -64,8 +64,7 @@ export class AuthService { @Inject(KEYCLOAK_INSTANCE) private keycloak: KeycloakConnect.Keycloak, private readonly marketingNotificationsService: MarketingNotificationsService, ) {} - private readonly ADMIN_GROUP: string = - process.env.APP_ENV === 'production' ? 'podkrepi-team' : 'podkrepi-dev-local' + async issueGrant(email: string, password: string): Promise { return this.keycloak.grantManager.obtainDirectly(email, password) } @@ -356,7 +355,12 @@ export class AuthService { await this.authenticateAdmin() // check if user is admin before attempting to activate/deactivate const userGroups = await this.admin.users.listRoleMappings({ id: keycloakId }) - const isAdmin = userGroups.realmMappings?.some((obj) => obj.name === 'podkrepi-admin') + const isAdmin = userGroups.realmMappings?.some( + (obj) => + obj.name === 'team-support' || + obj.name === 'view-supporters' || + obj.name === 'view-contact-requests', + ) if (isAdmin) { throw new ForbiddenException("Admin profiles can't be deactivated") } From 92044ebe53c54c4878c0052960d0562333ac0d79 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 13 Nov 2023 16:37:39 +0200 Subject: [PATCH 77/79] events/stripe: Resolve errors after merge of master --- .../src/donations/events/stripe-payment.service.spec.ts | 1 + apps/api/src/donations/events/stripe-payment.service.ts | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/api/src/donations/events/stripe-payment.service.spec.ts b/apps/api/src/donations/events/stripe-payment.service.spec.ts index 59ae73528..21437da3d 100644 --- a/apps/api/src/donations/events/stripe-payment.service.spec.ts +++ b/apps/api/src/donations/events/stripe-payment.service.spec.ts @@ -451,6 +451,7 @@ describe('StripePaymentService', () => { type: DonationType.donation, status: DonationStatus.succeeded, provider: 'stripe', + affiliateId: null, extCustomerId: paymentData.stripeCustomerId ?? '', extPaymentIntentId: paymentData.paymentIntentId, extPaymentMethodId: 'card', diff --git a/apps/api/src/donations/events/stripe-payment.service.ts b/apps/api/src/donations/events/stripe-payment.service.ts index ad39d3d9d..3d7d13160 100644 --- a/apps/api/src/donations/events/stripe-payment.service.ts +++ b/apps/api/src/donations/events/stripe-payment.service.ts @@ -171,12 +171,7 @@ export class StripePaymentService { const campaign = await this.campaignService.getCampaignById(metadata.campaignId) - await this.campaignService.updateDonationPayment( - campaign, - billingData, - DonationStatus.refund, - metadata, - ) + await this.campaignService.updateDonationPayment(campaign, billingData, DonationStatus.refund) if (billingData.billingEmail !== undefined) { const recepient = { to: [billingData.billingEmail] } From 421df97eb0d7443061e9664bbea0d1e67f1b54e3 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 13 Nov 2023 16:39:12 +0200 Subject: [PATCH 78/79] ESLint: Remove unused imports --- apps/api/src/account/account.controller.ts | 2 +- apps/api/src/campaign/dto/create-campaign.dto.ts | 12 +----------- .../src/donations/helpers/payment-intent-helpers.ts | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/apps/api/src/account/account.controller.ts b/apps/api/src/account/account.controller.ts index dc21746cc..14c7c07f7 100644 --- a/apps/api/src/account/account.controller.ts +++ b/apps/api/src/account/account.controller.ts @@ -1,5 +1,5 @@ import CredentialRepresentation from '@keycloak/keycloak-admin-client/lib/defs/credentialRepresentation' -import { Body, Controller, Get, Put, Logger, Delete, Patch, Param, Query } from '@nestjs/common' +import { Body, Controller, Get, Put, Logger, Delete, Patch, Param } from '@nestjs/common' import { RealmViewSupporters, ViewSupporters } from '@podkrepi-bg/podkrepi-types' import { AuthenticatedUser, Public, RoleMatchingMode, Roles } from 'nest-keycloak-connect' diff --git a/apps/api/src/campaign/dto/create-campaign.dto.ts b/apps/api/src/campaign/dto/create-campaign.dto.ts index 086fe4427..412da17bf 100644 --- a/apps/api/src/campaign/dto/create-campaign.dto.ts +++ b/apps/api/src/campaign/dto/create-campaign.dto.ts @@ -1,14 +1,4 @@ -import { - IsDate, - IsEnum, - IsNumber, - IsOptional, - IsPositive, - IsString, - IsUUID, - MaxLength, - MinLength, -} from 'class-validator' +import { IsDate, IsEnum, IsNumber, IsOptional, IsPositive, IsString, IsUUID } from 'class-validator' import { ApiProperty } from '@nestjs/swagger' import { Expose, Transform, Type } from 'class-transformer' import { CampaignState, Currency, Prisma } from '@prisma/client' diff --git a/apps/api/src/donations/helpers/payment-intent-helpers.ts b/apps/api/src/donations/helpers/payment-intent-helpers.ts index b71a370a5..052b50f84 100644 --- a/apps/api/src/donations/helpers/payment-intent-helpers.ts +++ b/apps/api/src/donations/helpers/payment-intent-helpers.ts @@ -1,4 +1,4 @@ -import { DonationType, PaymentProvider } from '@prisma/client' +import { PaymentProvider } from '@prisma/client' import Stripe from 'stripe' import { getCountryRegion, stripeFeeCalculator } from './stripe-fee-calculator' import { RecurringDonationStatus, Currency } from '@prisma/client' From 94b97bc1d5f52bf73575a3b1cc89ffbfe955ffeb Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 13 Nov 2023 16:56:45 +0200 Subject: [PATCH 79/79] auth.service.spec: Bring back issueToken testcase Not quite sure why it was removed --- apps/api/src/auth/auth.service.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index 7ba0aff94..5474f3239 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -125,6 +125,20 @@ describe('AuthService', () => { 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', () => {