Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { authenticate } from '@loopback/authentication';
import { authorize } from '@loopback/authorization';
import { intercept, service } from '@loopback/core';
import { Where } from '@loopback/repository';
import { get, getWhereSchemaFor, oas, param } from '@loopback/rest';
import { BaseController, MixinOptions } from '@logchain/controllers';
import { EnsurePagingCorrectInterceptor, serialize } from '@logchain/interceptors';
import { buildResponseObject, limitSpec, offsetSpec, qSpec, sortSpec } from '@logchain/apidefs';
import { Module, Constants } from '@logchain/configs';
import { FlowPersonaDto } from '@logchain/dtos';
import { BaseResponses, FlowPersona } from '@logchain/models';
import { FlowPersonaService } from '@logchain/services';
const options: MixinOptions = {
basePath: '/flows',
modelClass: FlowPersona,
modelDtoClass: FlowPersonaDto,
admin: true,
schemaOptions: {
find: {
exclude: [],
authorize: {
resource: Module.Compliance.FlowMgmt,
scopes: [Constants.AccessScope.Retrieve],
},
},
},
};
@oas.tags('Flow')
@authenticate('aws-cognito')
export class FlowPersonaController extends BaseController {
constructor(
@service(FlowPersonaService)
public selfService: FlowPersonaService,
) {
super();
}
/**
* Get list reference persona.
* @param id The id of the flow.
*/
@get(`/${options.basePath}/{id}/personas`, {
responses: {
'200': buildResponseObject(options.modelDtoClass, options.admin),
},
})
@intercept(EnsurePagingCorrectInterceptor.BINDING_KEY)
@authorize(options.schemaOptions['find'].authorize)
@intercept(serialize(FlowPersonaDto))
async find(
@param(offsetSpec) offset: number,
@param(limitSpec) limit: number,
@param(sortSpec) sort: Array<string>,
@param(qSpec) q: string,
@param.query.object('where', getWhereSchemaFor(FlowPersona))
where: Where<FlowPersona>,
@param.path.integer('id') id: number,
): Promise<BaseResponses<FlowPersona>> {
this.selfService.buildBaseFilter(offset, limit, sort, where);
await this.selfService.buildSearchQuery(q);
return this.selfService.findPersonas(id);
}
}
|