Added: Alembic for migrations
Moving from Pyramid to FastAPI
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
import { SaleCategoryService } from '../sale-category.service';
|
||||
import { SaleCategory } from '../../core/sale-category';
|
||||
|
||||
@ -2,7 +2,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { SaleCategoryListDatasource } from './sale-category-list-datasource';
|
||||
import { SaleCategory } from '../../core/sale-category';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatTable } from '@angular/material';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { SaleCategoryService } from '../sale-category.service';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
@ -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 {SaleCategory} from '../core/sale-category';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { SaleCategory } from '../core/sale-category';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
};
|
||||
const url = '/v1/sale-categories';
|
||||
const url = '/api/sale-categories';
|
||||
const serviceName = 'SaleCategoryService';
|
||||
|
||||
@Injectable({
|
||||
@ -19,7 +19,7 @@ export class SaleCategoryService {
|
||||
}
|
||||
|
||||
get(id: string): Observable<SaleCategory> {
|
||||
const getUrl: string = (id === null) ? `${url}/new` : `${url}/${id}`;
|
||||
const getUrl: string = (id === null) ? url : `${url}/${id}`;
|
||||
return <Observable<SaleCategory>>this.http.get<SaleCategory>(getUrl)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get id=${id}`))
|
||||
@ -27,23 +27,21 @@ export class SaleCategoryService {
|
||||
}
|
||||
|
||||
list(): Observable<SaleCategory[]> {
|
||||
const options = {params: new HttpParams().set('l', '')};
|
||||
return <Observable<SaleCategory[]>>this.http.get<SaleCategory[]>(url, options)
|
||||
return <Observable<SaleCategory[]>>this.http.get<SaleCategory[]>(`${url}/list`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
}
|
||||
|
||||
listForDiscount(): Observable<{name: string, discount: number}[]> {
|
||||
const options = {params: new HttpParams().set('d', '')};
|
||||
return <Observable<{name: string, discount: number}[]>>this.http.get<{name: string, discount: number}[]>(url, options)
|
||||
return <Observable<{name: string, discount: number}[]>>this.http.get<{name: string, discount: number}[]>(`${url}/for-discount`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
}
|
||||
|
||||
save(saleCategory: SaleCategory): Observable<SaleCategory> {
|
||||
return <Observable<SaleCategory>>this.http.post<SaleCategory>(`${url}/new`, saleCategory, httpOptions)
|
||||
return <Observable<SaleCategory>>this.http.post<SaleCategory>(url, saleCategory, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'save'))
|
||||
);
|
||||
@ -56,13 +54,6 @@ export class SaleCategoryService {
|
||||
);
|
||||
}
|
||||
|
||||
updateSortOrder(list: SaleCategory[]): Observable<boolean> {
|
||||
return <Observable<boolean>>this.http.post<SaleCategory[]>(url, list, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'updateSortOrder'))
|
||||
);
|
||||
}
|
||||
|
||||
saveOrUpdate(saleCategory: SaleCategory): Observable<SaleCategory> {
|
||||
if (!saleCategory.id) {
|
||||
return this.save(saleCategory);
|
||||
|
||||
Reference in New Issue
Block a user