Automation adds release-notes.rst
[ccsdk/cds.git] / cds-ui / server / src / controllers / controller-catalog.controller.ts
1 // Uncomment these imports to begin using these cool features!
2
3 // import {inject} from '@loopback/context';
4 import {
5   post,
6   param,
7   get,
8   getFilterSchemaFor,
9   getWhereSchemaFor,
10   patch,
11   put,
12   del,
13   requestBody,
14   Request,
15   Response,
16   RestBindings,
17 } from '@loopback/rest';
18 import { inject } from '@loopback/core';
19 import { ControllerCatalogService } from '../services';
20
21 export class ControllerCatalogController {
22   constructor(
23     @inject('services.ControllerCatalogService')
24     public Ccservice: ControllerCatalogService,
25   ){ }
26
27   @get('/controllercatalog/search/{tags}', {
28     responses: {
29       '200': {
30         content: { 'application/json': {} },
31       },
32     },
33   })
34   async getByTags(@param.path.string('tags') tags: string) {
35     return await this.Ccservice.getByTags(tags);
36   }
37
38   @post('/controllercatalog/save', {
39     responses: {
40       '200': {
41         content: { 'application/json': {} }
42       }
43     },
44   })
45   async save(@requestBody({
46     content: { 'application/json': { schema: { 'x-ts-type': JSON } } },
47     accepts: { 'application/json': { schema: { 'x-ts-type': JSON } } }
48   }) controllerCatalog: JSON): Promise<any> {
49     return await this.Ccservice.save(controllerCatalog);
50   }
51   
52   @get('/controllercatalog/model-type/by-definition/{definitionType}', {
53     responses: {
54       '200': {
55         content: { 'application/json': {} },
56       },
57     },
58   })
59   async getDataTypes(@param.path.string('definitionType') definitionType: string) {
60     return await this.Ccservice.getDefinitionTypes(definitionType);
61   }
62
63   @del('/controllercatalog/model-type/{name}', {
64       responses: {
65         '200': {
66           content: { 'application/json': {} }
67         }
68       },
69     })
70     async delete(@param.path.string('name') name: string): Promise<JSON>  {
71       return await this.Ccservice.deleteCatalog(name);
72     }
73 }