Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing model file for historical records.py #5439

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions request-management-api/request_api/models/HistoricalRecords.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from flask.app import Flask
from sqlalchemy.sql.schema import ForeignKey, ForeignKeyConstraint
from .db import db, ma
from datetime import datetime
from sqlalchemy.orm import relationship,backref
from .default_method_result import DefaultMethodResult
from sqlalchemy.sql.expression import distinct
from sqlalchemy import or_,and_,text

class HistoricalRecords(db.Model):
# Name of the table in our database
__tablename__ = 'HistoricalRecords'

# Defining the columns
historicalrecordid = db.Column(db.Integer, primary_key=True,autoincrement=True)
recordfilename = db.Column(db.String(500), unique=False, nullable=False)
description = db.Column(db.String(500), unique=False, nullable=True)
axisrequestid = db.Column(db.String(120), unique=False, nullable=False)
s3uripath = db.Column(db.Text, unique=False, nullable=False)
attributes = db.Column(db.Text, unique=False, nullable=True)
iscorresponcedocument = db.Column(db.Boolean, unique=False, nullable=False)
displayfilename = db.Column(db.String(500), unique=False, nullable=True)

created_at = db.Column(db.DateTime, default=datetime.now)
createdby = db.Column(db.String(120), unique=False, nullable=True)

@classmethod
def getdocuments(cls,axisrequestid):
comment_schema = HistoricalRecordschema(many=True)
query = db.session.query(HistoricalRecords).filter_by(axisrequestid=axisrequestid).order_by(HistoricalRecords.attributes.desc(), HistoricalRecords.historicalrecordid.asc()).all()
return comment_schema.dump(query)



class HistoricalRecordschema(ma.Schema):
class Meta:
fields = ('historicalrecordid', 'recordfilename', 'description', 'axisrequestid', 's3uripath', 'attributes', 'iscorresponcedocument', 'displayfilename', 'created_at', 'createdby')