Created
June 12, 2022 07:58
-
-
Save agusrichard/51fb5b934a34e9b436107fb94d2349b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import enum | |
from sqlalchemy import Enum | |
from app import db | |
class UploadStatus(enum.Enum): | |
""" | |
Serves as enum values for upload_status column of files table | |
(either PENDING, PROCESSING, COMPLETE OR ERROR) | |
""" | |
PENDING = 1 | |
PROCESSING = 2 | |
COMPLETE = 3 | |
ERROR = 4 | |
class File(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
name = db.Column(db.String(255), unique=False, nullable=False) | |
url = db.Column(db.String(255), unique=False, nullable=True) | |
upload_status = db.Column( | |
Enum(UploadStatus), nullable=False, default=UploadStatus.PENDING | |
) | |
def __repr__(self): | |
return f"<File {self.name}>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment