Added: Alembic for migrations
Moving from Pyramid to FastAPI
This commit is contained in:
@ -8,7 +8,7 @@ import {MatDialog} from '@angular/material/dialog';
|
||||
import {FormBuilder, FormGroup} from '@angular/forms';
|
||||
import {MenuCategory} from '../../core/menu-category';
|
||||
import {NestedTreeControl} from '@angular/cdk/tree';
|
||||
import {MatTreeNestedDataSource} from '@angular/material';
|
||||
import { MatTreeNestedDataSource } from '@angular/material/tree';
|
||||
import {Product} from '../../core/product';
|
||||
|
||||
@Component({
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
|
||||
import {ErrorLoggerService} from '../core/error-logger.service';
|
||||
import {catchError} from 'rxjs/operators';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {ModifierCategory} from '../core/modifier-category';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { ModifierCategory } from '../core/modifier-category';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
};
|
||||
const url = '/v1/modifier-categories';
|
||||
const url = '/api/modifier-categories';
|
||||
const serviceName = 'ModifierCategoryService';
|
||||
|
||||
@Injectable({
|
||||
@ -19,7 +19,7 @@ export class ModifierCategoryService {
|
||||
}
|
||||
|
||||
get(id: string): Observable<ModifierCategory> {
|
||||
const getUrl: string = (id === null) ? `${url}/new` : `${url}/${id}`;
|
||||
const getUrl: string = (id === null) ? url : `${url}/${id}`;
|
||||
return <Observable<ModifierCategory>>this.http.get<ModifierCategory>(getUrl)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get id=${id}`))
|
||||
@ -27,23 +27,22 @@ export class ModifierCategoryService {
|
||||
}
|
||||
|
||||
list(): Observable<ModifierCategory[]> {
|
||||
const options = {params: new HttpParams().set('l', '')};
|
||||
return <Observable<ModifierCategory[]>>this.http.get<ModifierCategory[]>(url, options)
|
||||
return <Observable<ModifierCategory[]>>this.http.get<ModifierCategory[]>(`${url}/list`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
}
|
||||
|
||||
listIsActiveOfProduct(id: string): Observable<ModifierCategory[]> {
|
||||
const options = {params: new HttpParams().set('p', id).set('a', '')};
|
||||
return <Observable<ModifierCategory[]>>this.http.get<ModifierCategory[]>(url, options)
|
||||
listForProduct(id: string): Observable<ModifierCategory[]> {
|
||||
return <Observable<ModifierCategory[]>>this.http.get<ModifierCategory[]>(`${url}/for-product/${id}`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'listIsActiveOfProduct'))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
save(modifierCategory: ModifierCategory): Observable<ModifierCategory> {
|
||||
return <Observable<ModifierCategory>>this.http.post<ModifierCategory>(`${url}/new`, modifierCategory, httpOptions)
|
||||
return <Observable<ModifierCategory>>this.http.post<ModifierCategory>(url, modifierCategory, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'save'))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user