Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Controller } from '@nestjs/common';
import { MessagePattern } from '@nestjs/microservices';
import {
EventAnonCredsSchemasGetAll,
EventAnonCredsSchemasGetAllInput,
EventAnonCredsSchemasGetById,
EventAnonCredsSchemasGetByIdInput,
EventAnonCredsSchemasRegister,
EventAnonCredsSchemasRegisterInput,
} from '@ocm/shared';
import { SchemasService } from './schemas.service.js';
@Controller('schemas')
export class SchemasController {
public constructor(private schemasService: SchemasService) {}
@MessagePattern(EventAnonCredsSchemasGetAll.token)
public async getAll(
options: EventAnonCredsSchemasGetAllInput,
): Promise<EventAnonCredsSchemasGetAll> {
return new EventAnonCredsSchemasGetAll(
await this.schemasService.getAll(options),
options.tenantId,
);
}
@MessagePattern(EventAnonCredsSchemasGetById.token)
public async getById(
options: EventAnonCredsSchemasGetByIdInput,
): Promise<EventAnonCredsSchemasGetById> {
return new EventAnonCredsSchemasGetById(
await this.schemasService.getById(options),
options.tenantId,
);
}
@MessagePattern(EventAnonCredsSchemasRegister.token)
public async register(
options: EventAnonCredsSchemasRegisterInput,
): Promise<EventAnonCredsSchemasRegister> {
return new EventAnonCredsSchemasRegister(
await this.schemasService.register(options),
options.tenantId,
);
}
}