update methods and immutable attribute added

This commit is contained in:
2021-09-07 15:22:55 +02:00
parent 0afef9f3cd
commit 6470aa5358
10 changed files with 956 additions and 20 deletions

View File

@ -2,8 +2,7 @@ $GENERATED_TS_COMMENT
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { HttpClient } from '@angular/common/http';
import { MessageService } from './message.service';
import { serviceBaseUrl } from './config';
@ -42,6 +41,15 @@ export class ${JsNameConverter($table.name)}Service {
return this.http.post<${JsNameConverter($table.name)}>(`\${serviceBaseUrl}/v1/${table.name}s`, item).toPromise()
}
#if (('immutable' not in $table) or (not $table.immutable))
async put${JsNameConverter($table.name)}(item: ${JsNameConverter($table.name)}): Promise<${JsNameConverter($table.name)}> {
let itemStr: string = JSON.stringify(item, undefined, 4)
this.messageService.add(`${JsNameConverter($table.name)}Service: put data for \${itemStr}`)
let id: number = item["id"]
return this.http.put<${JsNameConverter($table.name)}>(`\${serviceBaseUrl}/v1/${table.name}s/\${id}`, item).toPromise()
}
#end if
}
#end for