project.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import jimit as ji
  4. from filter import FilterFieldType
  5. from orm import ORM
  6. __author__ = 'James Iter'
  7. __date__ = '2018/10/7'
  8. __contact__ = 'james.iter.cn@gmail.com'
  9. __copyright__ = '(c) 2018 by James Iter.'
  10. class Project(ORM):
  11. _table_name = 'project'
  12. _primary_key = 'id'
  13. def __init__(self):
  14. super(Project, self).__init__()
  15. self.id = 0
  16. self.name = ''
  17. self.description = ''
  18. self.create_time = ji.Common.tus()
  19. @staticmethod
  20. def get_filter_keywords():
  21. return {
  22. 'id': FilterFieldType.INT.value,
  23. 'name': FilterFieldType.STR.value
  24. }
  25. @staticmethod
  26. def get_allow_update_keywords():
  27. return []
  28. @staticmethod
  29. def get_allow_content_search_keywords():
  30. return ['name']
  31. class Service(ORM):
  32. _table_name = 'service'
  33. _primary_key = 'id'
  34. def __init__(self):
  35. super(Service, self).__init__()
  36. self.id = 0
  37. self.project_id = 0
  38. self.name = ''
  39. self.description = ''
  40. self.create_time = ji.Common.tus()
  41. @staticmethod
  42. def get_filter_keywords():
  43. return {
  44. 'id': FilterFieldType.INT.value,
  45. 'project_id': FilterFieldType.INT.value,
  46. 'name': FilterFieldType.STR.value
  47. }
  48. @staticmethod
  49. def get_allow_update_keywords():
  50. return ['project_id']
  51. @staticmethod
  52. def get_allow_content_search_keywords():
  53. return ['name']