Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

64 linhas
2.2KB

  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(1000))
  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. published = db.Column(db.Boolean)
  25. type = db.Column(db.Text)
  26. name = db.Column(db.Text)
  27. description = db.Column(db.Text)
  28. # tools
  29. developer = db.Column(db.Text)
  30. developerUrl = db.Column(db.Text)
  31. projectUrl = db.Column(db.Text)
  32. repositoryUrl = db.Column(db.Text)
  33. license = db.Column(db.Text)
  34. scriptingLanguage = db.Column(db.Text)
  35. expertiseToUse = db.Column(db.Text)
  36. expertiseToHost = db.Column(db.Text)
  37. dependencies = db.Column(db.Text)
  38. ingestFormats = db.Column(db.Text)
  39. outputFormats = db.Column(db.Text)
  40. status = db.Column(db.Text)
  41. # practices
  42. longDescription = db.Column(db.Text)
  43. experimental = db.Column(db.Text)
  44. considerations = db.Column(db.Text)
  45. references = db.Column(db.Text)
  46. # books
  47. author = db.Column(db.Text)
  48. year = db.Column(db.Text)
  49. bookUrl = db.Column(db.Text)
  50. isbn = db.Column(db.Text)
  51. typology = db.Column(db.Text)
  52. # table for relationships
  53. class Relationship(db.Model):
  54. __tablename__ = 'Relationship'
  55. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  56. first_resource_id = db.Column(db.Integer)
  57. second_resource_id = db.Column(db.Integer)