diff --git a/apps/api/src/auth/auth.service.spec.ts b/apps/api/src/auth/auth.service.spec.ts index e1e0b9727..483dcf72d 100644 --- a/apps/api/src/auth/auth.service.spec.ts +++ b/apps/api/src/auth/auth.service.spec.ts @@ -31,7 +31,7 @@ describe('AuthService', () => { let config: ConfigService let admin: KeycloakAdminClient let keycloak: KeycloakConnect.Keycloak - let marketing: NotificationsProviderInterface + let marketing: NotificationsProviderInterface const person: Person = { id: 'e43348aa-be33-4c12-80bf-2adfbf8736cd', @@ -113,7 +113,7 @@ describe('AuthService', () => { service = module.get(AuthService) config = module.get(ConfigService) admin = module.get(KeycloakAdminClient) - marketing = module.get>(NotificationsProviderInterface) + marketing = module.get>(NotificationsProviderInterface) keycloak = module.get(KEYCLOAK_INSTANCE) }) diff --git a/apps/api/src/campaign-file/campaign-file.controller.ts b/apps/api/src/campaign-file/campaign-file.controller.ts index dbd136931..ee4402cf4 100644 --- a/apps/api/src/campaign-file/campaign-file.controller.ts +++ b/apps/api/src/campaign-file/campaign-file.controller.ts @@ -24,7 +24,6 @@ import { CampaignFileService } from './campaign-file.service' import { CampaignService } from '../campaign/campaign.service' import { KeycloakTokenParsed, isAdmin } from '../auth/keycloak' import { ApiTags } from '@nestjs/swagger' -import { CampaignFileRole } from '@prisma/client' @ApiTags('campaign-file') @Controller('campaign-file') diff --git a/apps/api/src/campaign/campaign.controller.spec.ts b/apps/api/src/campaign/campaign.controller.spec.ts index 9f81b4791..4220c0fc6 100644 --- a/apps/api/src/campaign/campaign.controller.spec.ts +++ b/apps/api/src/campaign/campaign.controller.spec.ts @@ -28,7 +28,7 @@ describe('CampaignController', () => { let controller: CampaignController let prismaService: PrismaService let campaignService: CampaignService - let marketingProvider: NotificationsProviderInterface + let marketingProvider: NotificationsProviderInterface let marketingService: MarketingNotificationsService const personServiceMock = { findOneByKeycloakId: jest.fn(() => { @@ -196,7 +196,7 @@ describe('CampaignController', () => { prismaService = prismaMock campaignService = module.get(CampaignService) marketingService = module.get(MarketingNotificationsService) - marketingProvider = module.get>( + marketingProvider = module.get>( NotificationsProviderInterface, ) diff --git a/apps/api/src/campaign/campaign.service.spec.ts b/apps/api/src/campaign/campaign.service.spec.ts index 7d12aa3ff..5e41195c5 100644 --- a/apps/api/src/campaign/campaign.service.spec.ts +++ b/apps/api/src/campaign/campaign.service.spec.ts @@ -17,7 +17,7 @@ import { MarketingNotificationsService } from '../notifications/notifications.se describe('CampaignService', () => { let service: CampaignService - let marketing: NotificationsProviderInterface + let marketing: NotificationsProviderInterface const mockCreateCampaign = { slug: 'test-slug', @@ -106,7 +106,7 @@ describe('CampaignService', () => { .compile() service = module.get(CampaignService) - marketing = module.get>(NotificationsProviderInterface) + marketing = module.get>(NotificationsProviderInterface) }) describe('update', () => { diff --git a/apps/api/src/config/shutdown.config.ts b/apps/api/src/config/shutdown.config.ts index 79279f9b3..a660698bc 100644 --- a/apps/api/src/config/shutdown.config.ts +++ b/apps/api/src/config/shutdown.config.ts @@ -1,5 +1,4 @@ import { INestApplication, ShutdownSignal } from '@nestjs/common' -import { PrismaService } from '../prisma/prisma.service' export function setupShutdownHooks(app: INestApplication) { // https://www.prisma.io/docs/guides/upgrade-guides/upgrading-versions/upgrading-to-prisma-5 diff --git a/apps/api/src/notifications/marketing_templates/scripts/upload-templates.ts b/apps/api/src/notifications/marketing_templates/scripts/upload-templates.ts index c91a98687..783f51aaf 100644 --- a/apps/api/src/notifications/marketing_templates/scripts/upload-templates.ts +++ b/apps/api/src/notifications/marketing_templates/scripts/upload-templates.ts @@ -2,6 +2,7 @@ import * as fs from 'fs' import { PrismaClient } from '@prisma/client' import * as sgClient from '@sendgrid/client' import { Logger } from '@nestjs/common' +import { ClientRequest } from '@sendgrid/client/src/request' sgClient.setApiKey(process.env['SENDGRID_API_KEY'] || '') @@ -28,7 +29,7 @@ async function createMarketingTemplatesIfNotExisting() { url: `/v3/designs`, method: 'POST', body: data, - } as any + } as ClientRequest const [response] = await sgClient.request(request) diff --git a/apps/api/src/notifications/notifications.controller.spec.ts b/apps/api/src/notifications/notifications.controller.spec.ts index c3f055d1c..cf3830365 100644 --- a/apps/api/src/notifications/notifications.controller.spec.ts +++ b/apps/api/src/notifications/notifications.controller.spec.ts @@ -112,7 +112,7 @@ describe('MarketingNotificationsController', () => { jest.spyOn(marketingProvider, 'getContactsInfo').mockImplementation(async () => ({})) // Mock hash jest - .spyOn(MarketingNotificationsService.prototype as any, 'generateHash') + .spyOn(MarketingNotificationsService.prototype, 'generateHash') .mockReturnValue('hash-value') }) @@ -128,7 +128,9 @@ describe('MarketingNotificationsController', () => { it('should skip sending if user is registered + subscribed', async () => { prismaMock.person.findFirst.mockResolvedValue(RegisteredMock) - await expect(controller.sendConfirmation({ email: RegisteredMock.email })).resolves.toEqual({ + await expect( + controller.sendConfirmation({ email: RegisteredMock.email as string }), + ).resolves.toEqual({ message: 'Subscribed', }) diff --git a/apps/api/src/prisma/prisma.service.ts b/apps/api/src/prisma/prisma.service.ts index ab6eb5f92..cd3d1c20c 100644 --- a/apps/api/src/prisma/prisma.service.ts +++ b/apps/api/src/prisma/prisma.service.ts @@ -1,5 +1,5 @@ import { PrismaClient } from '@prisma/client' -import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common' +import { Injectable, OnModuleInit } from '@nestjs/common' @Injectable() export class PrismaService extends PrismaClient implements OnModuleInit { diff --git a/apps/api/src/withdrawal/dto/create-withdrawal.dto.ts b/apps/api/src/withdrawal/dto/create-withdrawal.dto.ts index 0baf98c0c..1ac18ebc6 100644 --- a/apps/api/src/withdrawal/dto/create-withdrawal.dto.ts +++ b/apps/api/src/withdrawal/dto/create-withdrawal.dto.ts @@ -1,7 +1,7 @@ import { ApiProperty } from '@nestjs/swagger' import { Currency, WithdrawStatus } from '@prisma/client' -import { Expose } from 'class-transformer' -import { IsEnum, IsNumber, IsString, IsUUID, IsOptional } from 'class-validator' +import { Expose, Type } from 'class-transformer' +import { IsEnum, IsNumber, IsString, IsUUID, IsOptional, IsDate } from 'class-validator' export class CreateWithdrawalDto { @ApiProperty({ enum: WithdrawStatus }) @Expose() @@ -49,4 +49,11 @@ export class CreateWithdrawalDto { @IsOptional() @Expose() approvedById?: string + + @ApiProperty() + @Expose() + @IsOptional() + @IsDate() + @Type(() => Date) + targetDate?: Date | null }