Skip to content
Snippets Groups Projects
Commit 953e6899 authored by Steffen Schulze's avatar Steffen Schulze
Browse files

Merge branch 'fix/did-creation-validation' into 'main'

fix did registration validation

See merge request !48
parents 611f68a0 ddcd83ab
No related branches found
No related tags found
1 merge request!48fix did registration validation
Pipeline #41204 canceled
......@@ -35,18 +35,24 @@ export class DIDsService {
seed: EventDidsRegisterIndyFromSeedInput['seed'],
services?: Array<{ id: string; type: string; serviceEndpoint: string }>,
) {
const mappedServices: EventDidsRegisterIndyFromSeedInput['services'] =
services?.map(({ id, type, serviceEndpoint }) => ({
identifier: id,
type,
url: serviceEndpoint,
}));
const data: EventDidsRegisterIndyFromSeedInput = { tenantId, seed };
if (services && services.length > 0) {
const mappedServices: EventDidsRegisterIndyFromSeedInput['services'] =
services?.map(({ id, type, serviceEndpoint }) => ({
identifier: id,
type,
url: serviceEndpoint,
}));
data.services = mappedServices;
}
return this.natsClient
.send<
EventDidsRegisterIndyFromSeed,
EventDidsRegisterIndyFromSeedInput
>(EventDidsRegisterIndyFromSeed.token, { tenantId, seed, services: mappedServices })
>(EventDidsRegisterIndyFromSeed.token, data)
.pipe(map(({ data }) => data));
}
......
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsArray, IsOptional, IsString, ValidateNested } from 'class-validator';
import {
IsArray,
IsNotEmpty,
IsOptional,
IsString,
ValidateNested,
} from 'class-validator';
class Service {
@IsString()
......@@ -34,6 +40,7 @@ export class RegisterFromSeedPayload {
public seed: string;
@IsArray()
@IsNotEmpty()
@ValidateNested()
@Type(() => Service)
@IsOptional()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment