1 // Uncomment these imports to begin using these cool features!
3 // import {inject} from '@loopback/context';
17 } from '@loopback/rest';
18 import { inject } from '@loopback/core';
19 import { ResourceDictionaryService } from '../services';
21 const REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER = process.env.REST_BLUEPRINT_CONTROLLER_BASIC_AUTH_HEADER || "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==";
22 export class DataDictionaryController {
24 @inject('services.ResourceDictionaryService')
25 public rdservice: ResourceDictionaryService,
28 @get('/resourcedictionary/{name}', {
31 content: { 'application/json': {} },
35 async getByName(@param.path.string('name') name: string) {
36 return await this.rdservice.getByName(name, REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER);
38 @get('/resourcedictionary/{tags}', {
41 content: { 'application/json': {} },
45 async getByTags(@param.path.string('tags') tags: string) {
46 return await this.rdservice.getByTags(tags, REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER);
49 @get('/resourcedictionary/source-mapping', {
52 content: { 'application/json': {} },
56 async getSourceMapping() {
57 return await this.rdservice.getSourceMapping(REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER);
59 @post('/resourcedictionary/save', {
62 content: { 'application/json': {} }
66 async save(@requestBody({
67 content: { 'application/json': { schema: { 'x-ts-type': JSON } } },
68 accepts: { 'application/json': { schema: { 'x-ts-type': JSON } } }
69 }) resourceDictionary: JSON): Promise<any> {
70 return await this.rdservice.save(REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER, resourceDictionary);
72 @post('/resourcedictionary/search/by-names', {
75 content: { 'application/json': {} }
79 async searchByNames(@requestBody({
80 content: { 'application/json': { schema: { 'x-ts-type': JSON } } },
81 accepts: { 'application/json': { schema: { 'x-ts-type': JSON } } }
82 }) resourceDictionaryList: JSON): Promise<any> {
83 return await this.rdservice.searchbyNames(REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER, resourceDictionaryList);