boot_job.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from models import FilterFieldType
  4. from models import ORM
  5. __author__ = 'James Iter'
  6. __date__ = '2017/6/19'
  7. __contact__ = 'james.iter.cn@gmail.com'
  8. __copyright__ = '(c) 2017 by James Iter.'
  9. class BootJob(ORM):
  10. _table_name = 'boot_job'
  11. _primary_key = 'id'
  12. def __init__(self):
  13. super(BootJob, self).__init__()
  14. self.id = 0
  15. self.name = None
  16. self.use_for = None
  17. self.remark = ''
  18. @staticmethod
  19. def get_filter_keywords():
  20. return {
  21. 'id': FilterFieldType.INT.value,
  22. 'name': FilterFieldType.STR.value,
  23. 'use_for': FilterFieldType.INT.value,
  24. 'remark': FilterFieldType.STR.value
  25. }
  26. @staticmethod
  27. def get_allow_update_keywords():
  28. return ['use_for']
  29. @staticmethod
  30. def get_allow_content_search_keywords():
  31. return ['name', 'remark']
  32. class OperateRule(ORM):
  33. _table_name = 'operate_rule'
  34. _primary_key = 'id'
  35. def __init__(self):
  36. super(OperateRule, self).__init__()
  37. self.id = 0
  38. self.boot_job_id = None
  39. self.kind = ''
  40. self.sequence = 0
  41. self.command = ''
  42. self.path = ''
  43. self.content = ''
  44. @staticmethod
  45. def get_filter_keywords():
  46. return {
  47. 'id': FilterFieldType.INT.value,
  48. 'boot_job_id': FilterFieldType.INT.value,
  49. 'sequence': FilterFieldType.INT.value,
  50. 'command': FilterFieldType.STR.value,
  51. 'path': FilterFieldType.STR.value,
  52. 'content': FilterFieldType.STR.value,
  53. }
  54. @staticmethod
  55. def get_allow_update_keywords():
  56. return ['boot_job_id', 'sequence']
  57. @staticmethod
  58. def get_allow_content_search_keywords():
  59. return ['command', 'path', 'content']