diff --git a/Backend/src/models/categories/categories.service.ts b/Backend/src/models/categories/categories.service.ts index 814d6cf..60610d4 100644 --- a/Backend/src/models/categories/categories.service.ts +++ b/Backend/src/models/categories/categories.service.ts @@ -23,6 +23,9 @@ import {Categories} from './categories.interface'; * Service Methods */ +/** + * Fetches and returns all known categories + */ export const findAll = async (): Promise<Categories> => { let conn; let categRows = []; @@ -54,6 +57,10 @@ export const findAll = async (): Promise<Categories> => { return categRows; }; +/** + * Fetches and returns the category with the specified id + * @param id The id of the category to fetch + */ export const find = async (id: number): Promise<Category> => { let conn; let categ: any; @@ -77,6 +84,10 @@ export const find = async (id: number): Promise<Category> => { return categ; }; +/** + * Fetches and returns all categories that match the search term + * @param term the term to match + */ export const findBySearchTerm = async (term: string): Promise<Categories> => { let conn; let categRows = []; @@ -100,36 +111,3 @@ export const findBySearchTerm = async (term: string): Promise<Categories> => { return categRows; }; - -// export const create = async (newItem: Product): Promise<void> => { -// let conn; -// try { -// conn = await pool.getConnection(); -// await conn.query(""); -// -// } catch (err) { -// throw err; -// } finally { -// if (conn) conn.end(); -// } -// }; -// -// export const update = async (updatedItem: Product): Promise<void> => { -// if (models.products[updatedItem.product_id]) { -// models.products[updatedItem.product_id] = updatedItem; -// return; -// } -// -// throw new Error("No record found to update"); -// }; -// -// export const remove = async (id: number): Promise<void> => { -// const record: Product = models.products[id]; -// -// if (record) { -// delete models.products[id]; -// return; -// } -// -// throw new Error("No record found to delete"); -// }; diff --git a/Backend/src/models/manufacturers/manufacturers.router.ts b/Backend/src/models/manufacturers/manufacturers.router.ts index 4d64ca9..bbd3c09 100644 --- a/Backend/src/models/manufacturers/manufacturers.router.ts +++ b/Backend/src/models/manufacturers/manufacturers.router.ts @@ -50,7 +50,7 @@ manufacturersRouter.get('/:id', async (req: Request, res: Response) => { } }); -// GET items/:name +// GET items/:term manufacturersRouter.get('/search/:term', async (req: Request, res: Response) => { const term: string = req.params.term; diff --git a/Backend/src/models/manufacturers/manufacturers.service.ts b/Backend/src/models/manufacturers/manufacturers.service.ts index a6f4c1d..2e6444a 100644 --- a/Backend/src/models/manufacturers/manufacturers.service.ts +++ b/Backend/src/models/manufacturers/manufacturers.service.ts @@ -23,6 +23,9 @@ import {Manufacturers} from './manufacturers.interface'; * Service Methods */ +/** + * Fetches and returns all known manufacturers + */ export const findAll = async (): Promise<Manufacturers> => { let conn; let manRows = []; @@ -54,6 +57,10 @@ export const findAll = async (): Promise<Manufacturers> => { return manRows; }; +/** + * Fetches and returns the manufacturer with the specified id + * @param id The id of the manufacturer to fetch + */ export const find = async (id: number): Promise<Manufacturer> => { let conn; let man: any; @@ -77,6 +84,10 @@ export const find = async (id: number): Promise<Manufacturer> => { return man; }; +/** + * Fetches and returns all manufacturers that match the search term + * @param term the term to match + */ export const findBySearchTerm = async (term: string): Promise<Manufacturers> => { let conn; let manRows = []; @@ -100,36 +111,3 @@ export const findBySearchTerm = async (term: string): Promise<Manufacturers> => return manRows; }; - -// export const create = async (newItem: Product): Promise<void> => { -// let conn; -// try { -// conn = await pool.getConnection(); -// await conn.query(""); -// -// } catch (err) { -// throw err; -// } finally { -// if (conn) conn.end(); -// } -// }; -// -// export const update = async (updatedItem: Product): Promise<void> => { -// if (models.products[updatedItem.product_id]) { -// models.products[updatedItem.product_id] = updatedItem; -// return; -// } -// -// throw new Error("No record found to update"); -// }; -// -// export const remove = async (id: number): Promise<void> => { -// const record: Product = models.products[id]; -// -// if (record) { -// delete models.products[id]; -// return; -// } -// -// throw new Error("No record found to delete"); -// }; diff --git a/Backend/src/models/prices/prices.service.ts b/Backend/src/models/prices/prices.service.ts index 8d01bc1..52d811f 100644 --- a/Backend/src/models/prices/prices.service.ts +++ b/Backend/src/models/prices/prices.service.ts @@ -23,6 +23,9 @@ import {Prices} from './prices.interface'; * Service Methods */ +/** + * Fetches and returns all known prices + */ export const findAll = async (): Promise<Prices> => { let conn; let priceRows = []; @@ -60,6 +63,10 @@ export const findAll = async (): Promise<Prices> => { return priceRows; }; +/** + * Fetches and returns the price with the specified id + * @param id The id of the price to fetch + */ export const find = async (id: number): Promise<Price> => { let conn; let price: any; @@ -83,6 +90,10 @@ export const find = async (id: number): Promise<Price> => { return price; }; +/** + * Fetches and returns all prices that belong to the specified product + * @param product the product to fetch the prices for + */ export const findByProduct = async (product: number): Promise<Prices> => { let conn; let priceRows = []; @@ -106,6 +117,14 @@ export const findByProduct = async (product: number): Promise<Prices> => { return priceRows; }; +/** + * Fetches and returns prices that belong to the specified product. + * If type is newest, only the newest prices for each vendor will be returned. + * If type is lowest, the lowest daily price for the product is returned. + * Otherwise, all prices for this product are returned. + * @param product The product to fetch the prices for + * @param type The type of prices, e.g. newest / lowest + */ export const findByType = async (product: string, type: string): Promise<Prices> => { let conn; let priceRows = []; @@ -152,6 +171,15 @@ export const findByType = async (product: string, type: string): Promise<Prices> return priceRows; }; +/** + * Fetches and returns prices that belong to the specified product and vendor. + * If type is newest, only the newest known price for the product at the vendor is returned. + * If type is lowest, only the lowest ever known price for the product at the vendor is returned. + * Otherwise, all prices for this product are returned. + * @param product The product to fetch the prices for + * @param vendor The vendor to fetch the prices for + * @param type The type of prices, e.g. newest / lowest + */ export const findByVendor = async (product: string, vendor: string, type: string): Promise<Prices> => { let conn; let priceRows = []; @@ -186,6 +214,11 @@ export const findByVendor = async (product: string, vendor: string, type: string return priceRows; }; +/** + * Fetches and returns the best current deals, i.e. the non-amazon prices that have the biggest difference to amazon prices. + * Only the latest known prices for every vendor are taken into consideration so we only get up-to-date-deals. + * @param amount The amount of deals to return + */ export const getBestDeals = async (amount: number): Promise<Prices> => { let conn; let priceRows = []; @@ -282,7 +315,7 @@ export const getBestDeals = async (amount: number): Promise<Prices> => { }; /** - * Get the lowest, latest, non-amazon price for each given product + * Fetches and returns the lowest, latest, non-amazon price for each given product * @param ids the ids of the products */ export const findListByProducts = async (productIds: [number]): Promise<Prices> => { @@ -344,36 +377,3 @@ export const findListByProducts = async (productIds: [number]): Promise<Prices> return priceRows; }; - -// export const create = async (newItem: Product): Promise<void> => { -// let conn; -// try { -// conn = await pool.getConnection(); -// await conn.query(""); -// -// } catch (err) { -// throw err; -// } finally { -// if (conn) conn.end(); -// } -// }; -// -// export const update = async (updatedItem: Product): Promise<void> => { -// if (models.products[updatedItem.product_id]) { -// models.products[updatedItem.product_id] = updatedItem; -// return; -// } -// -// throw new Error("No record found to update"); -// }; -// -// export const remove = async (id: number): Promise<void> => { -// const record: Product = models.products[id]; -// -// if (record) { -// delete models.products[id]; -// return; -// } -// -// throw new Error("No record found to delete"); -// }; diff --git a/Backend/src/models/products/products.service.ts b/Backend/src/models/products/products.service.ts index 2c612e2..c0bee72 100644 --- a/Backend/src/models/products/products.service.ts +++ b/Backend/src/models/products/products.service.ts @@ -23,6 +23,9 @@ import {Products} from './products.interface'; * Service Methods */ +/** + * Fetches and returns all known products + */ export const findAll = async (): Promise<Products> => { let conn; let prodRows = []; @@ -74,6 +77,10 @@ export const findAll = async (): Promise<Products> => { return prodRows; }; +/** + * Fetches and returns the product with the specified id + * @param id The id of the product to fetch + */ export const find = async (id: number): Promise<Product> => { let conn; let prod: any; @@ -97,6 +104,10 @@ export const find = async (id: number): Promise<Product> => { return prod; }; +/** + * Fetches and returns all products that match the search term + * @param term the term to match + */ export const findBySearchTerm = async (term: string): Promise<Products> => { let conn; let prodRows = []; @@ -122,6 +133,10 @@ export const findBySearchTerm = async (term: string): Promise<Products> => { return prodRows; }; +/** + * Fetches and returns the product details for the given list of product ids + * @param ids The list of product ids to fetch the details for + */ export const findList = async (ids: [number]): Promise<Products> => { let conn; let prodRows = []; @@ -144,36 +159,3 @@ export const findList = async (ids: [number]): Promise<Products> => { return prodRows; }; - -// export const create = async (newItem: Product): Promise<void> => { -// let conn; -// try { -// conn = await pool.getConnection(); -// await conn.query(""); -// -// } catch (err) { -// throw err; -// } finally { -// if (conn) conn.end(); -// } -// }; -// -// export const update = async (updatedItem: Product): Promise<void> => { -// if (models.products[updatedItem.product_id]) { -// models.products[updatedItem.product_id] = updatedItem; -// return; -// } -// -// throw new Error("No record found to update"); -// }; -// -// export const remove = async (id: number): Promise<void> => { -// const record: Product = models.products[id]; -// -// if (record) { -// delete models.products[id]; -// return; -// } -// -// throw new Error("No record found to delete"); -// }; diff --git a/Backend/src/models/vendors/vendors.service.ts b/Backend/src/models/vendors/vendors.service.ts index 70c0ef2..ca8bbee 100644 --- a/Backend/src/models/vendors/vendors.service.ts +++ b/Backend/src/models/vendors/vendors.service.ts @@ -23,6 +23,9 @@ import {Vendors} from './vendors.interface'; * Service Methods */ +/** + * Fetches and returns all known vendors + */ export const findAll = async (): Promise<Vendors> => { let conn; let vendorRows = []; @@ -66,6 +69,10 @@ export const findAll = async (): Promise<Vendors> => { return vendorRows; }; +/** + * Fetches and returns the vendor with the specified id + * @param id The id of the vendor to fetch + */ export const find = async (id: number): Promise<Vendor> => { let conn; let vendor: any; @@ -89,6 +96,10 @@ export const find = async (id: number): Promise<Vendor> => { return vendor; }; +/** + * Fetches and returns all vendors that match the search term + * @param term the term to match + */ export const findBySearchTerm = async (term: string): Promise<Vendors> => { let conn; let vendorRows = []; @@ -112,36 +123,3 @@ export const findBySearchTerm = async (term: string): Promise<Vendors> => { return vendorRows; }; - -// export const create = async (newItem: Product): Promise<void> => { -// let conn; -// try { -// conn = await pool.getConnection(); -// await conn.query(""); -// -// } catch (err) { -// throw err; -// } finally { -// if (conn) conn.end(); -// } -// }; -// -// export const update = async (updatedItem: Product): Promise<void> => { -// if (models.products[updatedItem.product_id]) { -// models.products[updatedItem.product_id] = updatedItem; -// return; -// } -// -// throw new Error("No record found to update"); -// }; -// -// export const remove = async (id: number): Promise<void> => { -// const record: Product = models.products[id]; -// -// if (record) { -// delete models.products[id]; -// return; -// } -// -// throw new Error("No record found to delete"); -// }; diff --git a/Frontend/package.json b/Frontend/package.json index ac0bf19..17567b0 100644 --- a/Frontend/package.json +++ b/Frontend/package.json @@ -26,6 +26,7 @@ "@ng-bootstrap/ng-bootstrap": "^8.0.4", "apexcharts": "^3.22.3", "bootstrap": "^4.5.0", + "cookieconsent": "^3.1.1", "karma-firefox-launcher": "^2.1.0", "ng": "0.0.0", "ng-apexcharts": "^1.5.6", diff --git a/Frontend/src/app/app.module.ts b/Frontend/src/app/app.module.ts index ea24310..0e74770 100644 --- a/Frontend/src/app/app.module.ts +++ b/Frontend/src/app/app.module.ts @@ -23,11 +23,11 @@ import {NgcCookieConsentModule, NgcCookieConsentConfig} from 'ngx-cookieconsent' import {MatSlideToggleModule} from '@angular/material/slide-toggle'; import {TopBarComponent} from './components/top-bar/top-bar.component'; import {RouterModule} from '@angular/router'; -import {MatButtonModule} from '@angular/material/button'; +import {MatButtonModule} from "@angular/material/button"; import {MatToolbarModule} from '@angular/material/toolbar'; import {MatIconModule} from '@angular/material/icon'; import {MatSidenavModule} from '@angular/material/sidenav'; -import {MatListModule} from '@angular/material/list'; +import {MatListModule} from "@angular/material/list"; import {BottomBarComponent} from './components/bottom-bar/bottom-bar.component'; diff --git a/Frontend/src/app/components/bottom-bar/bottom-bar.component.css b/Frontend/src/app/components/bottom-bar/bottom-bar.component.css index b8802a0..fc3459c 100644 --- a/Frontend/src/app/components/bottom-bar/bottom-bar.component.css +++ b/Frontend/src/app/components/bottom-bar/bottom-bar.component.css @@ -1,6 +1,6 @@ .bottom-bar-wrapper { display: grid; - grid-template-columns: repeat(3, 1fr); + grid-template-columns: 546px 546px 546px; grid-template-rows: 70px 70px 70px; grid-column-gap: 0px; grid-row-gap: 0px; @@ -21,10 +21,43 @@ margin-right: 60px; } +#footer-line { + grid-area: 3/1/3/4; + width: 100%; + background-color: #000000; + height: 2px; +} + .bottom-logo { grid-column: 1; grid-row: 3; } .bottom-info { grid-column: 3; grid-row: 3; + justify-self: right; +} + +#folge { + font-size: 46px; + font-weight: bold; + color: #E53167; + margin-right: 10px; +} + +#uns { + font-size: 32px; + font-weight: bold; + color: #000000; +} + +#better { + font-size: 28px; + font-weight: bold; + color: #3480E3; +} + +#zon { + font-size: 28px; + font-weight: bold; + color: #E53167; } diff --git a/Frontend/src/app/components/bottom-bar/bottom-bar.component.html b/Frontend/src/app/components/bottom-bar/bottom-bar.component.html index 9671b6c..d3787d8 100644 --- a/Frontend/src/app/components/bottom-bar/bottom-bar.component.html +++ b/Frontend/src/app/components/bottom-bar/bottom-bar.component.html @@ -1,22 +1,23 @@ <div class="bottom-bar-wrapper"> <div class="folge-uns-item"> - <p>FOLGE UNS</p> + <p><span id="folge">FOLGE</span><span id="uns">UNS</span></p> </div> <div class="link-items"> <ul style="list-style-type:none" class="footer-links"> - <li><a>GiT</a></li> - <li><a>BLOG</a></li> - <li><a>Wiki</a></li> - <li><a>YouTrack</a></li> + <li><a href="https://github.com/Mueller-Patrick/Betterzon">GiT</a></li> + <li><a href="https://blog.betterzon.xyz/">BLOG</a></li> + <li><a href="https://github.com/Mueller-Patrick/Betterzon/wiki">Wiki</a></li> </ul> + </div> + <div id="footer-line"> + </div> <div class="bottom-logo"> - <p>BETTERZON</p> + <p><span id="better">BETTER</span><span id="zon">ZON</span></p> </div> <div class="bottom-info"> <ul style="list-style-type:none" class="footer-links"> - <li><a>COOKIES</a></li> - <li><a>NUTZUNGSBEDINGUNGEN</a></li> + <li><a>DATENSCHUTZERKLĂ„RUNG</a></li> <li><a>IMPRESSUM</a></li> </ul> </div> diff --git a/Frontend/src/app/components/bottom-bar/bottom-bar.component.spec.ts b/Frontend/src/app/components/bottom-bar/bottom-bar.component.spec.ts index ba58627..0181062 100644 --- a/Frontend/src/app/components/bottom-bar/bottom-bar.component.spec.ts +++ b/Frontend/src/app/components/bottom-bar/bottom-bar.component.spec.ts @@ -1,8 +1,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { BottomBarComponent } from './bottom-bar.component'; +import { BottomBarComponent } from "./bottom-bar.component"; -describe('BottomBarComponent', () => { +describe("BottomBarComponent", () => { let component: BottomBarComponent; let fixture: ComponentFixture<BottomBarComponent>; diff --git a/Frontend/src/app/components/bottom-bar/bottom-bar.component.ts b/Frontend/src/app/components/bottom-bar/bottom-bar.component.ts index 89baa39..603ea87 100644 --- a/Frontend/src/app/components/bottom-bar/bottom-bar.component.ts +++ b/Frontend/src/app/components/bottom-bar/bottom-bar.component.ts @@ -2,8 +2,8 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-bottom-bar', - templateUrl: './bottom-bar.component.html', - styleUrls: ['./bottom-bar.component.css'] + templateUrl: "./bottom-bar.component.html", + styleUrls: ["./bottom-bar.component.css"] }) export class BottomBarComponent implements OnInit { diff --git a/Frontend/src/styles.css b/Frontend/src/styles.css index 393e10f..d14b926 100644 --- a/Frontend/src/styles.css +++ b/Frontend/src/styles.css @@ -42,6 +42,7 @@ a { a:hover { opacity: 0.8; + color: #3480E3; } a, p{ @@ -128,10 +129,11 @@ app-bottom-bar{ width: 1640px; height: 210px; position: fixed; - padding: 16px; margin-top: 90px; bottom: 0; flex-direction: row; + display: flex; + justify-content: space-between; } diff --git a/README.md b/README.md index 8e3907e..b9abce7 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ Website: https://www.betterzon.xyz<br> Blog: https://blog.betterzon.xyz<br> Wiki: https://github.com/Mueller-Patrick/Betterzon/wiki +# Code Quality +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/88e47ebf837b43af9d12147c22f77f7f)](https://www.codacy.com/gh/Mueller-Patrick/Betterzon/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Mueller-Patrick/Betterzon&utm_campaign=Badge_Grade) + # Project Status -![Latest Commit Build Status](https://ci.betterzon.xyz/job/Verify_Build_on_PR/badge/icon?style=flat-square&subject=Latest%20Commit) -![Deployment Status](https://ci.betterzon.xyz/job/GitHub%20Deployment/badge/icon?style=flat-square&subject=Deployment&status=Success) -<br> [![Website Status](https://img.shields.io/website?label=www.betterzon.xyz&style=for-the-badge&url=https%3A%2F%2Fwww.betterzon.xyz)](https://www.betterzon.xyz) [![Blog Status](https://img.shields.io/website?label=blog.betterzon.xyz&style=for-the-badge&url=https%3A%2F%2Fblog.betterzon.xyz)](https://blog.betterzon.xyz)