Skip to content

Commit

Permalink
WIP implement post endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
diderikvw committed Sep 13, 2024
1 parent 95ebbb3 commit 10d3639
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {
FinancialServiceProviderConfigurationEnum,
FinancialServiceProviderName,
} from '@121-service/src/financial-service-providers/enum/financial-service-provider-name.enum';
import { LocalizedString } from '@121-service/src/shared/types/localized-string.type';
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString } from 'class-validator';

export class CreateProgramFinancialServiceProviderConfigurationDto {
// TODO: Do we accept spaces in the name? Any other naming criteria? Special characters? All lowercase?
@ApiProperty({ example: 'VisaDebitCards' })
@IsNotEmpty()
@IsString()
public readonly name: string;

@ApiProperty({
example: {
en: 'Visa Debit Cards',
nl: 'Visa-betaalkaarten',
},
})
@IsNotEmpty()
public readonly label: LocalizedString;

@ApiProperty({
enum: FinancialServiceProviderName,
type: 'enum',
example: FinancialServiceProviderName.intersolveVoucherWhatsapp,
})
@IsNotEmpty()
public readonly financialServiceProviderName: FinancialServiceProviderName;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { ApiProperty } from '@nestjs/swagger';

export class ProgramFinancialServiceProviderConfigurationReturnDto {
@ApiProperty({ example: 1, type: 'number' })
public programId: number;
public readonly programId: number;

@ApiProperty({ enum: FinancialServiceProviderName, type: 'enum' })
public financialServiceProviderName: FinancialServiceProviderName;
public readonly financialServiceProviderName: FinancialServiceProviderName;

@ApiProperty({ example: 'FSP Name', type: 'string' })
public name: string;
public readonly name: string;

@ApiProperty({ type: 'object' })
public label: LocalizedString;
public readonly label: LocalizedString;

@ApiProperty({ type: 'object' })
public financialServiceProvider: FinancialServiceProviderDto;
public readonly financialServiceProvider: FinancialServiceProviderDto;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AuthenticatedUser } from '@121-service/src/guards/authenticated-user.decorator';
import { AuthenticatedUserGuard } from '@121-service/src/guards/authenticated-user.guard';
import { CreateProgramFspConfigurationDto } from '@121-service/src/program-financial-service-provider-configurations/dtos/create-program-fsp-configuration.dto';
import { CreateProgramFinancialServiceProviderConfigurationDto } from '@121-service/src/program-financial-service-provider-configurations/dtos/create-program-financial-service-provider-configuration.dto';
import { ProgramFinancialServiceProviderConfigurationReturnDto } from '@121-service/src/program-financial-service-provider-configurations/dtos/program-financial-service-provider-configuration-return.dto';
import { UpdateProgramFspConfigurationDto } from '@121-service/src/program-financial-service-provider-configurations/dtos/update-program-fsp-configuration.dto';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/program-financial-service-provider-configuration.entity';
Expand Down Expand Up @@ -81,7 +81,8 @@ export class ProgramFinancialServiceProviderConfigurationsController {
@ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
@Post(':programId/financial-service-provider-configurations')
public async create(
@Body() programFspConfigurationData: CreateProgramFspConfigurationDto,
@Body()
programFspConfigurationData: CreateProgramFinancialServiceProviderConfigurationDto,
@Param('programId', ParseIntPipe)
programId: number,
): Promise<number> {
Expand Down

0 comments on commit 10d3639

Please sign in to comment.