Advertisement
lenegirl

users.json

Oct 1st, 2016
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. {
  2. "type": "object",
  3. "title": "User schema",
  4. "$schema": "http://json-schema.org/draft-04/schema",
  5. "_event_handlers": {
  6. "before_create": ["check_school"]
  7. },
  8. "required": ["id", "email", "type", "first_name", "last_name"],
  9. "_nested_relationships": ["authproviders"],
  10. "_nesting_depth": 2,
  11. "properties": {
  12. "id": {
  13. "type": ["integer", "null"],
  14. "_db_settings": {
  15. "type": "id_field",
  16. "required": true,
  17. "primary_key": true
  18. }
  19. },
  20. "first_name": {
  21. "type": "string",
  22. "_db_settings": {
  23. "type": "string",
  24. "required": true
  25. }
  26. },
  27. "last_name": {
  28. "type": "string",
  29. "_db_settings": {
  30. "type": "string",
  31. "required": true
  32. }
  33. },
  34. "email": {
  35. "type": "string",
  36. "_db_settings": {
  37. "type": "string",
  38. "required": true,
  39. "unique": true
  40. },
  41. "_processors": ["validate_email"]
  42. },
  43. "type": {
  44. "type": "choice",
  45. "_db_settings": {
  46. "type": "choice",
  47. "choices": ["student", "teacher", "admin"],
  48. "required": true
  49. }
  50. },
  51. "study_topics": {
  52. "type": "list",
  53. "_db_settings": {
  54. "type": "list",
  55. "item_type": "string",
  56. "required": false
  57. }
  58. },
  59. "authproviders": {
  60. "_db_settings": {
  61. "type": "relationship",
  62. "document": "Authprovider",
  63. "backref_name": "user",
  64. "required": true
  65. }
  66. },
  67. "created_at": {
  68. "type": ["string", "null"],
  69. "format": "date-time",
  70. "_db_settings": {
  71. "type": "datetime",
  72. "default": "{{datetime.datetime.utcnow}}"
  73. }
  74. },
  75. "updated_at": {
  76. "type": ["string", "null"],
  77. "format": "date-time",
  78. "_db_settings": {
  79. "type": "datetime",
  80. "onupdate": "{{datetime.datetime.utcnow}}"
  81. }
  82. }
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement