stc

a simple time card webapp
git clone _git@git.brennen.work:stc.git
Log | Files | Refs | README

commit 92e0a9a09610b3f0b0ef56a21c1fe1992416c811
parent dff6177158701d81d4b48a370730ebf68c24bb21
Author: Nikolas Mazur <nikolas@pop-os.localdomain>
Date:   Wed,  8 Feb 2023 14:52:05 -0700

Add query perameters

Diffstat:
Mapp/models.py | 45++++++++++++++++++++++++++++++++++++---------
1 file changed, 36 insertions(+), 9 deletions(-)

diff --git a/app/models.py b/app/models.py @@ -7,7 +7,6 @@ import datetime import uuid from flask import jsonify, request, redirect, session from fastapi.encoders import jsonable_encoder -#from passlib.hash import pbkdf2_sha256 # Replace with Brennen's hash when he finds it from typing import List, Optional from pydantic import Field, ValidationError, validator from werkzeug.security import generate_password_hash, check_password_hash @@ -146,6 +145,21 @@ class Time: class Fleet: + + def vehicle_repair(self): + vehicle_repair = { + '_id': int, + 'date': Optional[datetime.datetime.utcnow], + 'operator': int, #User ID forign key + 'safety_checks': bool, + 'additional_notes': str, + 'vehicle': int, + 'incident_report': str, + 'mileage': int + } + + return jsonify(vehicle_repair), 200 + _id: int date: Optional[datetime.datetime.utcnow] operator: int #forign key to userID @@ -155,18 +169,21 @@ class Fleet: incident_report: str mileage: int - def to_json(self): - return jsonable_encoder(self, exclude_none=True) - def to_bson(self): - data = self.dict(by_alias=True, exclude_none=True) +class Agreement: - if data["_id"] is None: - data.pop("_id") - return data + def document(self): + document = { + '_id': int, #forign key to user + 'start_date': int, + 'end_date': int, + 'bid_document': str, #Filepath to document + 'budget': float, + 'cost': int, + } + return jsonify(document), 200 -class Agreement: _id: int #forign key to user start_date: int end_date: int @@ -175,6 +192,16 @@ class Agreement: cost: int class Projects:#Projects references agreement + + def project(self): + project = { + 'project_id': int, + 'project_name': str, + # 'project_budget': List[float] = [] + } + + return jsonify(project), 200 + project_id: int project_name: str project_budget: List[float] = [