Newer
Older
import { Controller } from '@nestjs/common';
import { MessagePattern } from '@nestjs/microservices';
import {
Konstantin Tsabolov
committed
EventAnonCredsCredentialOfferGetById,
EventAnonCredsCredentialOfferGetByIdInput,
EventAnonCredsCredentialRequestGetById,
EventAnonCredsCredentialRequestGetByIdInput,
EventAnonCredsCredentialsDeleteById,
EventAnonCredsCredentialsDeleteByIdInput,
EventAnonCredsCredentialsGetAll,
EventAnonCredsCredentialsGetAllInput,
EventAnonCredsCredentialsGetById,
EventAnonCredsCredentialsGetByIdInput,
EventDidcommAnonCredsCredentialsOffer,
EventDidcommAnonCredsCredentialsOfferInput,
EventDidcommAnonCredsCredentialsOfferToSelf,
Konstantin Tsabolov
committed
EventDidcommAnonCredsCredentialsOfferToSelfInput
} from '@ocm/shared';
import { AnonCredsCredentialsService } from './anoncredsCredentials.service.js';
@Controller('anoncredsCredentials')
export class AnonCredsCredentialsController {
public constructor(private credentialsService: AnonCredsCredentialsService) {}
@MessagePattern(EventAnonCredsCredentialsGetAll.token)
options: EventAnonCredsCredentialsGetAllInput,
): Promise<EventAnonCredsCredentialsGetAll> {
return new EventAnonCredsCredentialsGetAll(
await this.credentialsService.getAll(options),
options.tenantId,
);
}
@MessagePattern(EventAnonCredsCredentialsGetById.token)
options: EventAnonCredsCredentialsGetByIdInput,
): Promise<EventAnonCredsCredentialsGetById> {
return new EventAnonCredsCredentialsGetById(
await this.credentialsService.getById(options),
options.tenantId,
);
}
@MessagePattern(EventAnonCredsCredentialOfferGetById.token)
public async getOfferById(
options: EventAnonCredsCredentialOfferGetByIdInput,
): Promise<EventAnonCredsCredentialOfferGetById> {
return new EventAnonCredsCredentialOfferGetById(
await this.credentialsService.getOfferById(options),
options.tenantId,
);
}
@MessagePattern(EventAnonCredsCredentialRequestGetById.token)
public async getRequestById(
options: EventAnonCredsCredentialRequestGetByIdInput,
): Promise<EventAnonCredsCredentialRequestGetById> {
return new EventAnonCredsCredentialRequestGetById(
await this.credentialsService.getRequestById(options),
options.tenantId,
);
}
@MessagePattern(EventAnonCredsCredentialsDeleteById.token)
public async deleteById(
options: EventAnonCredsCredentialsDeleteByIdInput,
): Promise<EventAnonCredsCredentialsDeleteById> {
return new EventAnonCredsCredentialsDeleteById(
await this.credentialsService.deleteById(options),
options.tenantId,
);
}
@MessagePattern(EventDidcommAnonCredsCredentialsOffer.token)
public async offer(
options: EventDidcommAnonCredsCredentialsOfferInput,
): Promise<EventDidcommAnonCredsCredentialsOffer> {
return new EventDidcommAnonCredsCredentialsOffer(
await this.credentialsService.offer(options),
options.tenantId,
);
}
@MessagePattern(EventDidcommAnonCredsCredentialsOfferToSelf.token)
public async offerToSelf(
options: EventDidcommAnonCredsCredentialsOfferToSelfInput,
): Promise<EventDidcommAnonCredsCredentialsOfferToSelf> {
return new EventDidcommAnonCredsCredentialsOfferToSelf(
await this.credentialsService.offerToSelf(options),
options.tenantId,
);
}
}