Display frontend / backend version at the homescreen

This commit is contained in:
Amritanshu Agrawal 2020-10-11 11:13:06 +05:30
parent d677cfb1ea
commit 9ecf0b5cc9
10 changed files with 20 additions and 4 deletions

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

View File

@ -15,6 +15,7 @@ from fastapi.responses import JSONResponse
from fastapi.security import OAuth2PasswordRequestForm
from sqlalchemy.orm import Session
from .. import __version__
from ..core.security import (
Token,
authenticate_user,
@ -85,6 +86,7 @@ async def login_for_access_token(
),
"userId": str(user.id),
"lockedOut": user.locked_out,
"ver": __version__.__version__,
},
expires_delta=access_token_expires,
)
@ -100,6 +102,7 @@ async def refresh_token(user: UserToken = Security(get_current_active_user)):
"scopes": user.permissions,
"userId": str(user.id_),
"lockedOut": user.locked_out,
"ver": __version__.__version__,
},
expires_delta=access_token_expires,
)

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "barker"
version = "0.1.0"
version = "1.0.0"
description = "Point of Sale for a restaurant"
authors = ["tanshu <git@tanshu.com>"]

View File

@ -1,6 +1,6 @@
{
"name": "bookie",
"version": "0.0.0",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",

View File

@ -10,6 +10,7 @@ export class User {
isAuthenticated: boolean;
access_token?: string;
exp?: number;
ver: string;
public constructor(init?: Partial<User>) {
Object.assign(this, init);

View File

@ -198,3 +198,6 @@
<h3 class="item-name">Users</h3>
</mat-card>
</div>
<footer class="footer">
<p>Backend: v{{ auth.user.ver }} / Frontend: v{{ version }}</p>
</footer>

View File

@ -1,5 +1,6 @@
import { Component } from '@angular/core';
import { environment } from '../../environments/environment';
import { AuthService } from '../auth/auth.service';
@Component({
@ -8,5 +9,9 @@ import { AuthService } from '../auth/auth.service';
styleUrls: ['./home.component.css'],
})
export class HomeComponent {
constructor(public auth: AuthService) {}
version: string;
constructor(public auth: AuthService) {
this.version = environment.version;
}
}

View File

@ -22,7 +22,8 @@ export class RunningTablesComponent implements OnInit {
navigateToBill(table: Table): void {
const qp = { table: table.id };
if (table.voucherId) {
qp.voucher = table.voucherId;
// eslint-disable-next-line @typescript-eslint/dot-notation
qp['voucher'] = table.voucherId;
}
const navigationExtras: NavigationExtras = {
queryParams: qp,

View File

@ -1,4 +1,5 @@
export const environment = {
production: true,
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
version: "1.0.0",
};

View File

@ -5,6 +5,7 @@
export const environment = {
production: false,
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
version: "1.0.0",
};
/*