blob: d05aa6d1836a854337f2c9a28a464c176f45da01 [file] [log] [blame]
Matteo Scandolof2c3ed62016-12-15 14:32:50 -08001import {AppConfig} from '../../config/app.config';
2
3interface IModeldefField {
4 name: string;
5 type: string;
6}
7
8export interface IModeldef {
9 fields: IModeldefField[];
10 relations: string[];
11 name: string;
12}
13
14export interface IModeldefsService {
15 get(): Promise<IModeldef[]>;
16}
17
18export class ModeldefsService {
19 constructor(
20 private $http: angular.IHttpService,
21 private $q: angular.IQService,
22 ) {
23 }
24
25 public get(): Promise<any> {
26 const d = this.$q.defer();
27 this.$http.get(`${AppConfig.apiEndpoint}/utility/modeldefs/`)
28 .then((res) => {
29 d.resolve(res.data);
30 })
31 .catch(e => {
32 d.reject(e);
33 });
34 return d.promise;
35 }
36}