Feature: Adding recipe templates to print recipes.

Feautre: Recipe export to xlsx
Chore: Python 11 style type annotations
Chore: Moved to sqlalchemy 2.0
Chore: Minimum python is 3.11
Fix: Fix nullability of a lot of fields in the database.
This commit is contained in:
tanshu committed 2023-07-23 08:12:21 +05:30
1 parent d2d26ab1ae
commit 22cac61761
344 files changed
+3247 -2370

No files matched your search

+5 -5
View File
@@ -1,12 +1,12 @@
import { Injectable } from '@angular/core';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { Router, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { ToasterService } from '../core/toaster.service';
import { AuthService } from './auth.service';
@Injectable({ providedIn: 'root' })
export class AuthGuard implements CanActivate {
export class AuthGuard {
constructor(
private router: Router,
private authService: AuthService,
@@ -16,9 +16,9 @@ export class AuthGuard implements CanActivate {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
const { user } = this.authService;
const permission =
route.data.permission === undefined
? route.data.permission
: route.data.permission.replace(/ /g, '-').toLowerCase();
route.data['permission'] === undefined
? route.data['permission']
: route.data['permission'].replace(/ /g, '-').toLowerCase();
if (!user) {
// not logged in so redirect to login page with the return url
this.router.navigate(['/login'], { queryParams: { returnUrl: state.url } });
+2 -2
View File
@@ -76,11 +76,11 @@ export class AuthService {
return this.currentUserSubject.value;
}
login(username: string, password: string, otp: string) {
login(username: string, password: string, otp: number) {
const formData: FormData = new FormData();
formData.append('username', username);
formData.append('password', password);
formData.append('otp', otp);
formData.append('otp', '' + otp);
formData.append('grant_type', 'password');
return this.http
.post<{ access_token: string; token_type: string }>(loginUrl, formData)
@@ -1,8 +0,0 @@
.example-container {
display: flex;
flex-direction: column;
}
.example-container > * {
width: 100%;
}
+10 -5
View File
@@ -13,7 +13,12 @@ import { AuthService } from '../auth.service';
})
export class LoginComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
form: FormGroup;
form: FormGroup<{
username: FormControl<string>;
password: FormControl<string>;
otp: FormControl<number | null>;
}>;
hide: boolean;
showOtp: boolean;
clientId = '';
@@ -36,7 +41,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
}
ngOnInit() {
this.returnUrl = this.route.snapshot.queryParams.returnUrl || '/';
this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
}
ngAfterViewInit() {
@@ -49,9 +54,9 @@ export class LoginComponent implements OnInit, AfterViewInit {
login(): void {
const formModel = this.form.value;
const { username } = formModel;
const { password } = formModel;
const { otp } = formModel;
const username = formModel.username ?? '';
const password = formModel.password ?? '';
const otp = formModel.otp ?? 0;
this.auth
.login(username, password, otp)
// .pipe(first())