Compare commits

..

No commits in common. "6277236993d21628040b098d8b474d420f5cffc3" and "9a338c04e6f535813119132d53fc81a99c234544" have entirely different histories.

4 changed files with 75 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import { appConfigFactory } from "./shared/app.config.factory";
import { AuthGuard } from './services/auth-guard.service';
import { NavBarGuard } from './services/nav-bar-guard.service';
import { FullScreenGuard } from './services/full-screen-guard.service';
import { CodeListItemService } from './services/codelistitem.service';
import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard';
import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service';
import { NgbDateNativeAdapter } from './services/date-adapter.service'
@ -41,6 +42,7 @@ export {
TypeaheadService,
UserService,
WeatherService,
CodeListItemService,
AppConfig,
AccessTokenInterceptor,
AuthGuard,

View File

@ -47,6 +47,7 @@ import { ISenMLItem } from './models/senml-item';
import { IPackage,IPackages } from './models/package';
import { IUser } from './models/user';
import { IQueryState } from './models/query.state';
import { ICodeListItem } from './models/code.list.item';
import { IDataLayer } from './models/data.layer';
import { IColor,IGradientstop} from './models/gradient';
import * as commonActions from './actions/app-common.actions';
@ -81,6 +82,7 @@ export {
IListItem,
ITypeaheadItem,
IUser,
ICodeListItem,
IQueryState,
IPackage,
IPackages,

View File

@ -0,0 +1,30 @@
export interface ICodeListItem {
codeList: string;
code: string;
codeGroup?: string;
unit?: string;
description?: string;
validFrom?: Date;
validTo?: Date;
created?: Date;
updated?: Date;
data?:any;
readWrite?: boolean;
}
export class CodeListItem implements ICodeListItem {
public codeList: string;
public code: string;
public codeGroup?: string;
public unit?: string;
public description:string;
public validFrom?: Date;
public validTo?: Date;
public created?: Date;
public updated?: Date;
public data?:any;
public readWrite?: boolean;
constructor() {
}
}

View File

@ -0,0 +1,41 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpClient, HttpParams } from "@angular/common/http";
import { AppConfig } from "../shared/app.config";
import { ICodeListItem } from '../models/code.list.item';
@Injectable({
providedIn: 'root',
})
export class CodeListItemService {
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
}
ApiEndpoint() {
return this.appConfig.getConfig("apiEndPoint");
}
getCodeListItems(codelist: string[]): Observable<ICodeListItem[]> {
var params = new HttpParams();
for (const cl of codelist) {
params = params.append('cl', cl);
}
return this.httpClient.get<ICodeListItem[]>(`${this.ApiEndpoint()}/api/v1/codelistitems/`, { params: params });
}
getCodeListItem(codeList: string, code: string): Observable<ICodeListItem> {
return this.httpClient.get<ICodeListItem>(`${this.ApiEndpoint()}/api/v1/codelistitems/${codeList}/${code}`);
}
postCodeListItem(codeListItem: ICodeListItem): Observable<ICodeListItem> {
return this.httpClient.post<ICodeListItem>(`${this.ApiEndpoint()}/api/v1/codelistitems/${codeListItem.codeList}`, codeListItem);
}
putCodeListItem(codeListItem: ICodeListItem): Observable<ICodeListItem> {
return this.httpClient.put<ICodeListItem>(`${this.ApiEndpoint()}/api/v1/codelistitems/${codeListItem.codeList}`, codeListItem);
}
deleteCodeListItem(codelist: string, code: string): Observable<any> {
return this.httpClient.delete(`${this.ApiEndpoint()}/api/v1/codelistitems/${codelist}/${code}`);
}
}