Chore: Upgrade to Angular v18

Chore: Upgrade to Python 3.12
Chore: Upgrade to psycopg3
This commit is contained in:
2024-06-03 13:22:56 +05:30
parent 56c1be5e05
commit 010e9a84db
573 changed files with 5727 additions and 6528 deletions
@@ -1,12 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { ProductsResolver } from './products-resolver.service';
describe('ProductsResolver', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: ProductsResolver = TestBed.get(ProductsResolver);
expect(service).toBeTruthy();
});
});
@@ -1,21 +0,0 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Router } from '@angular/router';
import { Observable } from 'rxjs';
import { Product } from '../../core/product';
import { ProductService } from '../../product/product.service';
@Injectable({
providedIn: 'root',
})
export class ProductsResolver {
constructor(
private ser: ProductService,
private router: Router,
) {}
resolve(route: ActivatedRouteSnapshot): Observable<Product[]> {
const id = route.paramMap.get('id') as string;
return this.ser.listIsActiveOfCategory(id);
}
}
@@ -9,18 +9,19 @@
>
<h3>Back</h3>
</mat-card>
<mat-card
class="flex flex-col square-button mr-5, mb-5"
matRipple
*ngFor="let item of list"
(click)="addProduct(item)"
[class.accent]="item.hasHappyHour"
[class.strong-disabled]="item.isNotAvailable"
[class.primary]="!item.hasHappyHour && !item.isNotAvailable"
>
<h3>{{ item.name }}</h3>
<span>{{ item.price | currency: 'INR' }}</span>
</mat-card>
@for (item of list; track item) {
<mat-card
class="flex flex-col square-button mr-5, mb-5"
matRipple
(click)="addProduct(item)"
[class.accent]="item.hasHappyHour"
[class.strong-disabled]="item.isNotAvailable"
[class.primary]="!item.hasHappyHour && !item.isNotAvailable"
>
<h3>{{ item.name }}</h3>
<span>{{ item.price | currency: 'INR' }}</span>
</mat-card>
}
</div>
</mat-card-content>
</mat-card>
@@ -8,7 +8,7 @@ describe('ProductsComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ProductsComponent],
imports: [ProductsComponent],
}).compileComponents();
}));
@@ -1,5 +1,8 @@
import { CurrencyPipe } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { MatCard, MatCardContent } from '@angular/material/card';
import { MatRipple } from '@angular/material/core';
import { ActivatedRoute, RouterLink } from '@angular/router';
import { Product } from '../../core/product';
import { BillService } from '../bill.service';
@@ -8,6 +11,8 @@ import { BillService } from '../bill.service';
selector: 'app-products',
templateUrl: './products.component.html',
styleUrls: ['./products.component.css'],
standalone: true,
imports: [MatCard, MatCardContent, MatRipple, RouterLink, CurrencyPipe],
})
export class ProductsComponent implements OnInit {
list: Product[] = [];
@@ -0,0 +1,17 @@
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { inject, TestBed } from '@angular/core/testing';
import { ProductsResolver } from './products-resolver.service';
describe('ProductsResolver', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [],
providers: [ProductsResolver, provideHttpClient(withInterceptorsFromDi())],
});
});
it('should be created', inject([ProductsResolver], (service: ProductsResolver) => {
expect(service).toBeTruthy();
}));
});
@@ -0,0 +1,10 @@
import { inject } from '@angular/core';
import { ResolveFn } from '@angular/router';
import { Product } from '../../core/product';
import { ProductService } from '../../product/product.service';
export const productsResolver: ResolveFn<Product[]> = (route) => {
const id = route.paramMap.get('id') as string;
return inject(ProductService).listIsActiveOfCategory(id);
};