You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

models.py 1.9KB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # @name: models.py
  2. # @creation_date: 2021-10-20
  3. # @license: The MIT License <https://opensource.org/licenses/MIT>
  4. # @author: Simon Bowie <ad7588@coventry.ac.uk>
  5. # @purpose: Database models for tables in the database
  6. # @acknowledgements:
  7. # https://www.digitalocean.com/community/tutorials/how-to-add-authentication-to-your-app-with-flask-login
  8. from flask_login import UserMixin
  9. from . import db
  10. from datetime import datetime
  11. # table for users
  12. class User(UserMixin, db.Model):
  13. __tablename__ = 'User'
  14. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  15. email = db.Column(db.String(100), unique=True)
  16. password = db.Column(db.String(100))
  17. name = db.Column(db.String(1000))
  18. # table for resources
  19. class Resource(db.Model):
  20. __tablename__ = 'Resource'
  21. # all resource types
  22. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  23. created = db.Column(db.DateTime, default=datetime.utcnow)
  24. type = db.Column(db.Text)
  25. name = db.Column(db.Text)
  26. description = db.Column(db.Text)
  27. # tools
  28. developer = db.Column(db.Text)
  29. developerUrl = db.Column(db.Text)
  30. projectUrl = db.Column(db.Text)
  31. repositoryUrl = db.Column(db.Text)
  32. license = db.Column(db.Text)
  33. scriptingLanguage = db.Column(db.Text)
  34. expertiseToUse = db.Column(db.Text)
  35. expertiseToHost = db.Column(db.Text)
  36. dependencies = db.Column(db.Text)
  37. ingestFormats = db.Column(db.Text)
  38. outputFormats = db.Column(db.Text)
  39. status = db.Column(db.Text)
  40. # practices
  41. experimental = db.Column(db.Text)
  42. lessonsLearned = db.Column(db.Text)
  43. references = db.Column(db.Text)
  44. # books
  45. isbn = db.Column(db.Text)
  46. # table for relationships
  47. class Relationship(db.Model):
  48. __tablename__ = 'Relationship'
  49. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  50. first_resource_id = db.Column(db.Integer)
  51. second_resource_id = db.Column(db.Integer)