Save DataSet
This commit is contained in:
@@ -19,6 +19,10 @@ export class DataSet extends Base {
|
||||
Object.assign(this, Object.assign(this, super.deserialize(input)));
|
||||
return this;
|
||||
}
|
||||
override serialize() {
|
||||
this.number = 0; // will be overrided in backend
|
||||
return Object.assign({}, this);
|
||||
}
|
||||
static getForm(fb: UntypedFormBuilder) {
|
||||
return fb.group({
|
||||
id: [null],
|
||||
@@ -44,27 +48,16 @@ export class DataSet extends Base {
|
||||
this.createdBy = undefined;
|
||||
this.modifiedBy = undefined;
|
||||
}
|
||||
//API Actions
|
||||
/*
|
||||
static add(input: Account, _http: HttpClient, _data: DataService): Promise<string> {
|
||||
//API Actions
|
||||
static add(input: DataSet, _http: HttpClient): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
_http.post<string>(`${environment.api.url}/accounts`, {...input.serialize(), modifiedById: _data.currentUser.id }).subscribe({
|
||||
_http.post<string>(`${environment.api.url}/datasets`, {...input.serialize(), }).subscribe({
|
||||
next: (data) => resolve(data),
|
||||
error: (e) => reject(e)
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
static update(input: Account, _http: HttpClient, _data: DataService): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
_http.patch<string>(`${environment.api.url}/accounts`, {...input.serialize(), modifiedById: _data.currentUser.id }).subscribe({
|
||||
next: (data) => resolve(data),
|
||||
error: (e) => reject(e)
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
*/
|
||||
static getList(_http: HttpClient): any {
|
||||
return new Promise((resolve, reject) => {
|
||||
_http.get<DataSet[]>(`${environment.api.url}/datasets`)
|
||||
@@ -75,7 +68,6 @@ export class DataSet extends Base {
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
static getById(id: string, _http: HttpClient): Promise<DataSet> {
|
||||
return new Promise((resolve, reject) => {
|
||||
_http.get<DataSet>(`${environment.api.url}/datasets/${id}`).pipe(map(x => new DataSet().deserialize(x))).subscribe({
|
||||
@@ -98,14 +90,4 @@ export class DataSet extends Base {
|
||||
})
|
||||
})
|
||||
}
|
||||
/*
|
||||
static delete(id: string, _http: HttpClient): Promise<string> {
|
||||
return new Promise((resolve, reject)=> {
|
||||
_http.delete<string>(`${environment.api.url}/accounts/${id}`).subscribe({
|
||||
next: (data) => resolve(data),
|
||||
error: (e) => reject(e)
|
||||
})
|
||||
});
|
||||
}
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user