選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

models.py 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 . import ma
  11. from datetime import datetime
  12. from marshmallow import Schema
  13. # table for users
  14. class User(UserMixin, db.Model):
  15. __tablename__ = 'User'
  16. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  17. email = db.Column(db.String(100), unique=True)
  18. password = db.Column(db.String(100))
  19. name = db.Column(db.String(1000))
  20. # table for resources
  21. class Resource(db.Model):
  22. __tablename__ = 'Resource'
  23. # all resource types
  24. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  25. created = db.Column(db.DateTime, default=datetime.utcnow)
  26. type = db.Column(db.Text)
  27. name = db.Column(db.Text)
  28. description = db.Column(db.Text)
  29. # tools
  30. developer = db.Column(db.Text)
  31. developerUrl = db.Column(db.Text)
  32. projectUrl = db.Column(db.Text)
  33. repositoryUrl = db.Column(db.Text)
  34. license = db.Column(db.Text)
  35. scriptingLanguage = db.Column(db.Text)
  36. expertiseToUse = db.Column(db.Text)
  37. expertiseToHost = db.Column(db.Text)
  38. dependencies = db.Column(db.Text)
  39. ingestFormats = db.Column(db.Text)
  40. outputFormats = db.Column(db.Text)
  41. status = db.Column(db.Text)
  42. # practices
  43. experimental = db.Column(db.Text)
  44. lessonsLearned = 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. # table for relationships
  52. class Relationship(db.Model):
  53. __tablename__ = 'Relationship'
  54. id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
  55. first_resource_id = db.Column(db.Integer)
  56. second_resource_id = db.Column(db.Integer)