Added: Alembic for migrations
Moving from Pyramid to FastAPI
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<mat-header-cell *matHeaderCellDef>Name</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"><a [routerLink]="['/users', row.name]">{{row.name}}</a></mat-cell>
|
||||
<mat-cell *matCellDef="let row"><a [routerLink]="['/users', row.id]">{{row.name}}</a></mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Locked Out Column -->
|
||||
|
||||
@ -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 {User} from '../core/user';
|
||||
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 { User } from '../core/user';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
};
|
||||
const url = '/v1/users';
|
||||
const url = '/api/users';
|
||||
const serviceName = 'UserService';
|
||||
|
||||
@Injectable({
|
||||
@ -19,7 +19,7 @@ export class UserService {
|
||||
}
|
||||
|
||||
get(id: string): Observable<User> {
|
||||
const getUrl: string = (id === null) ? `${url}/new` : `${url}/${id}`;
|
||||
const getUrl: string = (id === null) ? `${url}` : `${url}/${id}`;
|
||||
return <Observable<User>>this.http.get<User>(getUrl)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get id=${id}`))
|
||||
@ -27,23 +27,21 @@ export class UserService {
|
||||
}
|
||||
|
||||
list(): Observable<User[]> {
|
||||
const options = {params: new HttpParams().set('l', '')};
|
||||
return <Observable<User[]>>this.http.get<User[]>(url, options)
|
||||
return <Observable<User[]>>this.http.get<User[]>(`${url}/list`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
}
|
||||
|
||||
listOfNames(): Observable<string[]> {
|
||||
const options = {params: new HttpParams().set('n', '')};
|
||||
return <Observable<string[]>>this.http.get<string[]>(url, options)
|
||||
return <Observable<string[]>>this.http.get<string[]>(`${url}/active`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
}
|
||||
|
||||
save(user: User): Observable<User> {
|
||||
return <Observable<User>>this.http.post<User>(`${url}/new`, user, httpOptions)
|
||||
return <Observable<User>>this.http.post<User>(`${url}`, user, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'save'))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user